[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

Same changes in files affected by reduced MC headers dependencies.

llvm-svn: 295009
This commit is contained in:
Eugene Zelenko 2017-02-14 00:33:36 +00:00
parent c45f7f3eb4
commit d96089b248
15 changed files with 299 additions and 178 deletions

View File

@ -1,4 +1,4 @@
//===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- C++ -*-===// //===- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework ---------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -17,35 +17,41 @@
#define LLVM_CODEGEN_ASMPRINTER_H #define LLVM_CODEGEN_ASMPRINTER_H
#include "llvm/ADT/MapVector.h" #include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/DwarfStringPoolEntry.h" #include "llvm/CodeGen/DwarfStringPoolEntry.h"
#include "llvm/IR/InlineAsm.h" #include "llvm/IR/InlineAsm.h"
#include "llvm/Support/DataTypes.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
namespace llvm { namespace llvm {
class AsmPrinterHandler; class AsmPrinterHandler;
class BlockAddress; class BlockAddress;
class ByteStreamer;
class GCStrategy;
class Constant; class Constant;
class ConstantArray; class ConstantArray;
class DataLayout;
class DIE; class DIE;
class DIEAbbrev; class DIEAbbrev;
class DwarfDebug;
class GCMetadataPrinter; class GCMetadataPrinter;
class GlobalIndirectSymbol; class GlobalIndirectSymbol;
class GlobalValue; class GlobalValue;
class GlobalVariable; class GlobalVariable;
class GCStrategy;
class MachineBasicBlock; class MachineBasicBlock;
class MachineConstantPoolValue;
class MachineFunction; class MachineFunction;
class MachineInstr; class MachineInstr;
class MachineLocation;
class MachineLoopInfo;
class MachineLoop;
class MachineConstantPoolValue;
class MachineJumpTableInfo; class MachineJumpTableInfo;
class MachineLoopInfo;
class MachineModuleInfo; class MachineModuleInfo;
class MCAsmInfo; class MCAsmInfo;
class MCCFIInstruction; class MCCFIInstruction;
@ -58,10 +64,7 @@ class MCSubtargetInfo;
class MCSymbol; class MCSymbol;
class MCTargetOptions; class MCTargetOptions;
class MDNode; class MDNode;
class DwarfDebug;
class Mangler;
class TargetLoweringObjectFile; class TargetLoweringObjectFile;
class DataLayout;
class TargetMachine; class TargetMachine;
/// This class is intended to be used as a driving class for all asm writers. /// This class is intended to be used as a driving class for all asm writers.
@ -85,20 +88,20 @@ public:
std::unique_ptr<MCStreamer> OutStreamer; std::unique_ptr<MCStreamer> OutStreamer;
/// The current machine function. /// The current machine function.
const MachineFunction *MF; const MachineFunction *MF = nullptr;
/// This is a pointer to the current MachineModuleInfo. /// This is a pointer to the current MachineModuleInfo.
MachineModuleInfo *MMI; MachineModuleInfo *MMI = nullptr;
/// The symbol for the current function. This is recalculated at the beginning /// The symbol for the current function. This is recalculated at the beginning
/// of each call to runOnMachineFunction(). /// of each call to runOnMachineFunction().
/// ///
MCSymbol *CurrentFnSym; MCSymbol *CurrentFnSym = nullptr;
/// The symbol used to represent the start of the current function for the /// The symbol used to represent the start of the current function for the
/// purpose of calculating its size (e.g. using the .size directive). By /// purpose of calculating its size (e.g. using the .size directive). By
/// default, this is equal to CurrentFnSym. /// default, this is equal to CurrentFnSym.
MCSymbol *CurrentFnSymForSize; MCSymbol *CurrentFnSymForSize = nullptr;
/// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of /// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of
/// its number of uses by other globals. /// its number of uses by other globals.
@ -106,12 +109,12 @@ public:
MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs; MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs;
private: private:
MCSymbol *CurrentFnBegin; MCSymbol *CurrentFnBegin = nullptr;
MCSymbol *CurrentFnEnd; MCSymbol *CurrentFnEnd = nullptr;
MCSymbol *CurExceptionSym; MCSymbol *CurExceptionSym = nullptr;
// The garbage collection metadata printer table. // The garbage collection metadata printer table.
void *GCMetadataPrinters; // Really a DenseMap. void *GCMetadataPrinters = nullptr; // Really a DenseMap.
/// Emit comments in assembly output if this is true. /// Emit comments in assembly output if this is true.
/// ///
@ -119,7 +122,7 @@ private:
static char ID; static char ID;
/// If VerboseAsm is set, a pointer to the loop info for this function. /// If VerboseAsm is set, a pointer to the loop info for this function.
MachineLoopInfo *LI; MachineLoopInfo *LI = nullptr;
struct HandlerInfo { struct HandlerInfo {
AsmPrinterHandler *Handler; AsmPrinterHandler *Handler;
@ -127,6 +130,7 @@ private:
const char *TimerDescription; const char *TimerDescription;
const char *TimerGroupName; const char *TimerGroupName;
const char *TimerGroupDescription; const char *TimerGroupDescription;
HandlerInfo(AsmPrinterHandler *Handler, const char *TimerName, HandlerInfo(AsmPrinterHandler *Handler, const char *TimerName,
const char *TimerDescription, const char *TimerGroupName, const char *TimerDescription, const char *TimerGroupName,
const char *TimerGroupDescription) const char *TimerGroupDescription)
@ -152,10 +156,10 @@ private:
mutable std::unique_ptr<SrcMgrDiagInfo> DiagInfo; mutable std::unique_ptr<SrcMgrDiagInfo> DiagInfo;
/// If the target supports dwarf debug info, this pointer is non-null. /// If the target supports dwarf debug info, this pointer is non-null.
DwarfDebug *DD; DwarfDebug *DD = nullptr;
/// If the current module uses dwarf CFI annotations strictly for debugging. /// If the current module uses dwarf CFI annotations strictly for debugging.
bool isCFIMoveForDebugging; bool isCFIMoveForDebugging = false;
protected: protected:
explicit AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer); explicit AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
@ -395,7 +399,7 @@ public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Symbol Lowering Routines. // Symbol Lowering Routines.
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
public:
MCSymbol *createTempSymbol(const Twine &Name) const; MCSymbol *createTempSymbol(const Twine &Name) const;
/// Return the MCSymbol for a private symbol with global value name as its /// Return the MCSymbol for a private symbol with global value name as its
@ -421,7 +425,7 @@ public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Emission Helper Routines. // Emission Helper Routines.
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
public:
/// This is just convenient handler for printing offsets. /// This is just convenient handler for printing offsets.
void printOffset(int64_t Offset, raw_ostream &OS) const; void printOffset(int64_t Offset, raw_ostream &OS) const;
@ -525,7 +529,7 @@ public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Inline Asm Support // Inline Asm Support
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
public:
// These are hooks that targets can override to implement inline asm // These are hooks that targets can override to implement inline asm
// support. These should probably be moved out of AsmPrinter someday. // support. These should probably be moved out of AsmPrinter someday.
@ -569,9 +573,9 @@ public:
private: private:
/// Private state for PrintSpecial() /// Private state for PrintSpecial()
// Assign a unique ID to this machine instruction. // Assign a unique ID to this machine instruction.
mutable const MachineInstr *LastMI; mutable const MachineInstr *LastMI = nullptr;
mutable unsigned LastFn; mutable unsigned LastFn = 0;
mutable unsigned Counter; mutable unsigned Counter = ~0U;
/// This method emits the header for the current function. /// This method emits the header for the current function.
virtual void EmitFunctionHeader(); virtual void EmitFunctionHeader();
@ -610,6 +614,7 @@ private:
void emitGlobalIndirectSymbol(Module &M, void emitGlobalIndirectSymbol(Module &M,
const GlobalIndirectSymbol& GIS); const GlobalIndirectSymbol& GIS);
}; };
}
#endif } // end namespace llvm
#endif // LLVM_CODEGEN_ASMPRINTER_H

View File

@ -15,6 +15,7 @@
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
@ -23,35 +24,35 @@
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include "llvm/Support/Dwarf.h" #include "llvm/Support/Dwarf.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <map> #include <map>
#include <tuple> #include <memory>
#include <vector> // FIXME: Shouldn't be needed. #include <string>
#include <utility>
#include <vector>
namespace llvm { namespace llvm {
class CodeViewContext;
class MCAsmInfo; class MCAsmInfo;
class MCExpr;
class MCSection;
class MCSymbol;
class MCSymbolELF;
class MCLabel; class MCLabel;
struct MCDwarfFile;
class MCDwarfLoc;
class MCObjectFileInfo; class MCObjectFileInfo;
class MCRegisterInfo; class MCRegisterInfo;
class MCLineSection; class MCSection;
class SMLoc;
class MCSectionMachO;
class MCSectionELF;
class MCSectionCOFF; class MCSectionCOFF;
class CodeViewContext; class MCSectionELF;
class MCSectionMachO;
class MCSymbol;
class MCSymbolELF;
class SMLoc;
/// Context object for machine code objects. This class owns all of the /// Context object for machine code objects. This class owns all of the
/// sections that it creates. /// sections that it creates.
/// ///
class MCContext { class MCContext {
MCContext(const MCContext &) = delete;
MCContext &operator=(const MCContext &) = delete;
public: public:
typedef StringMap<MCSymbol *, BumpPtrAllocator &> SymbolTable; typedef StringMap<MCSymbol *, BumpPtrAllocator &> SymbolTable;
@ -122,7 +123,7 @@ namespace llvm {
/// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to
/// catch errors if .secure_log_unique appears twice without /// catch errors if .secure_log_unique appears twice without
/// .secure_log_reset appearing between them. /// .secure_log_reset appearing between them.
bool SecureLogUsed; bool SecureLogUsed = false;
/// The compilation directory to use for DW_AT_comp_dir. /// The compilation directory to use for DW_AT_comp_dir.
SmallString<128> CompilationDir; SmallString<128> CompilationDir;
@ -138,14 +139,14 @@ namespace llvm {
/// The current dwarf line information from the last dwarf .loc directive. /// The current dwarf line information from the last dwarf .loc directive.
MCDwarfLoc CurrentDwarfLoc; MCDwarfLoc CurrentDwarfLoc;
bool DwarfLocSeen; bool DwarfLocSeen = false;
/// Generate dwarf debugging info for assembly source files. /// Generate dwarf debugging info for assembly source files.
bool GenDwarfForAssembly; bool GenDwarfForAssembly = false;
/// The current dwarf file number when generate dwarf debugging info for /// The current dwarf file number when generate dwarf debugging info for
/// assembly source files. /// assembly source files.
unsigned GenDwarfFileNumber; unsigned GenDwarfFileNumber = 0;
/// Sections for generating the .debug_ranges and .debug_aranges sections. /// Sections for generating the .debug_ranges and .debug_aranges sections.
SetVector<MCSection *> SectionsForRanges; SetVector<MCSection *> SectionsForRanges;
@ -163,25 +164,27 @@ namespace llvm {
StringRef DwarfDebugProducer; StringRef DwarfDebugProducer;
/// The maximum version of dwarf that we should emit. /// The maximum version of dwarf that we should emit.
uint16_t DwarfVersion; uint16_t DwarfVersion = 4;
/// Honor temporary labels, this is useful for debugging semantic /// Honor temporary labels, this is useful for debugging semantic
/// differences between temporary and non-temporary labels (primarily on /// differences between temporary and non-temporary labels (primarily on
/// Darwin). /// Darwin).
bool AllowTemporaryLabels; bool AllowTemporaryLabels = true;
bool UseNamesOnTempLabels = true; bool UseNamesOnTempLabels = true;
/// The Compile Unit ID that we are currently processing. /// The Compile Unit ID that we are currently processing.
unsigned DwarfCompileUnitID; unsigned DwarfCompileUnitID = 0;
struct ELFSectionKey { struct ELFSectionKey {
std::string SectionName; std::string SectionName;
StringRef GroupName; StringRef GroupName;
unsigned UniqueID; unsigned UniqueID;
ELFSectionKey(StringRef SectionName, StringRef GroupName, ELFSectionKey(StringRef SectionName, StringRef GroupName,
unsigned UniqueID) unsigned UniqueID)
: SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) { : SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {
} }
bool operator<(const ELFSectionKey &Other) const { bool operator<(const ELFSectionKey &Other) const {
if (SectionName != Other.SectionName) if (SectionName != Other.SectionName)
return SectionName < Other.SectionName; return SectionName < Other.SectionName;
@ -196,10 +199,12 @@ namespace llvm {
StringRef GroupName; StringRef GroupName;
int SelectionKey; int SelectionKey;
unsigned UniqueID; unsigned UniqueID;
COFFSectionKey(StringRef SectionName, StringRef GroupName, COFFSectionKey(StringRef SectionName, StringRef GroupName,
int SelectionKey, unsigned UniqueID) int SelectionKey, unsigned UniqueID)
: SectionName(SectionName), GroupName(GroupName), : SectionName(SectionName), GroupName(GroupName),
SelectionKey(SelectionKey), UniqueID(UniqueID) {} SelectionKey(SelectionKey), UniqueID(UniqueID) {}
bool operator<(const COFFSectionKey &Other) const { bool operator<(const COFFSectionKey &Other) const {
if (SectionName != Other.SectionName) if (SectionName != Other.SectionName)
return SectionName < Other.SectionName; return SectionName < Other.SectionName;
@ -221,7 +226,7 @@ namespace llvm {
/// Do automatic reset in destructor /// Do automatic reset in destructor
bool AutoReset; bool AutoReset;
bool HadError; bool HadError = false;
MCSymbol *createSymbolImpl(const StringMapEntry<bool> *Name, MCSymbol *createSymbolImpl(const StringMapEntry<bool> *Name,
bool CanBeUnnamed); bool CanBeUnnamed);
@ -242,6 +247,8 @@ namespace llvm {
explicit MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI, explicit MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI,
const MCObjectFileInfo *MOFI, const MCObjectFileInfo *MOFI,
const SourceMgr *Mgr = nullptr, bool DoAutoReset = true); const SourceMgr *Mgr = nullptr, bool DoAutoReset = true);
MCContext(const MCContext &) = delete;
MCContext &operator=(const MCContext &) = delete;
~MCContext(); ~MCContext();
const SourceMgr *getSourceManager() const { return SrcMgr; } const SourceMgr *getSourceManager() const { return SrcMgr; }
@ -456,6 +463,7 @@ namespace llvm {
const SmallVectorImpl<MCDwarfFile> &getMCDwarfFiles(unsigned CUID = 0) { const SmallVectorImpl<MCDwarfFile> &getMCDwarfFiles(unsigned CUID = 0) {
return getMCDwarfLineTable(CUID).getMCDwarfFiles(); return getMCDwarfLineTable(CUID).getMCDwarfFiles();
} }
const SmallVectorImpl<std::string> &getMCDwarfDirs(unsigned CUID = 0) { const SmallVectorImpl<std::string> &getMCDwarfDirs(unsigned CUID = 0) {
return getMCDwarfLineTable(CUID).getMCDwarfDirs(); return getMCDwarfLineTable(CUID).getMCDwarfDirs();
} }
@ -466,10 +474,13 @@ namespace llvm {
return true; return true;
return false; return false;
} }
unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; } unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
void setDwarfCompileUnitID(unsigned CUIndex) { void setDwarfCompileUnitID(unsigned CUIndex) {
DwarfCompileUnitID = CUIndex; DwarfCompileUnitID = CUIndex;
} }
void setMCLineTableCompilationDir(unsigned CUID, StringRef CompilationDir) { void setMCLineTableCompilationDir(unsigned CUID, StringRef CompilationDir) {
getMCDwarfLineTable(CUID).setCompilationDir(CompilationDir); getMCDwarfLineTable(CUID).setCompilationDir(CompilationDir);
} }
@ -489,6 +500,7 @@ namespace llvm {
CurrentDwarfLoc.setDiscriminator(Discriminator); CurrentDwarfLoc.setDiscriminator(Discriminator);
DwarfLocSeen = true; DwarfLocSeen = true;
} }
void clearDwarfLocSeen() { DwarfLocSeen = false; } void clearDwarfLocSeen() { DwarfLocSeen = false; }
bool getDwarfLocSeen() { return DwarfLocSeen; } bool getDwarfLocSeen() { return DwarfLocSeen; }
@ -497,20 +509,25 @@ namespace llvm {
bool getGenDwarfForAssembly() { return GenDwarfForAssembly; } bool getGenDwarfForAssembly() { return GenDwarfForAssembly; }
void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; } void setGenDwarfForAssembly(bool Value) { GenDwarfForAssembly = Value; }
unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; } unsigned getGenDwarfFileNumber() { return GenDwarfFileNumber; }
void setGenDwarfFileNumber(unsigned FileNumber) { void setGenDwarfFileNumber(unsigned FileNumber) {
GenDwarfFileNumber = FileNumber; GenDwarfFileNumber = FileNumber;
} }
const SetVector<MCSection *> &getGenDwarfSectionSyms() { const SetVector<MCSection *> &getGenDwarfSectionSyms() {
return SectionsForRanges; return SectionsForRanges;
} }
bool addGenDwarfSection(MCSection *Sec) { bool addGenDwarfSection(MCSection *Sec) {
return SectionsForRanges.insert(Sec); return SectionsForRanges.insert(Sec);
} }
void finalizeDwarfSections(MCStreamer &MCOS); void finalizeDwarfSections(MCStreamer &MCOS);
const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const { const std::vector<MCGenDwarfLabelEntry> &getMCGenDwarfLabelEntries() const {
return MCGenDwarfLabelEntries; return MCGenDwarfLabelEntries;
} }
void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E) { void addMCGenDwarfLabelEntry(const MCGenDwarfLabelEntry &E) {
MCGenDwarfLabelEntries.push_back(E); MCGenDwarfLabelEntries.push_back(E);
} }
@ -520,10 +537,12 @@ namespace llvm {
void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; } void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; }
StringRef getDwarfDebugProducer() { return DwarfDebugProducer; } StringRef getDwarfDebugProducer() { return DwarfDebugProducer; }
dwarf::DwarfFormat getDwarfFormat() const { dwarf::DwarfFormat getDwarfFormat() const {
// TODO: Support DWARF64 // TODO: Support DWARF64
return dwarf::DWARF32; return dwarf::DWARF32;
} }
void setDwarfVersion(uint16_t v) { DwarfVersion = v; } void setDwarfVersion(uint16_t v) { DwarfVersion = v; }
uint16_t getDwarfVersion() const { return DwarfVersion; } uint16_t getDwarfVersion() const { return DwarfVersion; }
@ -531,15 +550,18 @@ namespace llvm {
char *getSecureLogFile() { return SecureLogFile; } char *getSecureLogFile() { return SecureLogFile; }
raw_fd_ostream *getSecureLog() { return SecureLog.get(); } raw_fd_ostream *getSecureLog() { return SecureLog.get(); }
bool getSecureLogUsed() { return SecureLogUsed; }
void setSecureLog(std::unique_ptr<raw_fd_ostream> Value) { void setSecureLog(std::unique_ptr<raw_fd_ostream> Value) {
SecureLog = std::move(Value); SecureLog = std::move(Value);
} }
bool getSecureLogUsed() { return SecureLogUsed; }
void setSecureLogUsed(bool Value) { SecureLogUsed = Value; } void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
void *allocate(unsigned Size, unsigned Align = 8) { void *allocate(unsigned Size, unsigned Align = 8) {
return Allocator.Allocate(Size, Align); return Allocator.Allocate(Size, Align);
} }
void deallocate(void *Ptr) {} void deallocate(void *Ptr) {}
bool hadError() { return HadError; } bool hadError() { return HadError; }
@ -625,4 +647,4 @@ inline void operator delete[](void *Ptr, llvm::MCContext &C) noexcept {
C.deallocate(Ptr); C.deallocate(Ptr);
} }
#endif #endif // LLVM_MC_MCCONTEXT_H

View File

@ -16,24 +16,27 @@
#define LLVM_MC_MCDWARF_H #define LLVM_MC_MCDWARF_H
#include "llvm/ADT/MapVector.h" #include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSection.h" #include "llvm/MC/MCSection.h"
#include "llvm/Support/Dwarf.h" #include <cassert>
#include <cstdint>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
namespace llvm { namespace llvm {
template <typename T> class ArrayRef; template <typename T> class ArrayRef;
class raw_ostream;
class MCAsmBackend; class MCAsmBackend;
class MCContext; class MCContext;
class MCObjectStreamer; class MCObjectStreamer;
class MCStreamer; class MCStreamer;
class MCSymbol; class MCSymbol;
class SourceMgr; class raw_ostream;
class SMLoc; class SMLoc;
class SourceMgr;
/// \brief Instances of this class represent the name of the dwarf /// \brief Instances of this class represent the name of the dwarf
/// .file directive and its associated dwarf file number in the MC file, /// .file directive and its associated dwarf file number in the MC file,
@ -71,6 +74,7 @@ class MCDwarfLoc {
private: // MCContext manages these private: // MCContext manages these
friend class MCContext; friend class MCContext;
friend class MCDwarfLineEntry; friend class MCDwarfLineEntry;
MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags, MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
unsigned isa, unsigned discriminator) unsigned isa, unsigned discriminator)
: FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa), : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa),
@ -194,13 +198,14 @@ struct MCDwarfLineTableParams {
}; };
struct MCDwarfLineTableHeader { struct MCDwarfLineTableHeader {
MCSymbol *Label; MCSymbol *Label = nullptr;
SmallVector<std::string, 3> MCDwarfDirs; SmallVector<std::string, 3> MCDwarfDirs;
SmallVector<MCDwarfFile, 3> MCDwarfFiles; SmallVector<MCDwarfFile, 3> MCDwarfFiles;
StringMap<unsigned> SourceIdMap; StringMap<unsigned> SourceIdMap;
StringRef CompilationDir; StringRef CompilationDir;
MCDwarfLineTableHeader() : Label(nullptr) {} MCDwarfLineTableHeader() = default;
unsigned getFile(StringRef &Directory, StringRef &FileName, unsigned getFile(StringRef &Directory, StringRef &FileName,
unsigned FileNumber = 0); unsigned FileNumber = 0);
std::pair<MCSymbol *, MCSymbol *> Emit(MCStreamer *MCOS, std::pair<MCSymbol *, MCSymbol *> Emit(MCStreamer *MCOS,
@ -212,13 +217,16 @@ struct MCDwarfLineTableHeader {
class MCDwarfDwoLineTable { class MCDwarfDwoLineTable {
MCDwarfLineTableHeader Header; MCDwarfLineTableHeader Header;
public: public:
void setCompilationDir(StringRef CompilationDir) { void setCompilationDir(StringRef CompilationDir) {
Header.CompilationDir = CompilationDir; Header.CompilationDir = CompilationDir;
} }
unsigned getFile(StringRef Directory, StringRef FileName) { unsigned getFile(StringRef Directory, StringRef FileName) {
return Header.getFile(Directory, FileName); return Header.getFile(Directory, FileName);
} }
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const; void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const;
}; };
@ -488,22 +496,19 @@ public:
}; };
struct MCDwarfFrameInfo { struct MCDwarfFrameInfo {
MCDwarfFrameInfo() MCDwarfFrameInfo() = default;
: Begin(nullptr), End(nullptr), Personality(nullptr), Lsda(nullptr),
Instructions(), CurrentCfaRegister(0), PersonalityEncoding(), MCSymbol *Begin = nullptr;
LsdaEncoding(0), CompactUnwindEncoding(0), IsSignalFrame(false), MCSymbol *End = nullptr;
IsSimple(false) {} const MCSymbol *Personality = nullptr;
MCSymbol *Begin; const MCSymbol *Lsda = nullptr;
MCSymbol *End;
const MCSymbol *Personality;
const MCSymbol *Lsda;
std::vector<MCCFIInstruction> Instructions; std::vector<MCCFIInstruction> Instructions;
unsigned CurrentCfaRegister; unsigned CurrentCfaRegister = 0;
unsigned PersonalityEncoding; unsigned PersonalityEncoding;
unsigned LsdaEncoding; unsigned LsdaEncoding = 0;
uint32_t CompactUnwindEncoding; uint32_t CompactUnwindEncoding = 0;
bool IsSignalFrame; bool IsSignalFrame = false;
bool IsSimple; bool IsSimple = false;
}; };
class MCDwarfFrameEmitter { class MCDwarfFrameEmitter {
@ -516,6 +521,7 @@ public:
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
raw_ostream &OS); raw_ostream &OS);
}; };
} // end namespace llvm } // end namespace llvm
#endif #endif // LLVM_MC_MCDWARF_H

View File

@ -14,12 +14,10 @@
#ifndef LLVM_MC_MCSECTIONELF_H #ifndef LLVM_MC_MCSECTIONELF_H
#define LLVM_MC_MCSECTIONELF_H #define LLVM_MC_MCSECTIONELF_H
#include "llvm/ADT/Twine.h" #include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSection.h" #include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Debug.h" #include "llvm/MC/SectionKind.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm { namespace llvm {
@ -52,6 +50,7 @@ class MCSectionELF final : public MCSection {
private: private:
friend class MCContext; friend class MCContext;
MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K, MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K,
unsigned entrySize, const MCSymbolELF *group, unsigned UniqueID, unsigned entrySize, const MCSymbolELF *group, unsigned UniqueID,
MCSymbol *Begin, const MCSectionELF *Associated) MCSymbol *Begin, const MCSectionELF *Associated)
@ -96,4 +95,4 @@ public:
} // end namespace llvm } // end namespace llvm
#endif #endif // LLVM_MC_MCSECTIONELF_H

View File

@ -11,48 +11,100 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/CodeGen/AsmPrinter.h" #include "AsmPrinterHandler.h"
#include "CodeViewDebug.h" #include "CodeViewDebug.h"
#include "DwarfDebug.h" #include "DwarfDebug.h"
#include "DwarfException.h" #include "DwarfException.h"
#include "WinException.h" #include "WinException.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
#include "llvm/CodeGen/Analysis.h" #include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCMetadataPrinter.h" #include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/GCStrategy.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundle.h" #include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalIFunc.h"
#include "llvm/IR/GlobalIndirectSymbol.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Mangler.h" #include "llvm/IR/Mangler.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h" #include "llvm/IR/Operator.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSection.h" #include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/MCValue.h" #include "llvm/MC/MCValue.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Timer.h" #include "llvm/Support/Timer.h"
#include "llvm/Target/TargetFrameLowering.h" #include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/Target/TargetSubtargetInfo.h"
#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cstdint>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "asm-printer" #define DEBUG_TYPE "asm-printer"
@ -78,7 +130,6 @@ static gcp_map_type &getGCMap(void *&P) {
return *(gcp_map_type*)P; return *(gcp_map_type*)P;
} }
/// getGVAlignmentLog2 - Return the alignment to use for the specified global /// getGVAlignmentLog2 - Return the alignment to use for the specified global
/// value in log2 form. This rounds up to the preferred alignment if possible /// value in log2 form. This rounds up to the preferred alignment if possible
/// and legal. /// and legal.
@ -107,16 +158,7 @@ static unsigned getGVAlignmentLog2(const GlobalValue *GV, const DataLayout &DL,
AsmPrinter::AsmPrinter(TargetMachine &tm, std::unique_ptr<MCStreamer> Streamer) AsmPrinter::AsmPrinter(TargetMachine &tm, std::unique_ptr<MCStreamer> Streamer)
: MachineFunctionPass(ID), TM(tm), MAI(tm.getMCAsmInfo()), : MachineFunctionPass(ID), TM(tm), MAI(tm.getMCAsmInfo()),
OutContext(Streamer->getContext()), OutStreamer(std::move(Streamer)), OutContext(Streamer->getContext()), OutStreamer(std::move(Streamer)) {
isCFIMoveForDebugging(false), LastMI(nullptr), LastFn(0), Counter(~0U) {
DD = nullptr;
MMI = nullptr;
LI = nullptr;
MF = nullptr;
CurExceptionSym = CurrentFnSym = CurrentFnSymForSize = nullptr;
CurrentFnBegin = nullptr;
CurrentFnEnd = nullptr;
GCMetadataPrinters = nullptr;
VerboseAsm = OutStreamer->isVerboseAsm(); VerboseAsm = OutStreamer->isVerboseAsm();
} }
@ -1238,7 +1280,7 @@ bool AsmPrinter::doFinalization(Module &M) {
break; break;
AliasStack.push_back(Cur); AliasStack.push_back(Cur);
} }
for (const GlobalAlias *AncestorAlias : reverse(AliasStack)) for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
emitGlobalIndirectSymbol(M, *AncestorAlias); emitGlobalIndirectSymbol(M, *AncestorAlias);
AliasStack.clear(); AliasStack.clear();
} }
@ -1316,14 +1358,17 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
} }
namespace { namespace {
// Keep track the alignment, constpool entries per Section. // Keep track the alignment, constpool entries per Section.
struct SectionCPs { struct SectionCPs {
MCSection *S; MCSection *S;
unsigned Alignment; unsigned Alignment;
SmallVector<unsigned, 4> CPEs; SmallVector<unsigned, 4> CPEs;
SectionCPs(MCSection *s, unsigned a) : S(s), Alignment(a) {} SectionCPs(MCSection *s, unsigned a) : S(s), Alignment(a) {}
}; };
}
} // end anonymous namespace
/// EmitConstantPool - Print to the current output stream assembly /// EmitConstantPool - Print to the current output stream assembly
/// representations of the constants in the constant pool MCP. This is /// representations of the constants in the constant pool MCP. This is
@ -1547,7 +1592,6 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
OutStreamer->EmitValue(Value, EntrySize); OutStreamer->EmitValue(Value, EntrySize);
} }
/// EmitSpecialLLVMGlobal - Check to see if the specified global is a /// EmitSpecialLLVMGlobal - Check to see if the specified global is a
/// special global used by LLVM. If so, emit it and return true, otherwise /// special global used by LLVM. If so, emit it and return true, otherwise
/// do nothing and return false. /// do nothing and return false.
@ -1598,13 +1642,16 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) {
} }
namespace { namespace {
struct Structor { struct Structor {
Structor() : Priority(0), Func(nullptr), ComdatKey(nullptr) {} int Priority = 0;
int Priority; Constant *Func = nullptr;
llvm::Constant *Func; GlobalValue *ComdatKey = nullptr;
llvm::GlobalValue *ComdatKey;
Structor() = default;
}; };
} // end namespace
} // end anonymous namespace
/// EmitXXStructorList - Emit the ctor or dtor list taking into account the init /// EmitXXStructorList - Emit the ctor or dtor list taking into account the init
/// priority. /// priority.
@ -1934,7 +1981,6 @@ static int isRepeatedByteSequence(const ConstantDataSequential *V) {
return static_cast<uint8_t>(C); // Ensure 255 is not returned as -1. return static_cast<uint8_t>(C); // Ensure 255 is not returned as -1.
} }
/// isRepeatedByteSequence - Determine whether the given value is /// isRepeatedByteSequence - Determine whether the given value is
/// composed of a repeated sequence of identical bytes and return the /// composed of a repeated sequence of identical bytes and return the
/// byte value. If it is not a repeated sequence, return -1. /// byte value. If it is not a repeated sequence, return -1.
@ -1975,7 +2021,6 @@ static int isRepeatedByteSequence(const Value *V, const DataLayout &DL) {
static void emitGlobalConstantDataSequential(const DataLayout &DL, static void emitGlobalConstantDataSequential(const DataLayout &DL,
const ConstantDataSequential *CDS, const ConstantDataSequential *CDS,
AsmPrinter &AP) { AsmPrinter &AP) {
// See if we can aggregate this into a .fill, if so, emit it as such. // See if we can aggregate this into a .fill, if so, emit it as such.
int Value = isRepeatedByteSequence(CDS, DL); int Value = isRepeatedByteSequence(CDS, DL);
if (Value != -1) { if (Value != -1) {
@ -2009,7 +2054,6 @@ static void emitGlobalConstantDataSequential(const DataLayout &DL,
CDS->getNumElements(); CDS->getNumElements();
if (unsigned Padding = Size - EmittedSize) if (unsigned Padding = Size - EmittedSize)
AP.OutStreamer->EmitZeros(Padding); AP.OutStreamer->EmitZeros(Padding);
} }
static void emitGlobalConstantArray(const DataLayout &DL, static void emitGlobalConstantArray(const DataLayout &DL,
@ -2423,8 +2467,6 @@ MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
return OutContext.getOrCreateSymbol(NameStr); return OutContext.getOrCreateSymbol(NameStr);
} }
/// PrintParentLoopComment - Print comments about parent loops of this one. /// PrintParentLoopComment - Print comments about parent loops of this one.
static void PrintParentLoopComment(raw_ostream &OS, const MachineLoop *Loop, static void PrintParentLoopComment(raw_ostream &OS, const MachineLoop *Loop,
unsigned FunctionNumber) { unsigned FunctionNumber) {
@ -2489,7 +2531,6 @@ static void emitBasicBlockLoopComments(const MachineBasicBlock &MBB,
PrintChildLoopComment(OS, Loop, AP.getFunctionNumber()); PrintChildLoopComment(OS, Loop, AP.getFunctionNumber());
} }
/// EmitBasicBlockStart - This method prints the label for the specified /// EmitBasicBlockStart - This method prints the label for the specified
/// MachineBasicBlock, an alignment (if present) and a comment describing /// MachineBasicBlock, an alignment (if present) and a comment describing
/// it if appropriate. /// it if appropriate.
@ -2610,8 +2651,6 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const {
return true; return true;
} }
GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy &S) { GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy &S) {
if (!S.usesMetadata()) if (!S.usesMetadata())
return nullptr; return nullptr;
@ -2642,7 +2681,7 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy &S) {
} }
/// Pin vtable to this file. /// Pin vtable to this file.
AsmPrinterHandler::~AsmPrinterHandler() {} AsmPrinterHandler::~AsmPrinterHandler() = default;
void AsmPrinterHandler::markFunctionEnd() {} void AsmPrinterHandler::markFunctionEnd() {}

View File

@ -1,4 +1,4 @@
//===-- ErlangGCPrinter.cpp - Erlang/OTP frametable emitter -----*- C++ -*-===// //===- ErlangGCPrinter.cpp - Erlang/OTP frametable emitter ----------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -14,21 +14,19 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCMetadataPrinter.h" #include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/GCStrategy.h"
#include "llvm/CodeGen/GCs.h" #include "llvm/CodeGen/GCs.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h" #include "llvm/IR/Module.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Support/ELF.h"
#include "llvm/Target/TargetSubtargetInfo.h"
using namespace llvm; using namespace llvm;
@ -38,13 +36,12 @@ class ErlangGCPrinter : public GCMetadataPrinter {
public: public:
void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) override; void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) override;
}; };
}
} // end anonymous namespace
static GCMetadataPrinterRegistry::Add<ErlangGCPrinter> static GCMetadataPrinterRegistry::Add<ErlangGCPrinter>
X("erlang", "erlang-compatible garbage collector"); X("erlang", "erlang-compatible garbage collector");
void llvm::linkErlangGCPrinter() {}
void ErlangGCPrinter::finishAssembly(Module &M, GCModuleInfo &Info, void ErlangGCPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) { AsmPrinter &AP) {
MCStreamer &OS = *AP.OutStreamer; MCStreamer &OS = *AP.OutStreamer;
@ -121,3 +118,5 @@ void ErlangGCPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
} }
} }
} }
void llvm::linkErlangGCPrinter() {}

