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 Text, ///< Text section.
39 BSS, ///< BSS section.
41 Data, ///< Data section.
42 DataRel, ///< Data that has relocations.
43 DataRelLocal, ///< Data that only has local relocations.
46 ROData, ///< Readonly data section.
47 DataRelRO, ///< Readonly data with non-local relocations.
48 DataRelROLocal, ///< Readonly data with local relocations only.
50 /// Mergable sections.
51 RODataMergeStr, ///< Readonly data section: nul-terminated strings.
52 RODataMergeConst, ///< Readonly data section: fixed-length constants.
54 /// Thread local data.
55 ThreadData, ///< Initialized TLS data objects
56 ThreadBSS ///< Uninitialized TLS data objects
57 } K : 8; // This is private.
60 Kind getKind() const { return K; }
62 bool isReadOnly() const {
63 return K == ROData || K == RODataMergeConst || K == RODataMergeStr;
66 /// isReadOnlyWithDynamicInit - Return true if this data is readonly, but
67 /// the dynamic linker has to write to it to apply relocations.
68 bool isReadOnlyWithDynamicInit() const {
69 return K == DataRelRO || K == DataRelROLocal;
73 return K == BSS || K == ThreadBSS;
77 return K == ThreadData || K == ThreadBSS;
84 bool isWritable() const {
87 K == DataRel || K == DataRelLocal ||
88 K == DataRelRO || K == DataRelROLocal ||
92 bool isMergableString() const { return K == RODataMergeStr; }
93 bool isMergableConstant() const {
94 return K == RODataMergeStr || K == RODataMergeConst;
97 static SectionKind get(Kind K) {
98 SectionKind Res = { K };
101 static SectionKind getText() { return get(Text); }
102 static SectionKind getBSS() { return get(BSS); }
103 static SectionKind getData() { return get(Data); }
104 static SectionKind getDataRel() { return get(DataRel); }
105 static SectionKind getDataRelLocal() { return get(DataRelLocal); }
106 static SectionKind getROData() { return get(ROData); }
107 static SectionKind getDataRelRO() { return get(DataRelRO); }
108 static SectionKind getDataRelROLocal() { return get(DataRelROLocal); }
109 static SectionKind getRODataMergeStr() { return get(RODataMergeStr); }
110 static SectionKind getRODataMergeConst() { return get(RODataMergeConst); }
111 static SectionKind getThreadData() { return get(ThreadData); }
112 static SectionKind getThreadBSS() { return get(ThreadBSS); }
115 namespace SectionFlags {
116 const unsigned Invalid = -1U;
117 const unsigned None = 0;
118 const unsigned Code = 1 << 0; ///< Section contains code
119 const unsigned Writable = 1 << 1; ///< Section is writable
120 const unsigned BSS = 1 << 2; ///< Section contains only zeroes
121 const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data
122 const unsigned Strings = 1 << 4; ///< Section contains C-type strings
123 const unsigned TLS = 1 << 5; ///< Section contains thread-local data
124 const unsigned Debug = 1 << 6; ///< Section contains debug data
125 const unsigned Linkonce = 1 << 7; ///< Section is linkonce
126 const unsigned TypeFlags = 0xFF;
127 // Some gap for future flags
129 /// Named - True if this section should be printed with ".section <name>",
130 /// false if the section name is something like ".const".
131 const unsigned Named = 1 << 23; ///< Section is named
132 const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
134 static inline unsigned getEntitySize(unsigned Flags) {
135 return (Flags >> 24) & 0xFF;
138 // FIXME: Why does this return a value?
139 static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
140 return (Flags & ~EntitySize) | ((Size & 0xFF) << 24);
144 static inline unsigned getEmptyKey() { return Invalid; }
145 static inline unsigned getTombstoneKey() { return Invalid - 1; }
146 static unsigned getHashValue(const unsigned &Key) { return Key; }
147 static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
148 static bool isPod() { return true; }
151 typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
161 friend class TargetAsmInfo;
162 friend class StringMapEntry<Section>;
163 friend class StringMap<Section>;
167 explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
171 unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
173 const std::string &getName() const { return Name; }
174 unsigned getFlags() const { return Flags; }
176 bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
179 /// TargetAsmInfo - This class is intended to be used as a base class for asm
180 /// properties and features specific to the target.
181 class TargetAsmInfo {
183 mutable StringMap<Section> Sections;
184 mutable SectionFlags::FlagsStringsMapType FlagsStrings;
186 /// TM - The current TargetMachine.
187 const TargetMachine &TM;
189 //===------------------------------------------------------------------===//
190 // Properties to be set by the target writer, used to configure asm printer.
193 /// TextSection - Section directive for standard text.
195 const Section *TextSection; // Defaults to ".text".
197 /// DataSection - Section directive for standard data.
199 const Section *DataSection; // Defaults to ".data".
201 /// BSSSection - Section directive for uninitialized data. Null if this
202 /// target doesn't support a BSS section.
204 const char *BSSSection; // Default to ".bss".
205 const Section *BSSSection_;
207 /// ReadOnlySection - This is the directive that is emitted to switch to a
208 /// read-only section for constant data (e.g. data declared const,
210 const Section *ReadOnlySection; // Defaults to NULL
212 /// TLSDataSection - Section directive for Thread Local data.
214 const Section *TLSDataSection; // Defaults to ".tdata".
216 /// TLSBSSSection - Section directive for Thread Local uninitialized data.
217 /// Null if this target doesn't support a BSS section.
219 const Section *TLSBSSSection; // Defaults to ".tbss".
221 /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
222 /// section on this target. Null if this target doesn't support zerofill.
223 const char *ZeroFillDirective; // Default is null.
225 /// NonexecutableStackDirective - Directive for declaring to the
226 /// linker and beyond that the emitted code does not require stack
227 /// memory to be executable.
228 const char *NonexecutableStackDirective; // Default is null.
230 /// NeedsSet - True if target asm treats expressions in data directives
231 /// as linktime-relocatable. For assembly-time computation, we need to
232 /// use a .set. Thus:
235 /// is computed at assembly time, while
237 /// is relocated if the relative locations of x and y change at linktime.
238 /// We want both these things in different places.
239 bool NeedsSet; // Defaults to false.
241 /// MaxInstLength - This is the maximum possible length of an instruction,
242 /// which is needed to compute the size of an inline asm.
243 unsigned MaxInstLength; // Defaults to 4.
245 /// PCSymbol - The symbol used to represent the current PC. Used in PC
246 /// relative expressions.
247 const char *PCSymbol; // Defaults to "$".
249 /// SeparatorChar - This character, if specified, is used to separate
250 /// instructions from each other when on the same line. This is used to
251 /// measure inline asm instructions.
252 char SeparatorChar; // Defaults to ';'
254 /// CommentColumn - This indicates the comment num (zero-based) at
255 /// which asm comments should be printed.
256 unsigned CommentColumn; // Defaults to 60
258 /// CommentString - This indicates the comment character used by the
260 const char *CommentString; // Defaults to "#"
262 /// FirstOperandColumn - The output column where the first operand
263 /// should be printed
264 unsigned FirstOperandColumn; // Defaults to 0 (ignored)
266 /// MaxOperandLength - The maximum length of any printed asm
268 unsigned MaxOperandLength; // Defaults to 0 (ignored)
270 /// GlobalPrefix - If this is set to a non-empty string, it is prepended
271 /// onto all global symbols. This is often used for "_" or ".".
272 const char *GlobalPrefix; // Defaults to ""
274 /// PrivateGlobalPrefix - This prefix is used for globals like constant
275 /// pool entries that are completely private to the .s file and should not
276 /// have names in the .o file. This is often "." or "L".
277 const char *PrivateGlobalPrefix; // Defaults to "."
279 /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
280 /// be passed through the assembler but be removed by the linker. This
281 /// is "l" on Darwin, currently used for some ObjC metadata.
282 const char *LinkerPrivateGlobalPrefix; // Defaults to ""
284 /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
285 /// emitted before jump tables with the specified prefix.
286 const char *JumpTableSpecialLabelPrefix; // Default to null.
288 /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
289 /// will enclose any GlobalVariable (that isn't a function)
291 const char *GlobalVarAddrPrefix; // Defaults to ""
292 const char *GlobalVarAddrSuffix; // Defaults to ""
294 /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
295 /// will enclose any GlobalVariable that points to a function.
297 const char *FunctionAddrPrefix; // Defaults to ""
298 const char *FunctionAddrSuffix; // Defaults to ""
300 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
301 /// enclose any personality function in the common frame section.
303 const char *PersonalityPrefix; // Defaults to ""
304 const char *PersonalitySuffix; // Defaults to ""
306 /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
309 bool NeedsIndirectEncoding; // Defaults to false
311 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
312 /// emit before and after an inline assembly statement.
313 const char *InlineAsmStart; // Defaults to "#APP\n"
314 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
316 /// AssemblerDialect - Which dialect of an assembler variant to use.
317 unsigned AssemblerDialect; // Defaults to 0
319 /// AllowQuotesInName - This is true if the assembler allows for complex
320 /// symbol names to be surrounded in quotes. This defaults to false.
321 bool AllowQuotesInName;
323 //===--- Data Emission Directives -------------------------------------===//
325 /// ZeroDirective - this should be set to the directive used to get some
326 /// number of zero bytes emitted to the current section. Common cases are
327 /// "\t.zero\t" and "\t.space\t". If this is set to null, the
328 /// Data*bitsDirective's will be used to emit zero bytes.
329 const char *ZeroDirective; // Defaults to "\t.zero\t"
330 const char *ZeroDirectiveSuffix; // Defaults to ""
332 /// AsciiDirective - This directive allows emission of an ascii string with
333 /// the standard C escape characters embedded into it.
334 const char *AsciiDirective; // Defaults to "\t.ascii\t"
336 /// AscizDirective - If not null, this allows for special handling of
337 /// zero terminated strings on this target. This is commonly supported as
338 /// ".asciz". If a target doesn't support this, it can be set to null.
339 const char *AscizDirective; // Defaults to "\t.asciz\t"
341 /// DataDirectives - These directives are used to output some unit of
342 /// integer data to the current section. If a data directive is set to
343 /// null, smaller data directives will be used to emit the large sizes.
344 const char *Data8bitsDirective; // Defaults to "\t.byte\t"
345 const char *Data16bitsDirective; // Defaults to "\t.short\t"
346 const char *Data32bitsDirective; // Defaults to "\t.long\t"
347 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
349 /// getDataASDirective - Return the directive that should be used to emit
350 /// data of the specified size to the specified numeric address space.
351 virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
352 assert(AS != 0 && "Don't know the directives for default addr space");
356 //===--- Alignment Information ----------------------------------------===//
358 /// AlignDirective - The directive used to emit round up to an alignment
361 const char *AlignDirective; // Defaults to "\t.align\t"
363 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
364 /// emits ".align N" directives, where N is the number of bytes to align to.
365 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
367 bool AlignmentIsInBytes; // Defaults to true
369 /// TextAlignFillValue - If non-zero, this is used to fill the executable
370 /// space created as the result of a alignment directive.
371 unsigned TextAlignFillValue;
373 //===--- Section Switching Directives ---------------------------------===//
375 /// SwitchToSectionDirective - This is the directive used when we want to
376 /// emit a global to an arbitrary section. The section name is emited after
378 const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
380 /// TextSectionStartSuffix - This is printed after each start of section
381 /// directive for text sections.
382 const char *TextSectionStartSuffix; // Defaults to "".
384 /// DataSectionStartSuffix - This is printed after each start of section
385 /// directive for data sections.
386 const char *DataSectionStartSuffix; // Defaults to "".
388 /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
389 /// section with the section name and this suffix printed.
390 const char *SectionEndDirectiveSuffix;// Defaults to null.
392 /// ConstantPoolSection - This is the section that we SwitchToSection right
393 /// before emitting the constant pool for a function.
394 const char *ConstantPoolSection; // Defaults to "\t.section .rodata"
396 /// JumpTableDataSection - This is the section that we SwitchToSection right
397 /// before emitting the jump tables for a function when the relocation model
399 const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
401 /// JumpTableDirective - if non-null, the directive to emit before a jump
403 const char *JumpTableDirective;
405 /// CStringSection - If not null, this allows for special handling of
406 /// cstring constants (null terminated string that does not contain any
407 /// other null bytes) on this target. This is commonly supported as
409 const char *CStringSection; // Defaults to NULL
410 const Section *CStringSection_;
412 /// StaticCtorsSection - This is the directive that is emitted to switch to
413 /// a section to emit the static constructor list.
414 /// Defaults to "\t.section .ctors,\"aw\",@progbits".
415 const char *StaticCtorsSection;
417 /// StaticDtorsSection - This is the directive that is emitted to switch to
418 /// a section to emit the static destructor list.
419 /// Defaults to "\t.section .dtors,\"aw\",@progbits".
420 const char *StaticDtorsSection;
422 //===--- Global Variable Emission Directives --------------------------===//
424 /// GlobalDirective - This is the directive used to declare a global entity.
426 const char *GlobalDirective; // Defaults to NULL.
428 /// ExternDirective - This is the directive used to declare external
431 const char *ExternDirective; // Defaults to NULL.
433 /// SetDirective - This is the name of a directive that can be used to tell
434 /// the assembler to set the value of a variable to some expression.
435 const char *SetDirective; // Defaults to null.
437 /// LCOMMDirective - This is the name of a directive (if supported) that can
438 /// be used to efficiently declare a local (internal) block of zero
439 /// initialized data in the .bss/.data section. The syntax expected is:
440 /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
442 const char *LCOMMDirective; // Defaults to null.
444 const char *COMMDirective; // Defaults to "\t.comm\t".
446 /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
447 /// argument that specifies the alignment of the declaration.
448 bool COMMDirectiveTakesAlignment; // Defaults to true.
450 /// HasDotTypeDotSizeDirective - True if the target has .type and .size
451 /// directives, this is true for most ELF targets.
452 bool HasDotTypeDotSizeDirective; // Defaults to true.
454 /// HasSingleParameterDotFile - True if the target has a single parameter
455 /// .file directive, this is true for ELF targets.
456 bool HasSingleParameterDotFile; // Defaults to true.
458 /// UsedDirective - This directive, if non-null, is used to declare a global
459 /// as being used somehow that the assembler can't see. This prevents dead
460 /// code elimination on some targets.
461 const char *UsedDirective; // Defaults to null.
463 /// WeakRefDirective - This directive, if non-null, is used to declare a
464 /// global as being a weak undefined symbol.
465 const char *WeakRefDirective; // Defaults to null.
467 /// WeakDefDirective - This directive, if non-null, is used to declare a
468 /// global as being a weak defined symbol.
469 const char *WeakDefDirective; // Defaults to null.
471 /// HiddenDirective - This directive, if non-null, is used to declare a
472 /// global or function as having hidden visibility.
473 const char *HiddenDirective; // Defaults to "\t.hidden\t".
475 /// ProtectedDirective - This directive, if non-null, is used to declare a
476 /// global or function as having protected visibility.
477 const char *ProtectedDirective; // Defaults to "\t.protected\t".
479 //===--- Dwarf Emission Directives -----------------------------------===//
481 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
482 /// offsets for debug information. Defaults to false.
483 bool AbsoluteDebugSectionOffsets;
485 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
486 /// offsets for EH information. Defaults to false.
487 bool AbsoluteEHSectionOffsets;
489 /// HasLEB128 - True if target asm supports leb128 directives.
491 bool HasLEB128; // Defaults to false.
493 /// hasDotLocAndDotFile - True if target asm supports .loc and .file
494 /// directives for emitting debugging information.
496 bool HasDotLocAndDotFile; // Defaults to false.
498 /// SupportsDebugInformation - True if target supports emission of debugging
500 bool SupportsDebugInformation;
502 /// SupportsExceptionHandling - True if target supports
503 /// exception handling.
505 bool SupportsExceptionHandling; // Defaults to false.
507 /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
509 bool DwarfRequiresFrameSection; // Defaults to true.
511 /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
512 /// encode inline subroutine information.
513 bool DwarfUsesInlineInfoSection; // Defaults to false.
515 /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
516 /// doesn't show up in the symbol table of the object file.
517 bool Is_EHSymbolPrivate; // Defaults to true.
519 /// GlobalEHDirective - This is the directive used to make exception frame
520 /// tables globally visible.
522 const char *GlobalEHDirective; // Defaults to NULL.
524 /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
525 /// handle a weak_definition of constant 0 for an omitted EH frame.
526 bool SupportsWeakOmittedEHFrame; // Defaults to true.
528 /// DwarfSectionOffsetDirective - Special section offset directive.
529 const char* DwarfSectionOffsetDirective; // Defaults to NULL
531 /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
533 const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
535 /// DwarfInfoSection - Section directive for Dwarf info.
537 const char *DwarfInfoSection; // Defaults to ".debug_info".
539 /// DwarfLineSection - Section directive for Dwarf info.
541 const char *DwarfLineSection; // Defaults to ".debug_line".
543 /// DwarfFrameSection - Section directive for Dwarf info.
545 const char *DwarfFrameSection; // Defaults to ".debug_frame".
547 /// DwarfPubNamesSection - Section directive for Dwarf info.
549 const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
551 /// DwarfPubTypesSection - Section directive for Dwarf info.
553 const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
555 /// DwarfDebugInlineSection - Section directive for inline info.
557 const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined"
559 /// DwarfStrSection - Section directive for Dwarf info.
561 const char *DwarfStrSection; // Defaults to ".debug_str".
563 /// DwarfLocSection - Section directive for Dwarf info.
565 const char *DwarfLocSection; // Defaults to ".debug_loc".
567 /// DwarfARangesSection - Section directive for Dwarf info.
569 const char *DwarfARangesSection; // Defaults to ".debug_aranges".
571 /// DwarfRangesSection - Section directive for Dwarf info.
573 const char *DwarfRangesSection; // Defaults to ".debug_ranges".
575 /// DwarfMacroInfoSection - Section directive for DWARF macro info.
577 const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo".
579 /// DwarfEHFrameSection - Section directive for Exception frames.
581 const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
583 /// DwarfExceptionSection - Section directive for Exception table.
585 const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
587 //===--- CBE Asm Translation Table -----------------------------------===//
589 const char *const *AsmTransCBE; // Defaults to empty
592 explicit TargetAsmInfo(const TargetMachine &TM);
593 virtual ~TargetAsmInfo();
595 const Section* getNamedSection(const char *Name,
596 unsigned Flags = SectionFlags::None,
597 bool Override = false) const;
598 const Section* getUnnamedSection(const char *Directive,
599 unsigned Flags = SectionFlags::None,
600 bool Override = false) const;
602 /// Measure the specified inline asm to determine an approximation of its
604 virtual unsigned getInlineAsmLength(const char *Str) const;
606 /// emitUsedDirectiveFor - This hook allows targets to selectively decide
607 /// not to emit the UsedDirective for some symbols in llvm.used.
608 // FIXME: REMOVE this (rdar://7071300)
609 virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
610 Mangler *Mang) const {
614 /// PreferredEHDataFormat - This hook allows the target to select data
615 /// format used for encoding pointers in exception handling data. Reason is
616 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
617 /// if the symbol can be relocated.
618 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
622 /// getSectionForMergableConstant - Given a mergable constant with the
623 /// specified size and relocation information, return a section that it
624 /// should be placed in.
625 virtual const Section *
626 getSectionForMergableConstant(uint64_t Size, unsigned ReloInfo) const;
629 /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend
630 /// onto a global's name in order to get the unique section name for the
631 /// global. This is important for globals that need to be merged across
632 /// translation units.
634 getSectionPrefixForUniqueGlobal(SectionKind Kind) const {
638 /// getFlagsForNamedSection - If this target wants to be able to infer
639 /// section flags based on the name of the section specified for a global
640 /// variable, it can implement this. This is used on ELF systems so that
641 /// ".tbss" gets the TLS bit set etc.
642 virtual unsigned getFlagsForNamedSection(const char *Section) const {
646 /// SectionForGlobal - This method computes the appropriate section to emit
647 /// the specified global variable or function definition. This should not
648 /// be passed external (or available externally) globals.
649 // FIXME: MOVE TO ASMPRINTER.
650 const Section* SectionForGlobal(const GlobalValue *GV) const;
652 /// getSpecialCasedSectionGlobals - Allow the target to completely override
653 /// section assignment of a global.
654 /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
655 /// getFlagsForNamedSection.
656 virtual const Section *
657 getSpecialCasedSectionGlobals(const GlobalValue *GV,
658 SectionKind Kind) const {
662 const std::string &getSectionFlags(unsigned Flags) const;
663 virtual std::string printSectionFlags(unsigned flags) const { return ""; }
665 // FIXME: Eliminate this.
666 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
667 SectionKind Kind) const;
669 /// getSLEB128Size - Compute the number of bytes required for a signed
671 static unsigned getSLEB128Size(int Value);
673 /// getULEB128Size - Compute the number of bytes required for an unsigned
675 static unsigned getULEB128Size(unsigned Value);
677 // Data directive accessors.
679 const char *getData8bitsDirective(unsigned AS = 0) const {
680 return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
682 const char *getData16bitsDirective(unsigned AS = 0) const {
683 return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
685 const char *getData32bitsDirective(unsigned AS = 0) const {
686 return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
688 const char *getData64bitsDirective(unsigned AS = 0) const {
689 return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
695 const Section *getTextSection() const {
698 const Section *getDataSection() const {
701 const char *getBSSSection() const {
704 const Section *getBSSSection_() const {
707 const Section *getReadOnlySection() const {
708 return ReadOnlySection;
710 const Section *getTLSDataSection() const {
711 return TLSDataSection;
713 const Section *getTLSBSSSection() const {
714 return TLSBSSSection;
716 const char *getZeroFillDirective() const {
717 return ZeroFillDirective;
719 const char *getNonexecutableStackDirective() const {
720 return NonexecutableStackDirective;
722 bool needsSet() const {
725 const char *getPCSymbol() const {
728 char getSeparatorChar() const {
729 return SeparatorChar;
731 unsigned getCommentColumn() const {
732 return CommentColumn;
734 const char *getCommentString() const {
735 return CommentString;
737 unsigned getOperandColumn(int operand) const {
738 return FirstOperandColumn + (MaxOperandLength+1)*(operand-1);
740 const char *getGlobalPrefix() const {
743 const char *getPrivateGlobalPrefix() const {
744 return PrivateGlobalPrefix;
746 const char *getLinkerPrivateGlobalPrefix() const {
747 return LinkerPrivateGlobalPrefix;
749 const char *getJumpTableSpecialLabelPrefix() const {
750 return JumpTableSpecialLabelPrefix;
752 const char *getGlobalVarAddrPrefix() const {
753 return GlobalVarAddrPrefix;
755 const char *getGlobalVarAddrSuffix() const {
756 return GlobalVarAddrSuffix;
758 const char *getFunctionAddrPrefix() const {
759 return FunctionAddrPrefix;
761 const char *getFunctionAddrSuffix() const {
762 return FunctionAddrSuffix;
764 const char *getPersonalityPrefix() const {
765 return PersonalityPrefix;
767 const char *getPersonalitySuffix() const {
768 return PersonalitySuffix;
770 bool getNeedsIndirectEncoding() const {
771 return NeedsIndirectEncoding;
773 const char *getInlineAsmStart() const {
774 return InlineAsmStart;
776 const char *getInlineAsmEnd() const {
779 unsigned getAssemblerDialect() const {
780 return AssemblerDialect;
782 bool doesAllowQuotesInName() const {
783 return AllowQuotesInName;
785 const char *getZeroDirective() const {
786 return ZeroDirective;
788 const char *getZeroDirectiveSuffix() const {
789 return ZeroDirectiveSuffix;
791 const char *getAsciiDirective() const {
792 return AsciiDirective;
794 const char *getAscizDirective() const {
795 return AscizDirective;
797 const char *getJumpTableDirective() const {
798 return JumpTableDirective;
800 const char *getAlignDirective() const {
801 return AlignDirective;
803 bool getAlignmentIsInBytes() const {
804 return AlignmentIsInBytes;
806 unsigned getTextAlignFillValue() const {
807 return TextAlignFillValue;
809 const char *getSwitchToSectionDirective() const {
810 return SwitchToSectionDirective;
812 const char *getTextSectionStartSuffix() const {
813 return TextSectionStartSuffix;
815 const char *getDataSectionStartSuffix() const {
816 return DataSectionStartSuffix;
818 const char *getSectionEndDirectiveSuffix() const {
819 return SectionEndDirectiveSuffix;
821 const char *getConstantPoolSection() const {
822 return ConstantPoolSection;
824 const char *getJumpTableDataSection() const {
825 return JumpTableDataSection;
827 const char *getCStringSection() const {
828 return CStringSection;
830 const Section *getCStringSection_() const {
831 return CStringSection_;
833 const char *getStaticCtorsSection() const {
834 return StaticCtorsSection;
836 const char *getStaticDtorsSection() const {
837 return StaticDtorsSection;
839 const char *getGlobalDirective() const {
840 return GlobalDirective;
842 const char *getExternDirective() const {
843 return ExternDirective;
845 const char *getSetDirective() const {
848 const char *getLCOMMDirective() const {
849 return LCOMMDirective;
851 const char *getCOMMDirective() const {
852 return COMMDirective;
854 bool getCOMMDirectiveTakesAlignment() const {
855 return COMMDirectiveTakesAlignment;
857 bool hasDotTypeDotSizeDirective() const {
858 return HasDotTypeDotSizeDirective;
860 bool hasSingleParameterDotFile() const {
861 return HasSingleParameterDotFile;
863 const char *getUsedDirective() const {
864 return UsedDirective;
866 const char *getWeakRefDirective() const {
867 return WeakRefDirective;
869 const char *getWeakDefDirective() const {
870 return WeakDefDirective;
872 const char *getHiddenDirective() const {
873 return HiddenDirective;
875 const char *getProtectedDirective() const {
876 return ProtectedDirective;
878 bool isAbsoluteDebugSectionOffsets() const {
879 return AbsoluteDebugSectionOffsets;
881 bool isAbsoluteEHSectionOffsets() const {
882 return AbsoluteEHSectionOffsets;
884 bool hasLEB128() const {
887 bool hasDotLocAndDotFile() const {
888 return HasDotLocAndDotFile;
890 bool doesSupportDebugInformation() const {
891 return SupportsDebugInformation;
893 bool doesSupportExceptionHandling() const {
894 return SupportsExceptionHandling;
896 bool doesDwarfRequireFrameSection() const {
897 return DwarfRequiresFrameSection;
899 bool doesDwarfUsesInlineInfoSection() const {
900 return DwarfUsesInlineInfoSection;
902 bool is_EHSymbolPrivate() const {
903 return Is_EHSymbolPrivate;
905 const char *getGlobalEHDirective() const {
906 return GlobalEHDirective;
908 bool getSupportsWeakOmittedEHFrame() const {
909 return SupportsWeakOmittedEHFrame;
911 const char *getDwarfSectionOffsetDirective() const {
912 return DwarfSectionOffsetDirective;
914 const char *getDwarfAbbrevSection() const {
915 return DwarfAbbrevSection;
917 const char *getDwarfInfoSection() const {
918 return DwarfInfoSection;
920 const char *getDwarfLineSection() const {
921 return DwarfLineSection;
923 const char *getDwarfFrameSection() const {
924 return DwarfFrameSection;
926 const char *getDwarfPubNamesSection() const {
927 return DwarfPubNamesSection;
929 const char *getDwarfPubTypesSection() const {
930 return DwarfPubTypesSection;
932 const char *getDwarfDebugInlineSection() const {
933 return DwarfDebugInlineSection;
935 const char *getDwarfStrSection() const {
936 return DwarfStrSection;
938 const char *getDwarfLocSection() const {
939 return DwarfLocSection;
941 const char *getDwarfARangesSection() const {
942 return DwarfARangesSection;
944 const char *getDwarfRangesSection() const {
945 return DwarfRangesSection;
947 const char *getDwarfMacroInfoSection() const {
948 return DwarfMacroInfoSection;
950 const char *getDwarfEHFrameSection() const {
951 return DwarfEHFrameSection;
953 const char *getDwarfExceptionSection() const {
954 return DwarfExceptionSection;
956 const char *const *getAsmCBE() const {