X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FTarget%2FTargetAsmInfo.h;h=50e08bda445c9118bcfe829fdb15337846c27157;hb=617dd7baa6dfd3a7b5ee72ace37f6b6aeaa6006b;hp=c93d189cc65629f4cfd30dcf30c484a1fbc56eb8;hpb=00181a33d87d0c7676547d979b2faa1c08c91732;p=oota-llvm.git diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index c93d189cc65..50e08bda445 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -36,8 +36,12 @@ namespace llvm { Unknown = 0, ///< Custom section Text, ///< Text section Data, ///< Data section + DataRel, ///< Contains data that has relocations + DataRelLocal, ///< Contains data that has only local relocations BSS, ///< BSS section ROData, ///< Readonly data section + DataRelRO, ///< Contains data that is otherwise readonly + DataRelROLocal, ///< Contains r/o data with only local relocations RODataMergeStr, ///< Readonly data section (mergeable strings) RODataMergeConst, ///< Readonly data section (mergeable constants) SmallData, ///< Small data section @@ -105,12 +109,14 @@ namespace llvm { class Section { friend class TargetAsmInfo; friend class StringMapEntry
; + friend class StringMap
; std::string Name; unsigned Flags; - explicit Section(unsigned F = SectionFlags::Invalid):Flags(F) { } + public: + bool isNamed() const { return Flags & SectionFlags::Named; } unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; } @@ -125,6 +131,9 @@ namespace llvm { mutable StringMap
Sections; mutable SectionFlags::FlagsStringsMapType FlagsStrings; protected: + /// TM - The current TargetMachine. + const TargetMachine &TM; + //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. // @@ -205,6 +214,10 @@ namespace llvm { /// measure inline asm instructions. char SeparatorChar; // Defaults to ';' + /// CommentColumn - This indicates the comment num (zero-based) at + /// which asm comments should be printed. + unsigned CommentColumn; // Defaults to 60 + /// CommentString - This indicates the comment character used by the /// assembler. const char *CommentString; // Defaults to "#" @@ -262,12 +275,10 @@ namespace llvm { /// AssemblerDialect - Which dialect of an assembler variant to use. unsigned AssemblerDialect; // Defaults to 0 - /// StringConstantPrefix - Prefix for FEs to use when generating unnamed - /// constant strings. These names get run through the Mangler later; if - /// you want the Mangler not to add the GlobalPrefix as well, - /// use '\1' as the first character. - const char *StringConstantPrefix; // Defaults to ".str" - + /// AllowQuotesInName - This is true if the assembler allows for complex + /// symbol names to be surrounded in quotes. This defaults to false. + bool AllowQuotesInName; + //===--- Data Emission Directives -------------------------------------===// /// ZeroDirective - this should be set to the directive used to get some @@ -294,6 +305,14 @@ namespace llvm { const char *Data32bitsDirective; // Defaults to "\t.long\t" const char *Data64bitsDirective; // Defaults to "\t.quad\t" + /// getASDirective - Targets can override it to provide different data + /// directives for various sizes and non-default address spaces. + virtual const char *getASDirective(unsigned size, + unsigned AS) const { + assert(AS > 0 && "Dont know the directives for default addr space"); + return NULL; + } + //===--- Alignment Information ----------------------------------------===// /// AlignDirective - The directive used to emit round up to an alignment @@ -365,6 +384,11 @@ namespace llvm { /// GlobalDirective - This is the directive used to declare a global entity. /// const char *GlobalDirective; // Defaults to NULL. + + /// ExternDirective - This is the directive used to declare external + /// globals. + /// + const char *ExternDirective; // Defaults to NULL. /// SetDirective - This is the name of a directive that can be used to tell /// the assembler to set the value of a variable to some expression. @@ -386,7 +410,11 @@ namespace llvm { /// HasDotTypeDotSizeDirective - True if the target has .type and .size /// directives, this is true for most ELF targets. bool HasDotTypeDotSizeDirective; // Defaults to true. - + + /// HasSingleParameterDotFile - True if the target has a single parameter + /// .file directive, this is true for ELF targets. + bool HasSingleParameterDotFile; // Defaults to true. + /// UsedDirective - This directive, if non-null, is used to declare a global /// as being used somehow that the assembler can't see. This prevents dead /// code elimination on some targets. @@ -421,25 +449,33 @@ namespace llvm { /// HasLEB128 - True if target asm supports leb128 directives. /// bool HasLEB128; // Defaults to false. - + /// hasDotLocAndDotFile - True if target asm supports .loc and .file /// directives for emitting debugging information. /// bool HasDotLocAndDotFile; // Defaults to false. - + /// SupportsDebugInformation - True if target supports emission of debugging /// information. bool SupportsDebugInformation; - + /// SupportsExceptionHandling - True if target supports /// exception handling. /// bool SupportsExceptionHandling; // Defaults to false. - + /// RequiresFrameSection - true if the Dwarf2 output needs a frame section /// bool DwarfRequiresFrameSection; // Defaults to true. + /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to + /// encode inline subroutine information. + bool DwarfUsesInlineInfoSection; // Defaults to false. + + /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it + /// doesn't show up in the symbol table of the object file. + bool Is_EHSymbolPrivate; // Defaults to true. + /// GlobalEHDirective - This is the directive used to make exception frame /// tables globally visible. /// @@ -475,7 +511,11 @@ namespace llvm { /// DwarfPubTypesSection - Section directive for Dwarf info. /// const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes". - + + /// DwarfDebugInlineSection - Section directive for inline info. + /// + const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined" + /// DwarfStrSection - Section directive for Dwarf info. /// const char *DwarfStrSection; // Defaults to ".debug_str". @@ -492,9 +532,9 @@ namespace llvm { /// const char *DwarfRangesSection; // Defaults to ".debug_ranges". - /// DwarfMacInfoSection - Section directive for Dwarf info. + /// DwarfMacroInfoSection - Section directive for DWARF macro info. /// - const char *DwarfMacInfoSection; // Defaults to ".debug_macinfo". + const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo". /// DwarfEHFrameSection - Section directive for Exception frames. /// @@ -509,7 +549,7 @@ namespace llvm { const char *const *AsmTransCBE; // Defaults to empty public: - TargetAsmInfo(); + explicit TargetAsmInfo(const TargetMachine &TM); virtual ~TargetAsmInfo(); const Section* getNamedSection(const char *Name, @@ -550,6 +590,12 @@ namespace llvm { virtual SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV) const; + /// RelocBehaviour - Describes how relocations should be treated when + /// selecting sections. Reloc::Global bit should be set if global + /// relocations should force object to be placed in read-write + /// sections. Reloc::Local bit should be set if local relocations should + /// force object to be placed in read-write sections. + virtual unsigned RelocBehaviour() const; /// SectionFlagsForGlobal - This hook allows the target to select proper /// section flags either for given global or for section. @@ -582,6 +628,22 @@ namespace llvm { static unsigned getULEB128Size(unsigned Value); + // Data directive accessors + // + const char *getData8bitsDirective(unsigned AS = 0) const { + return AS == 0 ? Data8bitsDirective : getASDirective(8, AS); + } + const char *getData16bitsDirective(unsigned AS = 0) const { + return AS == 0 ? Data16bitsDirective : getASDirective(16, AS); + } + const char *getData32bitsDirective(unsigned AS = 0) const { + return AS == 0 ? Data32bitsDirective : getASDirective(32, AS); + } + const char *getData64bitsDirective(unsigned AS = 0) const { + return AS == 0 ? Data64bitsDirective : getASDirective(64, AS); + } + + // Accessors. // const Section *getTextSection() const { @@ -629,6 +691,9 @@ namespace llvm { char getSeparatorChar() const { return SeparatorChar; } + unsigned getCommentColumn() const { + return CommentColumn; + } const char *getCommentString() const { return CommentString; } @@ -674,8 +739,8 @@ namespace llvm { unsigned getAssemblerDialect() const { return AssemblerDialect; } - const char *getStringConstantPrefix() const { - return StringConstantPrefix; + bool doesAllowQuotesInName() const { + return AllowQuotesInName; } const char *getZeroDirective() const { return ZeroDirective; @@ -689,18 +754,6 @@ namespace llvm { const char *getAscizDirective() const { return AscizDirective; } - const char *getData8bitsDirective() const { - return Data8bitsDirective; - } - const char *getData16bitsDirective() const { - return Data16bitsDirective; - } - const char *getData32bitsDirective() const { - return Data32bitsDirective; - } - const char *getData64bitsDirective() const { - return Data64bitsDirective; - } const char *getJumpTableDirective() const { return JumpTableDirective; } @@ -746,6 +799,9 @@ namespace llvm { const char *getGlobalDirective() const { return GlobalDirective; } + const char *getExternDirective() const { + return ExternDirective; + } const char *getSetDirective() const { return SetDirective; } @@ -761,6 +817,9 @@ namespace llvm { bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; } + bool hasSingleParameterDotFile() const { + return HasSingleParameterDotFile; + } const char *getUsedDirective() const { return UsedDirective; } @@ -797,6 +856,12 @@ namespace llvm { bool doesDwarfRequireFrameSection() const { return DwarfRequiresFrameSection; } + bool doesDwarfUsesInlineInfoSection() const { + return DwarfUsesInlineInfoSection; + } + bool is_EHSymbolPrivate() const { + return Is_EHSymbolPrivate; + } const char *getGlobalEHDirective() const { return GlobalEHDirective; } @@ -824,6 +889,9 @@ namespace llvm { const char *getDwarfPubTypesSection() const { return DwarfPubTypesSection; } + const char *getDwarfDebugInlineSection() const { + return DwarfDebugInlineSection; + } const char *getDwarfStrSection() const { return DwarfStrSection; } @@ -836,8 +904,8 @@ namespace llvm { const char *getDwarfRangesSection() const { return DwarfRangesSection; } - const char *getDwarfMacInfoSection() const { - return DwarfMacInfoSection; + const char *getDwarfMacroInfoSection() const { + return DwarfMacroInfoSection; } const char *getDwarfEHFrameSection() const { return DwarfEHFrameSection; @@ -852,4 +920,3 @@ namespace llvm { } #endif -