View File

@ -7,30 +7,41 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/MC/MCContext.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeView.h" #include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h" #include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFragment.h"
#include "llvm/MC/MCLabel.h" #include "llvm/MC/MCLabel.h"
#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolCOFF.h" #include "llvm/MC/MCSymbolCOFF.h"
#include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCSymbolMachO.h" #include "llvm/MC/MCSymbolMachO.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/COFF.h" #include "llvm/Support/COFF.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h" #include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h" #include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include <cassert>
#include <cstdlib>
#include <tuple>
#include <utility>
using namespace llvm; using namespace llvm;
@ -40,19 +51,13 @@ AsSecureLogFileName("as-secure-log-file-name",
"AS_SECURE_LOG_FILE env variable)"), "AS_SECURE_LOG_FILE env variable)"),
cl::init(getenv("AS_SECURE_LOG_FILE")), cl::Hidden); cl::init(getenv("AS_SECURE_LOG_FILE")), cl::Hidden);
MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri, MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
const MCObjectFileInfo *mofi, const SourceMgr *mgr, const MCObjectFileInfo *mofi, const SourceMgr *mgr,
bool DoAutoReset) bool DoAutoReset)
: SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Allocator(), : SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Symbols(Allocator),
Symbols(Allocator), UsedNames(Allocator), UsedNames(Allocator), CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0),
CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0), DwarfLocSeen(false), AutoReset(DoAutoReset) {
GenDwarfForAssembly(false), GenDwarfFileNumber(0), DwarfVersion(4),
AllowTemporaryLabels(true), DwarfCompileUnitID(0),
AutoReset(DoAutoReset), HadError(false) {
SecureLogFile = AsSecureLogFileName; SecureLogFile = AsSecureLogFileName;
SecureLog = nullptr;
SecureLogUsed = false;
if (SrcMgr && SrcMgr->getNumBuffers()) if (SrcMgr && SrcMgr->getNumBuffers())
MainFileName = MainFileName =
@ -169,7 +174,7 @@ MCSymbol *MCContext::createSymbol(StringRef Name, bool AlwaysAddSuffix,
SmallString<128> NewName = Name; SmallString<128> NewName = Name;
bool AddSuffix = AlwaysAddSuffix; bool AddSuffix = AlwaysAddSuffix;
unsigned &NextUniqueID = NextID[Name]; unsigned &NextUniqueID = NextID[Name];
for (;;) { while (true) {
if (AddSuffix) { if (AddSuffix) {
NewName.resize(Name.size()); NewName.resize(Name.size());
raw_svector_ostream(NewName) << NextUniqueID++; raw_svector_ostream(NewName) << NextUniqueID++;
@ -262,7 +267,6 @@ MCSectionMachO *MCContext::getMachOSection(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes, unsigned TypeAndAttributes,
unsigned Reserved2, SectionKind Kind, unsigned Reserved2, SectionKind Kind,
const char *BeginSymName) { const char *BeginSymName) {
// We unique sections by their segment/section pair. The returned section // We unique sections by their segment/section pair. The returned section
// may not have the same flags as the requested section, if so this should be // may not have the same flags as the requested section, if so this should be
// diagnosed by the client as an error. // diagnosed by the client as an error.
@ -309,7 +313,6 @@ MCSectionELF *MCContext::createELFSectionImpl(StringRef Section, unsigned Type,
const MCSymbolELF *Group, const MCSymbolELF *Group,
unsigned UniqueID, unsigned UniqueID,
const MCSectionELF *Associated) { const MCSectionELF *Associated) {
MCSymbolELF *R; MCSymbolELF *R;
MCSymbol *&Sym = Symbols[Section]; MCSymbol *&Sym = Symbols[Section];
if (Sym && Sym->isUndefined()) { if (Sym && Sym->isUndefined()) {

View File

@ -7,27 +7,41 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/MC/MCDwarf.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h" #include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/None.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h" #include "llvm/Config/config.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSection.h" #include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Casting.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h" #include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h" #include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
using namespace llvm; using namespace llvm;
@ -592,7 +606,6 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
// And the pair of terminating zeros. // And the pair of terminating zeros.
Length += 2 * AddrSize; Length += 2 * AddrSize;
// Emit the header for this section. // Emit the header for this section.
// The 4 byte length not including the 4 byte value for the length. // The 4 byte length not including the 4 byte value for the length.
MCOS->EmitIntValue(Length - 4, 4); MCOS->EmitIntValue(Length - 4, 4);
@ -885,7 +898,7 @@ void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
} }
} }
assert((RangesSectionSymbol != NULL) || !UseRangesSection); assert((RangesSectionSymbol != nullptr) || !UseRangesSection);
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection()); MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfARangesSection());
@ -1003,6 +1016,7 @@ static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
} }
namespace { namespace {
class FrameEmitterImpl { class FrameEmitterImpl {
int CFAOffset = 0; int CFAOffset = 0;
int InitialCFAOffset = 0; int InitialCFAOffset = 0;
@ -1050,10 +1064,10 @@ void FrameEmitterImpl::EmitCFIInstruction(const MCCFIInstruction &Instr) {
Streamer.EmitULEB128IntValue(Reg2); Streamer.EmitULEB128IntValue(Reg2);
return; return;
} }
case MCCFIInstruction::OpWindowSave: { case MCCFIInstruction::OpWindowSave:
Streamer.EmitIntValue(dwarf::DW_CFA_GNU_window_save, 1); Streamer.EmitIntValue(dwarf::DW_CFA_GNU_window_save, 1);
return; return;
}
case MCCFIInstruction::OpUndefined: { case MCCFIInstruction::OpUndefined: {
unsigned Reg = Instr.getRegister(); unsigned Reg = Instr.getRegister();
Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1); Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1);
@ -1087,7 +1101,6 @@ void FrameEmitterImpl::EmitCFIInstruction(const MCCFIInstruction &Instr) {
return; return;
} }
case MCCFIInstruction::OpDefCfaRegister: { case MCCFIInstruction::OpDefCfaRegister: {
unsigned Reg = Instr.getRegister(); unsigned Reg = Instr.getRegister();
if (!IsEH) if (!IsEH)
@ -1097,7 +1110,6 @@ void FrameEmitterImpl::EmitCFIInstruction(const MCCFIInstruction &Instr) {
return; return;
} }
case MCCFIInstruction::OpOffset: case MCCFIInstruction::OpOffset:
case MCCFIInstruction::OpRelOffset: { case MCCFIInstruction::OpRelOffset: {
const bool IsRelative = const bool IsRelative =
@ -1145,11 +1157,11 @@ void FrameEmitterImpl::EmitCFIInstruction(const MCCFIInstruction &Instr) {
Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1); Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1);
return; return;
} }
case MCCFIInstruction::OpGnuArgsSize: { case MCCFIInstruction::OpGnuArgsSize:
Streamer.EmitIntValue(dwarf::DW_CFA_GNU_args_size, 1); Streamer.EmitIntValue(dwarf::DW_CFA_GNU_args_size, 1);
Streamer.EmitULEB128IntValue(Instr.getOffset()); Streamer.EmitULEB128IntValue(Instr.getOffset());
return; return;
}
case MCCFIInstruction::OpEscape: case MCCFIInstruction::OpEscape:
Streamer.EmitBytes(Instr.getValues()); Streamer.EmitBytes(Instr.getValues());
return; return;
@ -1444,10 +1456,12 @@ void FrameEmitterImpl::EmitFDE(const MCSymbol &cieStart,
} }
namespace { namespace {
struct CIEKey { struct CIEKey {
static const CIEKey getEmptyKey() { static const CIEKey getEmptyKey() {
return CIEKey(nullptr, 0, -1, false, false); return CIEKey(nullptr, 0, -1, false, false);
} }
static const CIEKey getTombstoneKey() { static const CIEKey getTombstoneKey() {
return CIEKey(nullptr, -1, 0, false, false); return CIEKey(nullptr, -1, 0, false, false);
} }
@ -1457,23 +1471,28 @@ struct CIEKey {
: Personality(Personality), PersonalityEncoding(PersonalityEncoding), : Personality(Personality), PersonalityEncoding(PersonalityEncoding),
LsdaEncoding(LsdaEncoding), IsSignalFrame(IsSignalFrame), LsdaEncoding(LsdaEncoding), IsSignalFrame(IsSignalFrame),
IsSimple(IsSimple) {} IsSimple(IsSimple) {}
const MCSymbol *Personality; const MCSymbol *Personality;
unsigned PersonalityEncoding; unsigned PersonalityEncoding;
unsigned LsdaEncoding; unsigned LsdaEncoding;
bool IsSignalFrame; bool IsSignalFrame;
bool IsSimple; bool IsSimple;
}; };
} // anonymous namespace
} // end anonymous namespace
namespace llvm { namespace llvm {
template <> struct DenseMapInfo<CIEKey> { template <> struct DenseMapInfo<CIEKey> {
static CIEKey getEmptyKey() { return CIEKey::getEmptyKey(); } static CIEKey getEmptyKey() { return CIEKey::getEmptyKey(); }
static CIEKey getTombstoneKey() { return CIEKey::getTombstoneKey(); } static CIEKey getTombstoneKey() { return CIEKey::getTombstoneKey(); }
static unsigned getHashValue(const CIEKey &Key) { static unsigned getHashValue(const CIEKey &Key) {
return static_cast<unsigned>( return static_cast<unsigned>(
hash_combine(Key.Personality, Key.PersonalityEncoding, Key.LsdaEncoding, hash_combine(Key.Personality, Key.PersonalityEncoding, Key.LsdaEncoding,
Key.IsSignalFrame, Key.IsSimple)); Key.IsSignalFrame, Key.IsSimple));
} }
static bool isEqual(const CIEKey &LHS, const CIEKey &RHS) { static bool isEqual(const CIEKey &LHS, const CIEKey &RHS) {
return LHS.Personality == RHS.Personality && return LHS.Personality == RHS.Personality &&
LHS.PersonalityEncoding == RHS.PersonalityEncoding && LHS.PersonalityEncoding == RHS.PersonalityEncoding &&
@ -1482,7 +1501,8 @@ template <> struct DenseMapInfo<CIEKey> {
LHS.IsSimple == RHS.IsSimple; LHS.IsSimple == RHS.IsSimple;
} }
}; };
} // namespace llvm
} // end namespace llvm
void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB, void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
bool IsEH) { bool IsEH) {

View File

@ -17,6 +17,7 @@
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionMachO.h"
#include "llvm/Support/COFF.h" #include "llvm/Support/COFF.h"
#include "llvm/Support/ELF.h"
using namespace llvm; using namespace llvm;

View File

@ -7,23 +7,22 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/MC/MCSectionELF.h" #include "llvm/ADT/Triple.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/ELF.h" #include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <cassert>
using namespace llvm; using namespace llvm;
MCSectionELF::~MCSectionELF() {} // anchor. MCSectionELF::~MCSectionELF() = default; // anchor.
// Decides whether a '.section' directive // Decides whether a '.section' directive
// should be printed before the section name. // should be printed before the section name.
bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name, bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
const MCAsmInfo &MAI) const { const MCAsmInfo &MAI) const {
if (isUnique()) if (isUnique())
return false; return false;
@ -56,7 +55,6 @@ static void printName(raw_ostream &OS, StringRef Name) {
void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS, raw_ostream &OS,
const MCExpr *Subsection) const { const MCExpr *Subsection) const {
if (ShouldOmitSectionDirective(SectionName, MAI)) { if (ShouldOmitSectionDirective(SectionName, MAI)) {
OS << '\t' << getSectionName(); OS << '\t' << getSectionName();
if (Subsection) { if (Subsection) {

View File

@ -1,4 +1,4 @@
//===-- AMDGPUBaseInfo.cpp - AMDGPU Base encoding information--------------===// //===- AMDGPUBaseInfo.cpp - AMDGPU Base encoding information --------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -6,20 +6,34 @@
// License. See LICENSE.TXT for details. // License. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AMDGPUBaseInfo.h"
#include "AMDGPU.h" #include "AMDGPU.h"
#include "AMDGPUBaseInfo.h"
#include "SIDefines.h" #include "SIDefines.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h" #include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/MC/MCContext.h" #include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <utility>
#define GET_SUBTARGETINFO_ENUM #define GET_SUBTARGETINFO_ENUM
#include "AMDGPUGenSubtargetInfo.inc" #include "AMDGPUGenSubtargetInfo.inc"
@ -76,7 +90,7 @@ unsigned getLgkmcntBitShift() { return 8; }
/// \returns Lgkmcnt bit width. /// \returns Lgkmcnt bit width.
unsigned getLgkmcntBitWidth() { return 4; } unsigned getLgkmcntBitWidth() { return 4; }
} // namespace anonymous } // end namespace anonymous
namespace llvm { namespace llvm {
namespace AMDGPU { namespace AMDGPU {
@ -268,7 +282,7 @@ unsigned getMaxNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU) {
return std::min(MaxNumVGPRs, AddressableNumVGPRs); return std::min(MaxNumVGPRs, AddressableNumVGPRs);
} }
} // namespace IsaInfo } // end namespace IsaInfo
void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header,
const FeatureBitset &Features) { const FeatureBitset &Features) {
@ -371,7 +385,7 @@ std::pair<int, int> getIntegerPairAttribute(const Function &F,
return Default; return Default;
} }
if (Strs.second.trim().getAsInteger(0, Ints.second)) { if (Strs.second.trim().getAsInteger(0, Ints.second)) {
if (!OnlyFirstRequired || Strs.second.trim().size()) { if (!OnlyFirstRequired || !Strs.second.trim().empty()) {
Ctx.emitError("can't parse second integer attribute " + Name); Ctx.emitError("can't parse second integer attribute " + Name);
return Default; return Default;
} }
@ -655,5 +669,5 @@ bool isLegalSMRDImmOffset(const MCSubtargetInfo &ST, int64_t ByteOffset) {
isUInt<20>(EncodedOffset); isUInt<20>(EncodedOffset);
} }
} // End namespace AMDGPU } // end namespace AMDGPU
} // End namespace llvm } // end namespace llvm

View File

@ -1,4 +1,4 @@
//===-- AMDGPUBaseInfo.h - Top level definitions for AMDGPU -----*- C++ -*-===// //===- AMDGPUBaseInfo.h - Top level definitions for AMDGPU ------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -11,9 +11,14 @@
#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H #define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
#include "AMDKernelCodeT.h" #include "AMDKernelCodeT.h"
#include "llvm/IR/CallingConv.h"
#include "SIDefines.h" #include "SIDefines.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cstdint>
#include <utility>
#define GET_INSTRINFO_OPERAND_ENUM #define GET_INSTRINFO_OPERAND_ENUM
#include "AMDGPUGenInstrInfo.inc" #include "AMDGPUGenInstrInfo.inc"
@ -26,14 +31,13 @@ class Function;
class GlobalValue; class GlobalValue;
class MachineMemOperand; class MachineMemOperand;
class MCContext; class MCContext;
class MCInstrDesc;
class MCRegisterClass; class MCRegisterClass;
class MCRegisterInfo; class MCRegisterInfo;
class MCSection; class MCSection;
class MCSubtargetInfo; class MCSubtargetInfo;
class Triple;
namespace AMDGPU { namespace AMDGPU {
namespace IsaInfo { namespace IsaInfo {
enum { enum {
@ -141,7 +145,7 @@ unsigned getMinNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU);
/// execution unit requirement for given subtarget \p Features. /// execution unit requirement for given subtarget \p Features.
unsigned getMaxNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU); unsigned getMaxNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU);
} // namespace IsaInfo } // end namespace IsaInfo
LLVM_READONLY LLVM_READONLY
int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx); int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx);
@ -330,4 +334,4 @@ bool isLegalSMRDImmOffset(const MCSubtargetInfo &ST, int64_t ByteOffset);
} // end namespace AMDGPU } // end namespace AMDGPU
} // end namespace llvm } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H

View File

@ -1,4 +1,4 @@
//===-- MipsOptionRecord.cpp - Abstraction for storing information --------===// //===- MipsOptionRecord.cpp - Abstraction for storing information ---------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -7,10 +7,16 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MipsOptionRecord.h" #include "MipsABIInfo.h"
#include "MipsELFStreamer.h" #include "MipsELFStreamer.h"
#include "MipsOptionRecord.h"
#include "MipsTargetStreamer.h" #include "MipsTargetStreamer.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/ELF.h"
#include <cassert>
using namespace llvm; using namespace llvm;

View File

@ -1,4 +1,4 @@
//===-- SparcMCAsmInfo.cpp - Sparc asm properties -------------------------===// //===- SparcMCAsmInfo.cpp - Sparc asm properties --------------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -14,7 +14,10 @@
#include "SparcMCAsmInfo.h" #include "SparcMCAsmInfo.h"
#include "SparcMCExpr.h" #include "SparcMCExpr.h"
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Dwarf.h"
using namespace llvm; using namespace llvm;

View File

@ -1,4 +1,4 @@
//===-- SparcMCAsmInfo.h - Sparc asm properties ----------------*- C++ -*--===// //===- SparcMCAsmInfo.h - Sparc asm properties -----------------*- C++ -*--===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -17,6 +17,7 @@
#include "llvm/MC/MCAsmInfoELF.h" #include "llvm/MC/MCAsmInfoELF.h"
namespace llvm { namespace llvm {
class Triple; class Triple;
class SparcELFMCAsmInfo : public MCAsmInfoELF { class SparcELFMCAsmInfo : public MCAsmInfoELF {
@ -24,6 +25,7 @@ class SparcELFMCAsmInfo : public MCAsmInfoELF {
public: public:
explicit SparcELFMCAsmInfo(const Triple &TheTriple); explicit SparcELFMCAsmInfo(const Triple &TheTriple);
const MCExpr* const MCExpr*
getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding,
MCStreamer &Streamer) const override; MCStreamer &Streamer) const override;
@ -33,6 +35,6 @@ public:
}; };
} // namespace llvm } // end namespace llvm
#endif #endif // LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCASMINFO_H