1 //===-- llvm/Target/TargetAsmInfo.h - Asm info ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a class to be used as the basis for target specific
11 // asm writers. This class primarily takes care of global printing constants,
12 // which are used in very similar ways across all targets.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TARGET_ASM_INFO_H
17 #define LLVM_TARGET_ASM_INFO_H
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/Support/DataTypes.h"
25 // DWARF encoding query type
26 namespace DwarfEncoding {
34 /// SectionKind - This is a simple POD value that classifies the properties of
38 Unknown = 0, ///< Custom section.
39 Text, ///< Text section.
40 BSS, ///< BSS section.
42 Data, ///< Data section.
43 DataRel, ///< Data that has relocations.
44 DataRelLocal, ///< Data that only has local relocations.
47 ROData, ///< Readonly data section.
48 DataRelRO, ///< Readonly data with non-local relocations.
49 DataRelROLocal, ///< Readonly data with local relocations only.
51 /// Mergable sections.
52 RODataMergeStr, ///< Readonly data section: nul-terminated strings.
53 RODataMergeConst, ///< Readonly data section: fixed-length constants.
55 /// Thread local data.
56 ThreadData, ///< Initialized TLS data objects
57 ThreadBSS ///< Uninitialized TLS data objects
58 } K; // This is private.
61 Kind getKind() const { return K; }
63 bool isReadOnly() const {
65 K == DataRelRO || K == DataRelROLocal ||
66 K == RODataMergeConst || K == RODataMergeStr;
69 /// isReadOnlyWithDynamicInit - Return true if this data is readonly, but
70 /// the dynamic linker has to write to it to apply relocations.
71 bool isReadOnlyWithDynamicInit() const {
72 return K == DataRelRO || K == DataRelROLocal;
76 return K == BSS || K == ThreadBSS;
80 return K == ThreadData || K == ThreadBSS;
87 bool isWritable() const {
90 K == DataRel || K == DataRelLocal ||
91 K == DataRelRO || K == DataRelROLocal ||
95 bool isMergableString() const { return K == RODataMergeStr; }
96 bool isMergableConstant() const {
97 return K == RODataMergeStr || K == RODataMergeConst;
100 static SectionKind get(Kind K) {
101 SectionKind Res = { K };
104 static SectionKind getText() { return get(Text); }
105 static SectionKind getBSS() { return get(BSS); }
106 static SectionKind getData() { return get(Data); }
107 static SectionKind getDataRel() { return get(DataRel); }
108 static SectionKind getDataRelLocal() { return get(DataRelLocal); }
109 static SectionKind getROData() { return get(ROData); }
110 static SectionKind getDataRelRO() { return get(DataRelRO); }
111 static SectionKind getDataRelROLocal() { return get(DataRelROLocal); }
112 static SectionKind getRODataMergeStr() { return get(RODataMergeStr); }
113 static SectionKind getRODataMergeConst() { return get(RODataMergeConst); }
114 static SectionKind getThreadData() { return get(ThreadData); }
115 static SectionKind getThreadBSS() { return get(ThreadBSS); }
118 namespace SectionFlags {
119 const unsigned Invalid = -1U;
120 const unsigned None = 0;
121 const unsigned Code = 1 << 0; ///< Section contains code
122 const unsigned Writable = 1 << 1; ///< Section is writable
123 const unsigned BSS = 1 << 2; ///< Section contains only zeroes
124 const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data
125 const unsigned Strings = 1 << 4; ///< Section contains C-type strings
126 const unsigned TLS = 1 << 5; ///< Section contains thread-local data
127 const unsigned Debug = 1 << 6; ///< Section contains debug data
128 const unsigned Linkonce = 1 << 7; ///< Section is linkonce
129 const unsigned TypeFlags = 0xFF;
130 // Some gap for future flags
132 /// Named - True if this section should be printed with ".section <name>",
133 /// false if the section name is something like ".const".
134 const unsigned Named = 1 << 23; ///< Section is named
135 const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
137 static inline unsigned getEntitySize(unsigned Flags) {
138 return (Flags >> 24) & 0xFF;
141 // FIXME: Why does this return a value?
142 static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
143 return (Flags & ~EntitySize) | ((Size & 0xFF) << 24);
147 static inline unsigned getEmptyKey() { return Invalid; }
148 static inline unsigned getTombstoneKey() { return Invalid - 1; }
149 static unsigned getHashValue(const unsigned &Key) { return Key; }
150 static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
151 static bool isPod() { return true; }
154 typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
164 friend class TargetAsmInfo;
165 friend class StringMapEntry<Section>;
166 friend class StringMap<Section>;
170 explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
174 unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
176 const std::string &getName() const { return Name; }
177 unsigned getFlags() const { return Flags; }
179 bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
182 /// TargetAsmInfo - This class is intended to be used as a base class for asm
183 /// properties and features specific to the target.
184 class TargetAsmInfo {
186 mutable StringMap<Section> Sections;
187 mutable SectionFlags::FlagsStringsMapType FlagsStrings;
189 /// TM - The current TargetMachine.
190 const TargetMachine &TM;
192 //===------------------------------------------------------------------===//
193 // Properties to be set by the target writer, used to configure asm printer.
196 /// TextSection - Section directive for standard text.
198 const Section *TextSection; // Defaults to ".text".
200 /// DataSection - Section directive for standard data.
202 const Section *DataSection; // Defaults to ".data".
204 /// BSSSection - Section directive for uninitialized data. Null if this
205 /// target doesn't support a BSS section.
207 const char *BSSSection; // Default to ".bss".
208 const Section *BSSSection_;
210 /// ReadOnlySection - This is the directive that is emitted to switch to a
211 /// read-only section for constant data (e.g. data declared const,
213 const Section *ReadOnlySection; // Defaults to NULL
215 /// TLSDataSection - Section directive for Thread Local data.
217 const Section *TLSDataSection; // Defaults to ".tdata".
219 /// TLSBSSSection - Section directive for Thread Local uninitialized data.
220 /// Null if this target doesn't support a BSS section.
222 const Section *TLSBSSSection; // Defaults to ".tbss".
224 /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
225 /// section on this target. Null if this target doesn't support zerofill.
226 const char *ZeroFillDirective; // Default is null.
228 /// NonexecutableStackDirective - Directive for declaring to the
229 /// linker and beyond that the emitted code does not require stack
230 /// memory to be executable.
231 const char *NonexecutableStackDirective; // Default is null.
233 /// NeedsSet - True if target asm treats expressions in data directives
234 /// as linktime-relocatable. For assembly-time computation, we need to
235 /// use a .set. Thus:
238 /// is computed at assembly time, while
240 /// is relocated if the relative locations of x and y change at linktime.
241 /// We want both these things in different places.
242 bool NeedsSet; // Defaults to false.
244 /// MaxInstLength - This is the maximum possible length of an instruction,
245 /// which is needed to compute the size of an inline asm.
246 unsigned MaxInstLength; // Defaults to 4.
248 /// PCSymbol - The symbol used to represent the current PC. Used in PC
249 /// relative expressions.
250 const char *PCSymbol; // Defaults to "$".
252 /// SeparatorChar - This character, if specified, is used to separate
253 /// instructions from each other when on the same line. This is used to
254 /// measure inline asm instructions.
255 char SeparatorChar; // Defaults to ';'
257 /// CommentColumn - This indicates the comment num (zero-based) at
258 /// which asm comments should be printed.
259 unsigned CommentColumn; // Defaults to 60
261 /// CommentString - This indicates the comment character used by the
263 const char *CommentString; // Defaults to "#"
265 /// FirstOperandColumn - The output column where the first operand
266 /// should be printed
267 unsigned FirstOperandColumn; // Defaults to 0 (ignored)
269 /// MaxOperandLength - The maximum length of any printed asm
271 unsigned MaxOperandLength; // Defaults to 0 (ignored)
273 /// GlobalPrefix - If this is set to a non-empty string, it is prepended
274 /// onto all global symbols. This is often used for "_" or ".".
275 const char *GlobalPrefix; // Defaults to ""
277 /// PrivateGlobalPrefix - This prefix is used for globals like constant
278 /// pool entries that are completely private to the .s file and should not
279 /// have names in the .o file. This is often "." or "L".
280 const char *PrivateGlobalPrefix; // Defaults to "."
282 /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
283 /// be passed through the assembler but be removed by the linker. This
284 /// is "l" on Darwin, currently used for some ObjC metadata.
285 const char *LinkerPrivateGlobalPrefix; // Defaults to ""
287 /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
288 /// emitted before jump tables with the specified prefix.
289 const char *JumpTableSpecialLabelPrefix; // Default to null.
291 /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
292 /// will enclose any GlobalVariable (that isn't a function)
294 const char *GlobalVarAddrPrefix; // Defaults to ""
295 const char *GlobalVarAddrSuffix; // Defaults to ""
297 /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
298 /// will enclose any GlobalVariable that points to a function.
300 const char *FunctionAddrPrefix; // Defaults to ""
301 const char *FunctionAddrSuffix; // Defaults to ""
303 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
304 /// enclose any personality function in the common frame section.
306 const char *PersonalityPrefix; // Defaults to ""
307 const char *PersonalitySuffix; // Defaults to ""
309 /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
312 bool NeedsIndirectEncoding; // Defaults to false
314 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
315 /// emit before and after an inline assembly statement.
316 const char *InlineAsmStart; // Defaults to "#APP\n"
317 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
319 /// AssemblerDialect - Which dialect of an assembler variant to use.
320 unsigned AssemblerDialect; // Defaults to 0
322 /// AllowQuotesInName - This is true if the assembler allows for complex
323 /// symbol names to be surrounded in quotes. This defaults to false.
324 bool AllowQuotesInName;
326 //===--- Data Emission Directives -------------------------------------===//
328 /// ZeroDirective - this should be set to the directive used to get some
329 /// number of zero bytes emitted to the current section. Common cases are
330 /// "\t.zero\t" and "\t.space\t". If this is set to null, the
331 /// Data*bitsDirective's will be used to emit zero bytes.
332 const char *ZeroDirective; // Defaults to "\t.zero\t"
333 const char *ZeroDirectiveSuffix; // Defaults to ""
335 /// AsciiDirective - This directive allows emission of an ascii string with
336 /// the standard C escape characters embedded into it.
337 const char *AsciiDirective; // Defaults to "\t.ascii\t"
339 /// AscizDirective - If not null, this allows for special handling of
340 /// zero terminated strings on this target. This is commonly supported as
341 /// ".asciz". If a target doesn't support this, it can be set to null.
342 const char *AscizDirective; // Defaults to "\t.asciz\t"
344 /// DataDirectives - These directives are used to output some unit of
345 /// integer data to the current section. If a data directive is set to
346 /// null, smaller data directives will be used to emit the large sizes.
347 const char *Data8bitsDirective; // Defaults to "\t.byte\t"
348 const char *Data16bitsDirective; // Defaults to "\t.short\t"
349 const char *Data32bitsDirective; // Defaults to "\t.long\t"
350 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
352 /// getDataASDirective - Return the directive that should be used to emit
353 /// data of the specified size to the specified numeric address space.
354 virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
355 assert(AS != 0 && "Don't know the directives for default addr space");
359 //===--- Alignment Information ----------------------------------------===//
361 /// AlignDirective - The directive used to emit round up to an alignment
364 const char *AlignDirective; // Defaults to "\t.align\t"
366 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
367 /// emits ".align N" directives, where N is the number of bytes to align to.
368 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
370 bool AlignmentIsInBytes; // Defaults to true
372 /// TextAlignFillValue - If non-zero, this is used to fill the executable
373 /// space created as the result of a alignment directive.
374 unsigned TextAlignFillValue;
376 //===--- Section Switching Directives ---------------------------------===//
378 /// SwitchToSectionDirective - This is the directive used when we want to
379 /// emit a global to an arbitrary section. The section name is emited after
381 const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
383 /// TextSectionStartSuffix - This is printed after each start of section
384 /// directive for text sections.
385 const char *TextSectionStartSuffix; // Defaults to "".
387 /// DataSectionStartSuffix - This is printed after each start of section
388 /// directive for data sections.
389 const char *DataSectionStartSuffix; // Defaults to "".
391 /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
392 /// section with the section name and this suffix printed.
393 const char *SectionEndDirectiveSuffix;// Defaults to null.
395 /// ConstantPoolSection - This is the section that we SwitchToSection right
396 /// before emitting the constant pool for a function.
397 const char *ConstantPoolSection; // Defaults to "\t.section .rodata"
399 /// JumpTableDataSection - This is the section that we SwitchToSection right
400 /// before emitting the jump tables for a function when the relocation model
402 const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
404 /// JumpTableDirective - if non-null, the directive to emit before a jump
406 const char *JumpTableDirective;
408 /// CStringSection - If not null, this allows for special handling of
409 /// cstring constants (null terminated string that does not contain any
410 /// other null bytes) on this target. This is commonly supported as
412 const char *CStringSection; // Defaults to NULL
413 const Section *CStringSection_;
415 /// StaticCtorsSection - This is the directive that is emitted to switch to
416 /// a section to emit the static constructor list.
417 /// Defaults to "\t.section .ctors,\"aw\",@progbits".
418 const char *StaticCtorsSection;
420 /// StaticDtorsSection - This is the directive that is emitted to switch to
421 /// a section to emit the static destructor list.
422 /// Defaults to "\t.section .dtors,\"aw\",@progbits".
423 const char *StaticDtorsSection;
425 //===--- Global Variable Emission Directives --------------------------===//
427 /// GlobalDirective - This is the directive used to declare a global entity.
429 const char *GlobalDirective; // Defaults to NULL.
431 /// ExternDirective - This is the directive used to declare external
434 const char *ExternDirective; // Defaults to NULL.
436 /// SetDirective - This is the name of a directive that can be used to tell
437 /// the assembler to set the value of a variable to some expression.
438 const char *SetDirective; // Defaults to null.
440 /// LCOMMDirective - This is the name of a directive (if supported) that can
441 /// be used to efficiently declare a local (internal) block of zero
442 /// initialized data in the .bss/.data section. The syntax expected is:
443 /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
445 const char *LCOMMDirective; // Defaults to null.
447 const char *COMMDirective; // Defaults to "\t.comm\t".
449 /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
450 /// argument that specifies the alignment of the declaration.
451 bool COMMDirectiveTakesAlignment; // Defaults to true.
453 /// HasDotTypeDotSizeDirective - True if the target has .type and .size
454 /// directives, this is true for most ELF targets.
455 bool HasDotTypeDotSizeDirective; // Defaults to true.
457 /// HasSingleParameterDotFile - True if the target has a single parameter
458 /// .file directive, this is true for ELF targets.
459 bool HasSingleParameterDotFile; // Defaults to true.
461 /// UsedDirective - This directive, if non-null, is used to declare a global
462 /// as being used somehow that the assembler can't see. This prevents dead
463 /// code elimination on some targets.
464 const char *UsedDirective; // Defaults to null.
466 /// WeakRefDirective - This directive, if non-null, is used to declare a
467 /// global as being a weak undefined symbol.
468 const char *WeakRefDirective; // Defaults to null.
470 /// WeakDefDirective - This directive, if non-null, is used to declare a
471 /// global as being a weak defined symbol.
472 const char *WeakDefDirective; // Defaults to null.
474 /// HiddenDirective - This directive, if non-null, is used to declare a
475 /// global or function as having hidden visibility.
476 const char *HiddenDirective; // Defaults to "\t.hidden\t".
478 /// ProtectedDirective - This directive, if non-null, is used to declare a
479 /// global or function as having protected visibility.
480 const char *ProtectedDirective; // Defaults to "\t.protected\t".
482 //===--- Dwarf Emission Directives -----------------------------------===//
484 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
485 /// offsets for debug information. Defaults to false.
486 bool AbsoluteDebugSectionOffsets;
488 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
489 /// offsets for EH information. Defaults to false.
490 bool AbsoluteEHSectionOffsets;
492 /// HasLEB128 - True if target asm supports leb128 directives.
494 bool HasLEB128; // Defaults to false.
496 /// hasDotLocAndDotFile - True if target asm supports .loc and .file
497 /// directives for emitting debugging information.
499 bool HasDotLocAndDotFile; // Defaults to false.
501 /// SupportsDebugInformation - True if target supports emission of debugging
503 bool SupportsDebugInformation;
505 /// SupportsExceptionHandling - True if target supports
506 /// exception handling.
508 bool SupportsExceptionHandling; // Defaults to false.
510 /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
512 bool DwarfRequiresFrameSection; // Defaults to true.
514 /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
515 /// encode inline subroutine information.
516 bool DwarfUsesInlineInfoSection; // Defaults to false.
518 /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
519 /// doesn't show up in the symbol table of the object file.
520 bool Is_EHSymbolPrivate; // Defaults to true.
522 /// GlobalEHDirective - This is the directive used to make exception frame
523 /// tables globally visible.
525 const char *GlobalEHDirective; // Defaults to NULL.
527 /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
528 /// handle a weak_definition of constant 0 for an omitted EH frame.
529 bool SupportsWeakOmittedEHFrame; // Defaults to true.
531 /// DwarfSectionOffsetDirective - Special section offset directive.
532 const char* DwarfSectionOffsetDirective; // Defaults to NULL
534 /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
536 const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
538 /// DwarfInfoSection - Section directive for Dwarf info.
540 const char *DwarfInfoSection; // Defaults to ".debug_info".
542 /// DwarfLineSection - Section directive for Dwarf info.
544 const char *DwarfLineSection; // Defaults to ".debug_line".
546 /// DwarfFrameSection - Section directive for Dwarf info.
548 const char *DwarfFrameSection; // Defaults to ".debug_frame".
550 /// DwarfPubNamesSection - Section directive for Dwarf info.
552 const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
554 /// DwarfPubTypesSection - Section directive for Dwarf info.
556 const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
558 /// DwarfDebugInlineSection - Section directive for inline info.
560 const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined"
562 /// DwarfStrSection - Section directive for Dwarf info.
564 const char *DwarfStrSection; // Defaults to ".debug_str".
566 /// DwarfLocSection - Section directive for Dwarf info.
568 const char *DwarfLocSection; // Defaults to ".debug_loc".
570 /// DwarfARangesSection - Section directive for Dwarf info.
572 const char *DwarfARangesSection; // Defaults to ".debug_aranges".
574 /// DwarfRangesSection - Section directive for Dwarf info.
576 const char *DwarfRangesSection; // Defaults to ".debug_ranges".
578 /// DwarfMacroInfoSection - Section directive for DWARF macro info.
580 const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo".
582 /// DwarfEHFrameSection - Section directive for Exception frames.
584 const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
586 /// DwarfExceptionSection - Section directive for Exception table.
588 const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
590 //===--- CBE Asm Translation Table -----------------------------------===//
592 const char *const *AsmTransCBE; // Defaults to empty
595 explicit TargetAsmInfo(const TargetMachine &TM);
596 virtual ~TargetAsmInfo();
598 const Section* getNamedSection(const char *Name,
599 unsigned Flags = SectionFlags::None,
600 bool Override = false) const;
601 const Section* getUnnamedSection(const char *Directive,
602 unsigned Flags = SectionFlags::None,
603 bool Override = false) const;
605 /// Measure the specified inline asm to determine an approximation of its
607 virtual unsigned getInlineAsmLength(const char *Str) const;
609 /// emitUsedDirectiveFor - This hook allows targets to selectively decide
610 /// not to emit the UsedDirective for some symbols in llvm.used.
611 // FIXME: REMOVE this (rdar://7071300)
612 virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
613 Mangler *Mang) const {
617 /// PreferredEHDataFormat - This hook allows the target to select data
618 /// format used for encoding pointers in exception handling data. Reason is
619 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
620 /// if the symbol can be relocated.
621 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
625 /// getSectionForMergableConstant - Given a mergable constant with the
626 /// specified size and relocation information, return a section that it
627 /// should be placed in.
628 virtual const Section *
629 getSectionForMergableConstant(uint64_t Size, unsigned ReloInfo) const;
632 /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend
633 /// onto a global's name in order to get the unique section name for the
634 /// global. This is important for globals that need to be merged across
635 /// translation units.
637 getSectionPrefixForUniqueGlobal(SectionKind Kind) const {
641 /// getFlagsForNamedSection - If this target wants to be able to infer
642 /// section flags based on the name of the section specified for a global
643 /// variable, it can implement this. This is used on ELF systems so that
644 /// ".tbss" gets the TLS bit set etc.
645 virtual unsigned getFlagsForNamedSection(const char *Section) const {
649 /// SectionForGlobal - This method computes the appropriate section to emit
650 /// the specified global variable or function definition. This should not
651 /// be passed external (or available externally) globals.
652 // FIXME: MOVE TO ASMPRINTER.
653 const Section* SectionForGlobal(const GlobalValue *GV) const;
655 /// getSpecialCasedSectionGlobals - Allow the target to completely override
656 /// section assignment of a global.
657 /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
658 /// getFlagsForNamedSection.
659 virtual const Section *
660 getSpecialCasedSectionGlobals(const GlobalValue *GV,
661 SectionKind Kind) const {
665 const std::string &getSectionFlags(unsigned Flags) const;
666 virtual std::string printSectionFlags(unsigned flags) const { return ""; }
668 // FIXME: Eliminate this.
669 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
670 SectionKind Kind) const;
672 /// getSLEB128Size - Compute the number of bytes required for a signed
674 static unsigned getSLEB128Size(int Value);
676 /// getULEB128Size - Compute the number of bytes required for an unsigned
678 static unsigned getULEB128Size(unsigned Value);
680 // Data directive accessors.
682 const char *getData8bitsDirective(unsigned AS = 0) const {
683 return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
685 const char *getData16bitsDirective(unsigned AS = 0) const {
686 return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
688 const char *getData32bitsDirective(unsigned AS = 0) const {
689 return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
691 const char *getData64bitsDirective(unsigned AS = 0) const {
692 return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
698 const Section *getTextSection() const {
701 const Section *getDataSection() const {
704 const char *getBSSSection() const {
707 const Section *getBSSSection_() const {
710 const Section *getReadOnlySection() const {
711 return ReadOnlySection;
713 const Section *getTLSDataSection() const {
714 return TLSDataSection;
716 const Section *getTLSBSSSection() const {
717 return TLSBSSSection;
719 const char *getZeroFillDirective() const {
720 return ZeroFillDirective;
722 const char *getNonexecutableStackDirective() const {
723 return NonexecutableStackDirective;
725 bool needsSet() const {
728 const char *getPCSymbol() const {
731 char getSeparatorChar() const {
732 return SeparatorChar;
734 unsigned getCommentColumn() const {
735 return CommentColumn;
737 const char *getCommentString() const {
738 return CommentString;
740 unsigned getOperandColumn(int operand) const {
741 return FirstOperandColumn + (MaxOperandLength+1)*(operand-1);
743 const char *getGlobalPrefix() const {
746 const char *getPrivateGlobalPrefix() const {
747 return PrivateGlobalPrefix;
749 const char *getLinkerPrivateGlobalPrefix() const {
750 return LinkerPrivateGlobalPrefix;
752 const char *getJumpTableSpecialLabelPrefix() const {
753 return JumpTableSpecialLabelPrefix;
755 const char *getGlobalVarAddrPrefix() const {
756 return GlobalVarAddrPrefix;
758 const char *getGlobalVarAddrSuffix() const {
759 return GlobalVarAddrSuffix;
761 const char *getFunctionAddrPrefix() const {
762 return FunctionAddrPrefix;
764 const char *getFunctionAddrSuffix() const {
765 return FunctionAddrSuffix;
767 const char *getPersonalityPrefix() const {
768 return PersonalityPrefix;
770 const char *getPersonalitySuffix() const {
771 return PersonalitySuffix;
773 bool getNeedsIndirectEncoding() const {
774 return NeedsIndirectEncoding;
776 const char *getInlineAsmStart() const {
777 return InlineAsmStart;
779 const char *getInlineAsmEnd() const {
782 unsigned getAssemblerDialect() const {
783 return AssemblerDialect;
785 bool doesAllowQuotesInName() const {
786 return AllowQuotesInName;
788 const char *getZeroDirective() const {
789 return ZeroDirective;
791 const char *getZeroDirectiveSuffix() const {
792 return ZeroDirectiveSuffix;
794 const char *getAsciiDirective() const {
795 return AsciiDirective;
797 const char *getAscizDirective() const {
798 return AscizDirective;
800 const char *getJumpTableDirective() const {
801 return JumpTableDirective;
803 const char *getAlignDirective() const {
804 return AlignDirective;
806 bool getAlignmentIsInBytes() const {
807 return AlignmentIsInBytes;
809 unsigned getTextAlignFillValue() const {
810 return TextAlignFillValue;
812 const char *getSwitchToSectionDirective() const {
813 return SwitchToSectionDirective;
815 const char *getTextSectionStartSuffix() const {
816 return TextSectionStartSuffix;
818 const char *getDataSectionStartSuffix() const {
819 return DataSectionStartSuffix;
821 const char *getSectionEndDirectiveSuffix() const {
822 return SectionEndDirectiveSuffix;
824 const char *getConstantPoolSection() const {
825 return ConstantPoolSection;
827 const char *getJumpTableDataSection() const {
828 return JumpTableDataSection;
830 const char *getCStringSection() const {
831 return CStringSection;
833 const Section *getCStringSection_() const {
834 return CStringSection_;
836 const char *getStaticCtorsSection() const {
837 return StaticCtorsSection;
839 const char *getStaticDtorsSection() const {
840 return StaticDtorsSection;
842 const char *getGlobalDirective() const {
843 return GlobalDirective;
845 const char *getExternDirective() const {
846 return ExternDirective;
848 const char *getSetDirective() const {
851 const char *getLCOMMDirective() const {
852 return LCOMMDirective;
854 const char *getCOMMDirective() const {
855 return COMMDirective;
857 bool getCOMMDirectiveTakesAlignment() const {
858 return COMMDirectiveTakesAlignment;
860 bool hasDotTypeDotSizeDirective() const {
861 return HasDotTypeDotSizeDirective;
863 bool hasSingleParameterDotFile() const {
864 return HasSingleParameterDotFile;
866 const char *getUsedDirective() const {
867 return UsedDirective;
869 const char *getWeakRefDirective() const {
870 return WeakRefDirective;
872 const char *getWeakDefDirective() const {
873 return WeakDefDirective;
875 const char *getHiddenDirective() const {
876 return HiddenDirective;
878 const char *getProtectedDirective() const {
879 return ProtectedDirective;
881 bool isAbsoluteDebugSectionOffsets() const {
882 return AbsoluteDebugSectionOffsets;
884 bool isAbsoluteEHSectionOffsets() const {
885 return AbsoluteEHSectionOffsets;
887 bool hasLEB128() const {
890 bool hasDotLocAndDotFile() const {
891 return HasDotLocAndDotFile;
893 bool doesSupportDebugInformation() const {
894 return SupportsDebugInformation;
896 bool doesSupportExceptionHandling() const {
897 return SupportsExceptionHandling;
899 bool doesDwarfRequireFrameSection() const {
900 return DwarfRequiresFrameSection;
902 bool doesDwarfUsesInlineInfoSection() const {
903 return DwarfUsesInlineInfoSection;
905 bool is_EHSymbolPrivate() const {
906 return Is_EHSymbolPrivate;
908 const char *getGlobalEHDirective() const {
909 return GlobalEHDirective;
911 bool getSupportsWeakOmittedEHFrame() const {
912 return SupportsWeakOmittedEHFrame;
914 const char *getDwarfSectionOffsetDirective() const {
915 return DwarfSectionOffsetDirective;
917 const char *getDwarfAbbrevSection() const {
918 return DwarfAbbrevSection;
920 const char *getDwarfInfoSection() const {
921 return DwarfInfoSection;
923 const char *getDwarfLineSection() const {
924 return DwarfLineSection;
926 const char *getDwarfFrameSection() const {
927 return DwarfFrameSection;
929 const char *getDwarfPubNamesSection() const {
930 return DwarfPubNamesSection;
932 const char *getDwarfPubTypesSection() const {
933 return DwarfPubTypesSection;
935 const char *getDwarfDebugInlineSection() const {
936 return DwarfDebugInlineSection;
938 const char *getDwarfStrSection() const {
939 return DwarfStrSection;
941 const char *getDwarfLocSection() const {
942 return DwarfLocSection;
944 const char *getDwarfARangesSection() const {
945 return DwarfARangesSection;
947 const char *getDwarfRangesSection() const {
948 return DwarfRangesSection;
950 const char *getDwarfMacroInfoSection() const {
951 return DwarfMacroInfoSection;
953 const char *getDwarfEHFrameSection() const {
954 return DwarfEHFrameSection;
956 const char *getDwarfExceptionSection() const {
957 return DwarfExceptionSection;
959 const char *const *getAsmCBE() const {