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 {
64 return (K == SectionKind::ROData ||
65 K == SectionKind::DataRelRO ||
66 K == SectionKind::DataRelROLocal ||
67 K == SectionKind::RODataMergeConst ||
68 K == SectionKind::RODataMergeStr);
72 return K == BSS || K == ThreadBSS;
76 return K == ThreadData || K == ThreadBSS;
83 bool isWritable() const {
85 K == SectionKind::Data ||
86 K == SectionKind::DataRel ||
87 K == SectionKind::DataRelLocal ||
88 K == SectionKind::DataRelRO ||
89 K == SectionKind::DataRelROLocal ||
90 K == SectionKind::BSS;
93 static SectionKind get(Kind K) {
94 SectionKind Res = { K };
97 static SectionKind getText() { return get(Text); }
98 static SectionKind getBSS() { return get(BSS); }
99 static SectionKind getData() { return get(Data); }
100 static SectionKind getDataRel() { return get(DataRel); }
101 static SectionKind getDataRelLocal() { return get(DataRelLocal); }
102 static SectionKind getROData() { return get(ROData); }
103 static SectionKind getDataRelRO() { return get(DataRelRO); }
104 static SectionKind getDataRelROLocal() { return get(DataRelROLocal); }
105 static SectionKind getRODataMergeStr() { return get(RODataMergeStr); }
106 static SectionKind getRODataMergeConst() { return get(RODataMergeConst); }
107 static SectionKind getThreadData() { return get(ThreadData); }
108 static SectionKind getThreadBSS() { return get(ThreadBSS); }
111 namespace SectionFlags {
112 const unsigned Invalid = -1U;
113 const unsigned None = 0;
114 const unsigned Code = 1 << 0; ///< Section contains code
115 const unsigned Writable = 1 << 1; ///< Section is writable
116 const unsigned BSS = 1 << 2; ///< Section contains only zeroes
117 const unsigned Mergeable = 1 << 3; ///< Section contains mergeable data
118 const unsigned Strings = 1 << 4; ///< Section contains C-type strings
119 const unsigned TLS = 1 << 5; ///< Section contains thread-local data
120 const unsigned Debug = 1 << 6; ///< Section contains debug data
121 const unsigned Linkonce = 1 << 7; ///< Section is linkonce
122 const unsigned TypeFlags = 0xFF;
123 // Some gap for future flags
125 /// Named - True if this section should be printed with ".section <name>",
126 /// false if the section name is something like ".const".
127 const unsigned Named = 1 << 23; ///< Section is named
128 const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
130 static inline unsigned getEntitySize(unsigned Flags) {
131 return (Flags >> 24) & 0xFF;
134 // FIXME: Why does this return a value?
135 static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
136 return (Flags & ~EntitySize) | ((Size & 0xFF) << 24);
140 static inline unsigned getEmptyKey() { return Invalid; }
141 static inline unsigned getTombstoneKey() { return Invalid - 1; }
142 static unsigned getHashValue(const unsigned &Key) { return Key; }
143 static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
144 static bool isPod() { return true; }
147 typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
157 friend class TargetAsmInfo;
158 friend class StringMapEntry<Section>;
159 friend class StringMap<Section>;
163 explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
167 unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
169 const std::string &getName() const { return Name; }
170 unsigned getFlags() const { return Flags; }
172 bool hasFlag(unsigned F) const { return (Flags & F) != 0; }
175 /// TargetAsmInfo - This class is intended to be used as a base class for asm
176 /// properties and features specific to the target.
177 class TargetAsmInfo {
179 mutable StringMap<Section> Sections;
180 mutable SectionFlags::FlagsStringsMapType FlagsStrings;
182 /// TM - The current TargetMachine.
183 const TargetMachine &TM;
185 //===------------------------------------------------------------------===//
186 // Properties to be set by the target writer, used to configure asm printer.
189 /// TextSection - Section directive for standard text.
191 const Section *TextSection; // Defaults to ".text".
193 /// DataSection - Section directive for standard data.
195 const Section *DataSection; // Defaults to ".data".
197 /// BSSSection - Section directive for uninitialized data. Null if this
198 /// target doesn't support a BSS section.
200 const char *BSSSection; // Default to ".bss".
201 const Section *BSSSection_;
203 /// ReadOnlySection - This is the directive that is emitted to switch to a
204 /// read-only section for constant data (e.g. data declared const,
206 const Section *ReadOnlySection; // Defaults to NULL
208 /// TLSDataSection - Section directive for Thread Local data.
210 const Section *TLSDataSection; // Defaults to ".tdata".
212 /// TLSBSSSection - Section directive for Thread Local uninitialized data.
213 /// Null if this target doesn't support a BSS section.
215 const Section *TLSBSSSection; // Defaults to ".tbss".
217 /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
218 /// section on this target. Null if this target doesn't support zerofill.
219 const char *ZeroFillDirective; // Default is null.
221 /// NonexecutableStackDirective - Directive for declaring to the
222 /// linker and beyond that the emitted code does not require stack
223 /// memory to be executable.
224 const char *NonexecutableStackDirective; // Default is null.
226 /// NeedsSet - True if target asm treats expressions in data directives
227 /// as linktime-relocatable. For assembly-time computation, we need to
228 /// use a .set. Thus:
231 /// is computed at assembly time, while
233 /// is relocated if the relative locations of x and y change at linktime.
234 /// We want both these things in different places.
235 bool NeedsSet; // Defaults to false.
237 /// MaxInstLength - This is the maximum possible length of an instruction,
238 /// which is needed to compute the size of an inline asm.
239 unsigned MaxInstLength; // Defaults to 4.
241 /// PCSymbol - The symbol used to represent the current PC. Used in PC
242 /// relative expressions.
243 const char *PCSymbol; // Defaults to "$".
245 /// SeparatorChar - This character, if specified, is used to separate
246 /// instructions from each other when on the same line. This is used to
247 /// measure inline asm instructions.
248 char SeparatorChar; // Defaults to ';'
250 /// CommentColumn - This indicates the comment num (zero-based) at
251 /// which asm comments should be printed.
252 unsigned CommentColumn; // Defaults to 60
254 /// CommentString - This indicates the comment character used by the
256 const char *CommentString; // Defaults to "#"
258 /// FirstOperandColumn - The output column where the first operand
259 /// should be printed
260 unsigned FirstOperandColumn; // Defaults to 0 (ignored)
262 /// MaxOperandLength - The maximum length of any printed asm
264 unsigned MaxOperandLength; // Defaults to 0 (ignored)
266 /// GlobalPrefix - If this is set to a non-empty string, it is prepended
267 /// onto all global symbols. This is often used for "_" or ".".
268 const char *GlobalPrefix; // Defaults to ""
270 /// PrivateGlobalPrefix - This prefix is used for globals like constant
271 /// pool entries that are completely private to the .s file and should not
272 /// have names in the .o file. This is often "." or "L".
273 const char *PrivateGlobalPrefix; // Defaults to "."
275 /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
276 /// be passed through the assembler but be removed by the linker. This
277 /// is "l" on Darwin, currently used for some ObjC metadata.
278 const char *LinkerPrivateGlobalPrefix; // Defaults to ""
280 /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
281 /// emitted before jump tables with the specified prefix.
282 const char *JumpTableSpecialLabelPrefix; // Default to null.
284 /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
285 /// will enclose any GlobalVariable (that isn't a function)
287 const char *GlobalVarAddrPrefix; // Defaults to ""
288 const char *GlobalVarAddrSuffix; // Defaults to ""
290 /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
291 /// will enclose any GlobalVariable that points to a function.
293 const char *FunctionAddrPrefix; // Defaults to ""
294 const char *FunctionAddrSuffix; // Defaults to ""
296 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
297 /// enclose any personality function in the common frame section.
299 const char *PersonalityPrefix; // Defaults to ""
300 const char *PersonalitySuffix; // Defaults to ""
302 /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
305 bool NeedsIndirectEncoding; // Defaults to false
307 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
308 /// emit before and after an inline assembly statement.
309 const char *InlineAsmStart; // Defaults to "#APP\n"
310 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
312 /// AssemblerDialect - Which dialect of an assembler variant to use.
313 unsigned AssemblerDialect; // Defaults to 0
315 /// AllowQuotesInName - This is true if the assembler allows for complex
316 /// symbol names to be surrounded in quotes. This defaults to false.
317 bool AllowQuotesInName;
319 //===--- Data Emission Directives -------------------------------------===//
321 /// ZeroDirective - this should be set to the directive used to get some
322 /// number of zero bytes emitted to the current section. Common cases are
323 /// "\t.zero\t" and "\t.space\t". If this is set to null, the
324 /// Data*bitsDirective's will be used to emit zero bytes.
325 const char *ZeroDirective; // Defaults to "\t.zero\t"
326 const char *ZeroDirectiveSuffix; // Defaults to ""
328 /// AsciiDirective - This directive allows emission of an ascii string with
329 /// the standard C escape characters embedded into it.
330 const char *AsciiDirective; // Defaults to "\t.ascii\t"
332 /// AscizDirective - If not null, this allows for special handling of
333 /// zero terminated strings on this target. This is commonly supported as
334 /// ".asciz". If a target doesn't support this, it can be set to null.
335 const char *AscizDirective; // Defaults to "\t.asciz\t"
337 /// DataDirectives - These directives are used to output some unit of
338 /// integer data to the current section. If a data directive is set to
339 /// null, smaller data directives will be used to emit the large sizes.
340 const char *Data8bitsDirective; // Defaults to "\t.byte\t"
341 const char *Data16bitsDirective; // Defaults to "\t.short\t"
342 const char *Data32bitsDirective; // Defaults to "\t.long\t"
343 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
345 /// getDataASDirective - Return the directive that should be used to emit
346 /// data of the specified size to the specified numeric address space.
347 virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
348 assert(AS != 0 && "Don't know the directives for default addr space");
352 //===--- Alignment Information ----------------------------------------===//
354 /// AlignDirective - The directive used to emit round up to an alignment
357 const char *AlignDirective; // Defaults to "\t.align\t"
359 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
360 /// emits ".align N" directives, where N is the number of bytes to align to.
361 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
363 bool AlignmentIsInBytes; // Defaults to true
365 /// TextAlignFillValue - If non-zero, this is used to fill the executable
366 /// space created as the result of a alignment directive.
367 unsigned TextAlignFillValue;
369 //===--- Section Switching Directives ---------------------------------===//
371 /// SwitchToSectionDirective - This is the directive used when we want to
372 /// emit a global to an arbitrary section. The section name is emited after
374 const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
376 /// TextSectionStartSuffix - This is printed after each start of section
377 /// directive for text sections.
378 const char *TextSectionStartSuffix; // Defaults to "".
380 /// DataSectionStartSuffix - This is printed after each start of section
381 /// directive for data sections.
382 const char *DataSectionStartSuffix; // Defaults to "".
384 /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
385 /// section with the section name and this suffix printed.
386 const char *SectionEndDirectiveSuffix;// Defaults to null.
388 /// ConstantPoolSection - This is the section that we SwitchToSection right
389 /// before emitting the constant pool for a function.
390 const char *ConstantPoolSection; // Defaults to "\t.section .rodata"
392 /// JumpTableDataSection - This is the section that we SwitchToSection right
393 /// before emitting the jump tables for a function when the relocation model
395 const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
397 /// JumpTableDirective - if non-null, the directive to emit before a jump
399 const char *JumpTableDirective;
401 /// CStringSection - If not null, this allows for special handling of
402 /// cstring constants (null terminated string that does not contain any
403 /// other null bytes) on this target. This is commonly supported as
405 const char *CStringSection; // Defaults to NULL
406 const Section *CStringSection_;
408 /// StaticCtorsSection - This is the directive that is emitted to switch to
409 /// a section to emit the static constructor list.
410 /// Defaults to "\t.section .ctors,\"aw\",@progbits".
411 const char *StaticCtorsSection;
413 /// StaticDtorsSection - This is the directive that is emitted to switch to
414 /// a section to emit the static destructor list.
415 /// Defaults to "\t.section .dtors,\"aw\",@progbits".
416 const char *StaticDtorsSection;
418 //===--- Global Variable Emission Directives --------------------------===//
420 /// GlobalDirective - This is the directive used to declare a global entity.
422 const char *GlobalDirective; // Defaults to NULL.
424 /// ExternDirective - This is the directive used to declare external
427 const char *ExternDirective; // Defaults to NULL.
429 /// SetDirective - This is the name of a directive that can be used to tell
430 /// the assembler to set the value of a variable to some expression.
431 const char *SetDirective; // Defaults to null.
433 /// LCOMMDirective - This is the name of a directive (if supported) that can
434 /// be used to efficiently declare a local (internal) block of zero
435 /// initialized data in the .bss/.data section. The syntax expected is:
436 /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
438 const char *LCOMMDirective; // Defaults to null.
440 const char *COMMDirective; // Defaults to "\t.comm\t".
442 /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
443 /// argument that specifies the alignment of the declaration.
444 bool COMMDirectiveTakesAlignment; // Defaults to true.
446 /// HasDotTypeDotSizeDirective - True if the target has .type and .size
447 /// directives, this is true for most ELF targets.
448 bool HasDotTypeDotSizeDirective; // Defaults to true.
450 /// HasSingleParameterDotFile - True if the target has a single parameter
451 /// .file directive, this is true for ELF targets.
452 bool HasSingleParameterDotFile; // Defaults to true.
454 /// UsedDirective - This directive, if non-null, is used to declare a global
455 /// as being used somehow that the assembler can't see. This prevents dead
456 /// code elimination on some targets.
457 const char *UsedDirective; // Defaults to null.
459 /// WeakRefDirective - This directive, if non-null, is used to declare a
460 /// global as being a weak undefined symbol.
461 const char *WeakRefDirective; // Defaults to null.
463 /// WeakDefDirective - This directive, if non-null, is used to declare a
464 /// global as being a weak defined symbol.
465 const char *WeakDefDirective; // Defaults to null.
467 /// HiddenDirective - This directive, if non-null, is used to declare a
468 /// global or function as having hidden visibility.
469 const char *HiddenDirective; // Defaults to "\t.hidden\t".
471 /// ProtectedDirective - This directive, if non-null, is used to declare a
472 /// global or function as having protected visibility.
473 const char *ProtectedDirective; // Defaults to "\t.protected\t".
475 //===--- Dwarf Emission Directives -----------------------------------===//
477 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
478 /// offsets for debug information. Defaults to false.
479 bool AbsoluteDebugSectionOffsets;
481 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
482 /// offsets for EH information. Defaults to false.
483 bool AbsoluteEHSectionOffsets;
485 /// HasLEB128 - True if target asm supports leb128 directives.
487 bool HasLEB128; // Defaults to false.
489 /// hasDotLocAndDotFile - True if target asm supports .loc and .file
490 /// directives for emitting debugging information.
492 bool HasDotLocAndDotFile; // Defaults to false.
494 /// SupportsDebugInformation - True if target supports emission of debugging
496 bool SupportsDebugInformation;
498 /// SupportsExceptionHandling - True if target supports
499 /// exception handling.
501 bool SupportsExceptionHandling; // Defaults to false.
503 /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
505 bool DwarfRequiresFrameSection; // Defaults to true.
507 /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
508 /// encode inline subroutine information.
509 bool DwarfUsesInlineInfoSection; // Defaults to false.
511 /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
512 /// doesn't show up in the symbol table of the object file.
513 bool Is_EHSymbolPrivate; // Defaults to true.
515 /// GlobalEHDirective - This is the directive used to make exception frame
516 /// tables globally visible.
518 const char *GlobalEHDirective; // Defaults to NULL.
520 /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
521 /// handle a weak_definition of constant 0 for an omitted EH frame.
522 bool SupportsWeakOmittedEHFrame; // Defaults to true.
524 /// DwarfSectionOffsetDirective - Special section offset directive.
525 const char* DwarfSectionOffsetDirective; // Defaults to NULL
527 /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
529 const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
531 /// DwarfInfoSection - Section directive for Dwarf info.
533 const char *DwarfInfoSection; // Defaults to ".debug_info".
535 /// DwarfLineSection - Section directive for Dwarf info.
537 const char *DwarfLineSection; // Defaults to ".debug_line".
539 /// DwarfFrameSection - Section directive for Dwarf info.
541 const char *DwarfFrameSection; // Defaults to ".debug_frame".
543 /// DwarfPubNamesSection - Section directive for Dwarf info.
545 const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
547 /// DwarfPubTypesSection - Section directive for Dwarf info.
549 const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
551 /// DwarfDebugInlineSection - Section directive for inline info.
553 const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined"
555 /// DwarfStrSection - Section directive for Dwarf info.
557 const char *DwarfStrSection; // Defaults to ".debug_str".
559 /// DwarfLocSection - Section directive for Dwarf info.
561 const char *DwarfLocSection; // Defaults to ".debug_loc".
563 /// DwarfARangesSection - Section directive for Dwarf info.
565 const char *DwarfARangesSection; // Defaults to ".debug_aranges".
567 /// DwarfRangesSection - Section directive for Dwarf info.
569 const char *DwarfRangesSection; // Defaults to ".debug_ranges".
571 /// DwarfMacroInfoSection - Section directive for DWARF macro info.
573 const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo".
575 /// DwarfEHFrameSection - Section directive for Exception frames.
577 const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
579 /// DwarfExceptionSection - Section directive for Exception table.
581 const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
583 //===--- CBE Asm Translation Table -----------------------------------===//
585 const char *const *AsmTransCBE; // Defaults to empty
588 explicit TargetAsmInfo(const TargetMachine &TM);
589 virtual ~TargetAsmInfo();
591 const Section* getNamedSection(const char *Name,
592 unsigned Flags = SectionFlags::None,
593 bool Override = false) const;
594 const Section* getUnnamedSection(const char *Directive,
595 unsigned Flags = SectionFlags::None,
596 bool Override = false) const;
598 /// Measure the specified inline asm to determine an approximation of its
600 virtual unsigned getInlineAsmLength(const char *Str) const;
602 /// emitUsedDirectiveFor - This hook allows targets to selectively decide
603 /// not to emit the UsedDirective for some symbols in llvm.used.
604 // FIXME: REMOVE this (rdar://7071300)
605 virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
606 Mangler *Mang) const {
610 /// PreferredEHDataFormat - This hook allows the target to select data
611 /// format used for encoding pointers in exception handling data. Reason is
612 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
613 /// if the symbol can be relocated.
614 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
618 /// getSectionForMergableConstant - Given a mergable constant with the
619 /// specified size and relocation information, return a section that it
620 /// should be placed in.
621 virtual const Section *
622 getSectionForMergableConstant(uint64_t Size, unsigned ReloInfo) const;
625 /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend
626 /// onto a global's name in order to get the unique section name for the
627 /// global. This is important for globals that need to be merged across
628 /// translation units.
630 getSectionPrefixForUniqueGlobal(SectionKind Kind) const {
634 /// getFlagsForNamedSection - If this target wants to be able to infer
635 /// section flags based on the name of the section specified for a global
636 /// variable, it can implement this. This is used on ELF systems so that
637 /// ".tbss" gets the TLS bit set etc.
638 virtual unsigned getFlagsForNamedSection(const char *Section) const {
642 /// SectionForGlobal - This method computes the appropriate section to emit
643 /// the specified global variable or function definition. This should not
644 /// be passed external (or available externally) globals.
645 // FIXME: MOVE TO ASMPRINTER.
646 const Section* SectionForGlobal(const GlobalValue *GV) const;
648 /// getSpecialCasedSectionGlobals - Allow the target to completely override
649 /// section assignment of a global.
650 /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
651 /// getFlagsForNamedSection.
652 virtual const Section *
653 getSpecialCasedSectionGlobals(const GlobalValue *GV,
654 SectionKind Kind) const {
658 const std::string &getSectionFlags(unsigned Flags) const;
659 virtual std::string printSectionFlags(unsigned flags) const { return ""; }
661 // FIXME: Eliminate this.
662 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
663 SectionKind Kind) const;
665 /// getSLEB128Size - Compute the number of bytes required for a signed
667 static unsigned getSLEB128Size(int Value);
669 /// getULEB128Size - Compute the number of bytes required for an unsigned
671 static unsigned getULEB128Size(unsigned Value);
673 // Data directive accessors.
675 const char *getData8bitsDirective(unsigned AS = 0) const {
676 return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
678 const char *getData16bitsDirective(unsigned AS = 0) const {
679 return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
681 const char *getData32bitsDirective(unsigned AS = 0) const {
682 return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
684 const char *getData64bitsDirective(unsigned AS = 0) const {
685 return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
691 const Section *getTextSection() const {
694 const Section *getDataSection() const {
697 const char *getBSSSection() const {
700 const Section *getBSSSection_() const {
703 const Section *getReadOnlySection() const {
704 return ReadOnlySection;
706 const Section *getTLSDataSection() const {
707 return TLSDataSection;
709 const Section *getTLSBSSSection() const {
710 return TLSBSSSection;
712 const char *getZeroFillDirective() const {
713 return ZeroFillDirective;
715 const char *getNonexecutableStackDirective() const {
716 return NonexecutableStackDirective;
718 bool needsSet() const {
721 const char *getPCSymbol() const {
724 char getSeparatorChar() const {
725 return SeparatorChar;
727 unsigned getCommentColumn() const {
728 return CommentColumn;
730 const char *getCommentString() const {
731 return CommentString;
733 unsigned getOperandColumn(int operand) const {
734 return FirstOperandColumn + (MaxOperandLength+1)*(operand-1);
736 const char *getGlobalPrefix() const {
739 const char *getPrivateGlobalPrefix() const {
740 return PrivateGlobalPrefix;
742 const char *getLinkerPrivateGlobalPrefix() const {
743 return LinkerPrivateGlobalPrefix;
745 const char *getJumpTableSpecialLabelPrefix() const {
746 return JumpTableSpecialLabelPrefix;
748 const char *getGlobalVarAddrPrefix() const {
749 return GlobalVarAddrPrefix;
751 const char *getGlobalVarAddrSuffix() const {
752 return GlobalVarAddrSuffix;
754 const char *getFunctionAddrPrefix() const {
755 return FunctionAddrPrefix;
757 const char *getFunctionAddrSuffix() const {
758 return FunctionAddrSuffix;
760 const char *getPersonalityPrefix() const {
761 return PersonalityPrefix;
763 const char *getPersonalitySuffix() const {
764 return PersonalitySuffix;
766 bool getNeedsIndirectEncoding() const {
767 return NeedsIndirectEncoding;
769 const char *getInlineAsmStart() const {
770 return InlineAsmStart;
772 const char *getInlineAsmEnd() const {
775 unsigned getAssemblerDialect() const {
776 return AssemblerDialect;
778 bool doesAllowQuotesInName() const {
779 return AllowQuotesInName;
781 const char *getZeroDirective() const {
782 return ZeroDirective;
784 const char *getZeroDirectiveSuffix() const {
785 return ZeroDirectiveSuffix;
787 const char *getAsciiDirective() const {
788 return AsciiDirective;
790 const char *getAscizDirective() const {
791 return AscizDirective;
793 const char *getJumpTableDirective() const {
794 return JumpTableDirective;
796 const char *getAlignDirective() const {
797 return AlignDirective;
799 bool getAlignmentIsInBytes() const {
800 return AlignmentIsInBytes;
802 unsigned getTextAlignFillValue() const {
803 return TextAlignFillValue;
805 const char *getSwitchToSectionDirective() const {
806 return SwitchToSectionDirective;
808 const char *getTextSectionStartSuffix() const {
809 return TextSectionStartSuffix;
811 const char *getDataSectionStartSuffix() const {
812 return DataSectionStartSuffix;
814 const char *getSectionEndDirectiveSuffix() const {
815 return SectionEndDirectiveSuffix;
817 const char *getConstantPoolSection() const {
818 return ConstantPoolSection;
820 const char *getJumpTableDataSection() const {
821 return JumpTableDataSection;
823 const char *getCStringSection() const {
824 return CStringSection;
826 const Section *getCStringSection_() const {
827 return CStringSection_;
829 const char *getStaticCtorsSection() const {
830 return StaticCtorsSection;
832 const char *getStaticDtorsSection() const {
833 return StaticDtorsSection;
835 const char *getGlobalDirective() const {
836 return GlobalDirective;
838 const char *getExternDirective() const {
839 return ExternDirective;
841 const char *getSetDirective() const {
844 const char *getLCOMMDirective() const {
845 return LCOMMDirective;
847 const char *getCOMMDirective() const {
848 return COMMDirective;
850 bool getCOMMDirectiveTakesAlignment() const {
851 return COMMDirectiveTakesAlignment;
853 bool hasDotTypeDotSizeDirective() const {
854 return HasDotTypeDotSizeDirective;
856 bool hasSingleParameterDotFile() const {
857 return HasSingleParameterDotFile;
859 const char *getUsedDirective() const {
860 return UsedDirective;
862 const char *getWeakRefDirective() const {
863 return WeakRefDirective;
865 const char *getWeakDefDirective() const {
866 return WeakDefDirective;
868 const char *getHiddenDirective() const {
869 return HiddenDirective;
871 const char *getProtectedDirective() const {
872 return ProtectedDirective;
874 bool isAbsoluteDebugSectionOffsets() const {
875 return AbsoluteDebugSectionOffsets;
877 bool isAbsoluteEHSectionOffsets() const {
878 return AbsoluteEHSectionOffsets;
880 bool hasLEB128() const {
883 bool hasDotLocAndDotFile() const {
884 return HasDotLocAndDotFile;
886 bool doesSupportDebugInformation() const {
887 return SupportsDebugInformation;
889 bool doesSupportExceptionHandling() const {
890 return SupportsExceptionHandling;
892 bool doesDwarfRequireFrameSection() const {
893 return DwarfRequiresFrameSection;
895 bool doesDwarfUsesInlineInfoSection() const {
896 return DwarfUsesInlineInfoSection;
898 bool is_EHSymbolPrivate() const {
899 return Is_EHSymbolPrivate;
901 const char *getGlobalEHDirective() const {
902 return GlobalEHDirective;
904 bool getSupportsWeakOmittedEHFrame() const {
905 return SupportsWeakOmittedEHFrame;
907 const char *getDwarfSectionOffsetDirective() const {
908 return DwarfSectionOffsetDirective;
910 const char *getDwarfAbbrevSection() const {
911 return DwarfAbbrevSection;
913 const char *getDwarfInfoSection() const {
914 return DwarfInfoSection;
916 const char *getDwarfLineSection() const {
917 return DwarfLineSection;
919 const char *getDwarfFrameSection() const {
920 return DwarfFrameSection;
922 const char *getDwarfPubNamesSection() const {
923 return DwarfPubNamesSection;
925 const char *getDwarfPubTypesSection() const {
926 return DwarfPubTypesSection;
928 const char *getDwarfDebugInlineSection() const {
929 return DwarfDebugInlineSection;
931 const char *getDwarfStrSection() const {
932 return DwarfStrSection;
934 const char *getDwarfLocSection() const {
935 return DwarfLocSection;
937 const char *getDwarfARangesSection() const {
938 return DwarfARangesSection;
940 const char *getDwarfRangesSection() const {
941 return DwarfRangesSection;
943 const char *getDwarfMacroInfoSection() const {
944 return DwarfMacroInfoSection;
946 const char *getDwarfEHFrameSection() const {
947 return DwarfEHFrameSection;
949 const char *getDwarfExceptionSection() const {
950 return DwarfExceptionSection;
952 const char *const *getAsmCBE() const {