X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FTarget%2FTargetAsmInfo.h;h=589c9a6efc9b052f04be92297cd9a6f1c5522dea;hb=fb2bbbe78674a34e5ec2ec6f8c566ac5cbb26154;hp=98247e8d8017da78e03038e6651fd4ce9bffe933;hpb=62d590cc8e8ce10351fa20b8cde77f511b8bdb74;p=oota-llvm.git diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index 98247e8d801..589c9a6efc9 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -16,6 +16,7 @@ #ifndef LLVM_TARGET_ASM_INFO_H #define LLVM_TARGET_ASM_INFO_H +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/DataTypes.h" #include @@ -40,11 +41,23 @@ namespace llvm { RODataMergeStr, ///< Readonly data section (mergeable strings) RODataMergeConst, ///< Readonly data section (mergeable constants) SmallData, ///< Small data section - SmallBSS, ///< Small bss section - SmallROData, ///< Small readonly section + SmallBSS, ///< Small bss section + SmallROData, ///< Small readonly section ThreadData, ///< Initialized TLS data objects ThreadBSS ///< Uninitialized TLS data objects }; + + static inline bool isReadOnly(Kind K) { + return (K == SectionKind::ROData || + K == SectionKind::RODataMergeConst || + K == SectionKind::RODataMergeStr || + K == SectionKind::SmallROData); + } + + static inline bool isBSS(Kind K) { + return (K == SectionKind::BSS || + K == SectionKind::SmallBSS); + } } namespace SectionFlags { @@ -58,6 +71,7 @@ namespace llvm { const unsigned TLS = 1 << 5; ///< Section contains thread-local data const unsigned Debug = 1 << 6; ///< Section contains debug data const unsigned Linkonce = 1 << 7; ///< Section is linkonce + const unsigned Small = 1 << 8; ///< Section is small const unsigned TypeFlags = 0xFF; // Some gap for future flags const unsigned Named = 1 << 23; ///< Section is named @@ -70,11 +84,23 @@ namespace llvm { static inline unsigned setEntitySize(unsigned Flags, unsigned Size) { return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24)); } + + struct KeyInfo { + static inline unsigned getEmptyKey() { return Invalid; } + static inline unsigned getTombstoneKey() { return Invalid - 1; } + static unsigned getHashValue(const unsigned &Key) { return Key; } + static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; } + static bool isPod() { return true; } + }; + + typedef DenseMap FlagsStringsMapType; } class TargetMachine; class CallInst; class GlobalValue; + class Type; + class Mangler; class Section { friend class TargetAsmInfo; @@ -95,6 +121,7 @@ namespace llvm { class TargetAsmInfo { private: mutable StringMap
Sections; + mutable SectionFlags::FlagsStringsMapType FlagsStrings; protected: //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. @@ -190,10 +217,15 @@ namespace llvm { const char *GlobalPrefix; // Defaults to "" /// PrivateGlobalPrefix - This prefix is used for globals like constant - /// pool entries that are completely private to the .o file and should not + /// pool entries that are completely private to the .s file and should not /// have names in the .o file. This is often "." or "L". const char *PrivateGlobalPrefix; // Defaults to "." + /// LessPrivateGlobalPrefix - This prefix is used for symbols that should + /// be passed through the assembler but be removed by the linker. This + /// is "l" on Darwin, currently used for some ObjC metadata. + const char *LessPrivateGlobalPrefix; // Defaults to "" + /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is /// emitted before jump tables with the specified prefix. const char *JumpTableSpecialLabelPrefix; // Default to null. @@ -494,9 +526,11 @@ namespace llvm { virtual ~TargetAsmInfo(); const Section* getNamedSection(const char *Name, - unsigned Flags = SectionFlags::None) const; + unsigned Flags = SectionFlags::None, + bool Override = false) const; const Section* getUnnamedSection(const char *Directive, - unsigned Flags = SectionFlags::None) const; + unsigned Flags = SectionFlags::None, + bool Override = false) const; /// Measure the specified inline asm to determine an approximation of its /// length. @@ -510,6 +544,13 @@ namespace llvm { return false; } + /// emitUsedDirectiveFor - This hook allows targets to selectively decide + /// not to emit the UsedDirective for some symbols in llvm.used. + virtual bool emitUsedDirectiveFor(const GlobalValue *GV, + Mangler *Mang) const { + return (GV!=0); + } + /// PreferredEHDataFormat - This hook allows the target to select data /// format used for encoding pointers in exception handling data. Reason is /// 0 for data, 1 for code labels, 2 for function pointers. Global is true @@ -537,10 +578,23 @@ namespace llvm { virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, SectionKind::Kind kind) const; - virtual std::string PrintSectionFlags(unsigned flags) const { return ""; } + const std::string& getSectionFlags(unsigned Flags) const; + virtual std::string printSectionFlags(unsigned flags) const { return ""; } virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; + virtual const Section* SelectSectionForMachineConst(const Type *Ty) const; + + /// getSLEB128Size - Compute the number of bytes required for a signed + /// leb128 value. + + static unsigned getSLEB128Size(int Value); + + /// getULEB128Size - Compute the number of bytes required for an unsigned + /// leb128 value. + + static unsigned getULEB128Size(unsigned Value); + // Accessors. // const char *getTextSection() const { @@ -612,6 +666,9 @@ namespace llvm { const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; } + const char *getLessPrivateGlobalPrefix() const { + return LessPrivateGlobalPrefix; + } const char *getJumpTableSpecialLabelPrefix() const { return JumpTableSpecialLabelPrefix; }