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/StringMap.h"
20 #include "llvm/Support/DataTypes.h"
24 template <typename T> class SmallVectorImpl;
29 // DWARF encoding query type
30 namespace DwarfEncoding {
38 /// SectionKind - This is a simple POD value that classifies the properties of
39 /// a section. A global variable is classified into the deepest possible
40 /// classification, and then the target maps them onto their sections based on
41 /// what capabilities they have.
43 /// The comments below describe these as if they were an inheritance hierarchy
44 /// in order to explain the predicates below.
48 /// Metadata - Debug info sections or other metadata.
51 /// Text - Text section, used for functions and other executable code.
54 /// ReadOnly - Data that is never written to at program runtime by the
55 /// program or the dynamic linker. Things in the top-level readonly
56 /// SectionKind are not mergeable.
59 /// MergeableCString - This is a special section for nul-terminated
60 /// strings. The linker can unique the C strings, knowing their
61 /// semantics. Because it uniques based on the nul terminators, the
62 /// compiler can't put strings in this section that have embeded nuls
66 /// MergeableConst - These are sections for merging fixed-length
67 /// constants together. For example, this can be used to unique
68 /// constant pool entries etc.
71 /// MergeableConst4 - This is a section used by 4-byte constants,
72 /// for example, floats.
75 /// MergeableConst8 - This is a section used by 8-byte constants,
76 /// for example, doubles.
79 /// MergeableConst16 - This is a section used by 16-byte constants,
80 /// for example, vectors.
83 /// Writeable - This is the base of all segments that need to be written
84 /// to during program runtime.
86 /// ThreadLocal - This is the base of all TLS segments. All TLS
87 /// objects must be writeable, otherwise there is no reason for them to
90 /// ThreadBSS - Zero-initialized TLS data objects.
93 /// ThreadData - Initialized TLS data objects.
96 /// GlobalWriteableData - Writeable data that is global (not thread
99 /// BSS - Zero initialized writeable data.
102 /// DataRel - This is the most general form of data that is written
103 /// to by the program, it can have random relocations to arbitrary
107 /// DataRelLocal - This is writeable data that has a non-zero
108 /// initializer and has relocations in it, but all of the
109 /// relocations are known to be within the final linked image
110 /// the global is linked into.
113 /// DataNoRel - This is writeable data that has a non-zero
114 /// initializer, but whose initializer is known to have no
118 /// ReadOnlyWithRel - These are global variables that are never
119 /// written to by the program, but that have relocations, so they
120 /// must be stuck in a writeable section so that the dynamic linker
121 /// can write to them. If it chooses to, the dynamic linker can
122 /// mark the pages these globals end up on as read-only after it is
123 /// done with its relocation phase.
126 /// ReadOnlyWithRelLocal - This is data that is readonly by the
127 /// program, but must be writeable so that the dynamic linker
128 /// can perform relocations in it. This is used when we know
129 /// that all the relocations are to globals in this final
138 /// Weak - This is true if the referenced symbol is weak (i.e. linkonce,
139 /// weak, weak_odr, etc). This is orthogonal from the categorization.
142 /// ExplicitSection - This is true if the global had a section explicitly
144 bool ExplicitSection : 1;
148 Kind getKind() const { return K; }
150 bool isWeak() const { return Weak; }
151 bool hasExplicitSection() const { return ExplicitSection; }
154 bool isMetadata() const { return K == Metadata; }
155 bool isText() const { return K == Text; }
157 bool isReadOnly() const {
158 return K == ReadOnly || K == MergeableCString || isMergeableConst();
161 bool isMergeableCString() const { return K == MergeableCString; }
162 bool isMergeableConst() const {
163 return K == MergeableConst || K == MergeableConst4 ||
164 K == MergeableConst8 || K == MergeableConst16;
167 bool isMergeableConst4() const { return K == MergeableConst4; }
168 bool isMergeableConst8() const { return K == MergeableConst8; }
169 bool isMergeableConst16() const { return K == MergeableConst16; }
171 bool isWriteable() const {
172 return isThreadLocal() || isGlobalWriteableData();
175 bool isThreadLocal() const {
176 return K == ThreadData || K == ThreadBSS;
179 bool isThreadBSS() const { return K == ThreadBSS; }
180 bool isThreadData() const { return K == ThreadData; }
182 bool isGlobalWriteableData() const {
183 return isBSS() || isDataRel() || isReadOnlyWithRel();
186 bool isBSS() const { return K == BSS; }
188 bool isDataRel() const {
189 return K == DataRel || K == DataRelLocal || K == DataNoRel;
192 bool isDataRelLocal() const {
193 return K == DataRelLocal || K == DataNoRel;
196 bool isDataNoRel() const { return K == DataNoRel; }
198 bool isReadOnlyWithRel() const {
199 return K == ReadOnlyWithRel || K == ReadOnlyWithRelLocal;
202 bool isReadOnlyWithRelLocal() const {
203 return K == ReadOnlyWithRelLocal;
206 static SectionKind get(Kind K, bool isWeak = false,
207 bool hasExplicitSection = false) {
211 Res.ExplicitSection = hasExplicitSection;
217 friend class TargetAsmInfo;
218 friend class StringMapEntry<Section>;
219 friend class StringMap<Section>;
223 explicit Section() { }
226 const std::string &getName() const { return Name; }
227 SectionKind getKind() const { return Kind; }
230 /// TargetAsmInfo - This class is intended to be used as a base class for asm
231 /// properties and features specific to the target.
232 class TargetAsmInfo {
234 mutable StringMap<Section> Sections;
236 /// TM - The current TargetMachine.
237 const TargetMachine &TM;
239 //===------------------------------------------------------------------===//
240 // Properties to be set by the target writer, used to configure asm printer.
243 /// TextSection - Section directive for standard text.
245 const Section *TextSection; // Defaults to ".text".
247 /// DataSection - Section directive for standard data.
249 const Section *DataSection; // Defaults to ".data".
251 /// BSSSection - Section directive for uninitialized data. Null if this
252 /// target doesn't support a BSS section.
254 const char *BSSSection; // Default to ".bss".
255 const Section *BSSSection_;
257 /// ReadOnlySection - This is the directive that is emitted to switch to a
258 /// read-only section for constant data (e.g. data declared const,
260 const Section *ReadOnlySection; // Defaults to NULL
262 /// TLSDataSection - Section directive for Thread Local data.
264 const Section *TLSDataSection; // Defaults to ".tdata".
266 /// TLSBSSSection - Section directive for Thread Local uninitialized data.
267 /// Null if this target doesn't support a BSS section.
269 const Section *TLSBSSSection; // Defaults to ".tbss".
271 /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
272 /// section on this target. Null if this target doesn't support zerofill.
273 const char *ZeroFillDirective; // Default is null.
275 /// NonexecutableStackDirective - Directive for declaring to the
276 /// linker and beyond that the emitted code does not require stack
277 /// memory to be executable.
278 const char *NonexecutableStackDirective; // Default is null.
280 /// NeedsSet - True if target asm treats expressions in data directives
281 /// as linktime-relocatable. For assembly-time computation, we need to
282 /// use a .set. Thus:
285 /// is computed at assembly time, while
287 /// is relocated if the relative locations of x and y change at linktime.
288 /// We want both these things in different places.
289 bool NeedsSet; // Defaults to false.
291 /// MaxInstLength - This is the maximum possible length of an instruction,
292 /// which is needed to compute the size of an inline asm.
293 unsigned MaxInstLength; // Defaults to 4.
295 /// PCSymbol - The symbol used to represent the current PC. Used in PC
296 /// relative expressions.
297 const char *PCSymbol; // Defaults to "$".
299 /// SeparatorChar - This character, if specified, is used to separate
300 /// instructions from each other when on the same line. This is used to
301 /// measure inline asm instructions.
302 char SeparatorChar; // Defaults to ';'
304 /// CommentColumn - This indicates the comment num (zero-based) at
305 /// which asm comments should be printed.
306 unsigned CommentColumn; // Defaults to 60
308 /// CommentString - This indicates the comment character used by the
310 const char *CommentString; // Defaults to "#"
312 /// FirstOperandColumn - The output column where the first operand
313 /// should be printed
314 unsigned FirstOperandColumn; // Defaults to 0 (ignored)
316 /// MaxOperandLength - The maximum length of any printed asm
318 unsigned MaxOperandLength; // Defaults to 0 (ignored)
320 /// GlobalPrefix - If this is set to a non-empty string, it is prepended
321 /// onto all global symbols. This is often used for "_" or ".".
322 const char *GlobalPrefix; // Defaults to ""
324 /// PrivateGlobalPrefix - This prefix is used for globals like constant
325 /// pool entries that are completely private to the .s file and should not
326 /// have names in the .o file. This is often "." or "L".
327 const char *PrivateGlobalPrefix; // Defaults to "."
329 /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
330 /// be passed through the assembler but be removed by the linker. This
331 /// is "l" on Darwin, currently used for some ObjC metadata.
332 const char *LinkerPrivateGlobalPrefix; // Defaults to ""
334 /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
335 /// emitted before jump tables with the specified prefix.
336 const char *JumpTableSpecialLabelPrefix; // Default to null.
338 /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
339 /// will enclose any GlobalVariable (that isn't a function)
341 const char *GlobalVarAddrPrefix; // Defaults to ""
342 const char *GlobalVarAddrSuffix; // Defaults to ""
344 /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
345 /// will enclose any GlobalVariable that points to a function.
347 const char *FunctionAddrPrefix; // Defaults to ""
348 const char *FunctionAddrSuffix; // Defaults to ""
350 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
351 /// enclose any personality function in the common frame section.
353 const char *PersonalityPrefix; // Defaults to ""
354 const char *PersonalitySuffix; // Defaults to ""
356 /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
359 bool NeedsIndirectEncoding; // Defaults to false
361 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
362 /// emit before and after an inline assembly statement.
363 const char *InlineAsmStart; // Defaults to "#APP\n"
364 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
366 /// AssemblerDialect - Which dialect of an assembler variant to use.
367 unsigned AssemblerDialect; // Defaults to 0
369 /// AllowQuotesInName - This is true if the assembler allows for complex
370 /// symbol names to be surrounded in quotes. This defaults to false.
371 bool AllowQuotesInName;
373 //===--- Data Emission Directives -------------------------------------===//
375 /// ZeroDirective - this should be set to the directive used to get some
376 /// number of zero bytes emitted to the current section. Common cases are
377 /// "\t.zero\t" and "\t.space\t". If this is set to null, the
378 /// Data*bitsDirective's will be used to emit zero bytes.
379 const char *ZeroDirective; // Defaults to "\t.zero\t"
380 const char *ZeroDirectiveSuffix; // Defaults to ""
382 /// AsciiDirective - This directive allows emission of an ascii string with
383 /// the standard C escape characters embedded into it.
384 const char *AsciiDirective; // Defaults to "\t.ascii\t"
386 /// AscizDirective - If not null, this allows for special handling of
387 /// zero terminated strings on this target. This is commonly supported as
388 /// ".asciz". If a target doesn't support this, it can be set to null.
389 const char *AscizDirective; // Defaults to "\t.asciz\t"
391 /// DataDirectives - These directives are used to output some unit of
392 /// integer data to the current section. If a data directive is set to
393 /// null, smaller data directives will be used to emit the large sizes.
394 const char *Data8bitsDirective; // Defaults to "\t.byte\t"
395 const char *Data16bitsDirective; // Defaults to "\t.short\t"
396 const char *Data32bitsDirective; // Defaults to "\t.long\t"
397 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
399 /// getDataASDirective - Return the directive that should be used to emit
400 /// data of the specified size to the specified numeric address space.
401 virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
402 assert(AS != 0 && "Don't know the directives for default addr space");
406 //===--- Alignment Information ----------------------------------------===//
408 /// AlignDirective - The directive used to emit round up to an alignment
411 const char *AlignDirective; // Defaults to "\t.align\t"
413 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
414 /// emits ".align N" directives, where N is the number of bytes to align to.
415 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
417 bool AlignmentIsInBytes; // Defaults to true
419 /// TextAlignFillValue - If non-zero, this is used to fill the executable
420 /// space created as the result of a alignment directive.
421 unsigned TextAlignFillValue;
423 //===--- Section Switching Directives ---------------------------------===//
425 /// SwitchToSectionDirective - This is the directive used when we want to
426 /// emit a global to an arbitrary section. The section name is emited after
428 const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
430 /// TextSectionStartSuffix - This is printed after each start of section
431 /// directive for text sections.
432 const char *TextSectionStartSuffix; // Defaults to "".
434 /// DataSectionStartSuffix - This is printed after each start of section
435 /// directive for data sections.
436 const char *DataSectionStartSuffix; // Defaults to "".
438 /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
439 /// section with the section name and this suffix printed.
440 const char *SectionEndDirectiveSuffix;// Defaults to null.
442 /// ConstantPoolSection - This is the section that we SwitchToSection right
443 /// before emitting the constant pool for a function.
444 const char *ConstantPoolSection; // Defaults to "\t.section .rodata"
446 /// JumpTableDataSection - This is the section that we SwitchToSection right
447 /// before emitting the jump tables for a function when the relocation model
449 const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
451 /// JumpTableDirective - if non-null, the directive to emit before a jump
453 const char *JumpTableDirective;
455 /// CStringSection - If not null, this allows for special handling of
456 /// cstring constants (null terminated string that does not contain any
457 /// other null bytes) on this target. This is commonly supported as
459 const char *CStringSection; // Defaults to NULL
460 const Section *CStringSection_;
462 /// StaticCtorsSection - This is the directive that is emitted to switch to
463 /// a section to emit the static constructor list.
464 /// Defaults to "\t.section .ctors,\"aw\",@progbits".
465 const char *StaticCtorsSection;
467 /// StaticDtorsSection - This is the directive that is emitted to switch to
468 /// a section to emit the static destructor list.
469 /// Defaults to "\t.section .dtors,\"aw\",@progbits".
470 const char *StaticDtorsSection;
472 //===--- Global Variable Emission Directives --------------------------===//
474 /// GlobalDirective - This is the directive used to declare a global entity.
476 const char *GlobalDirective; // Defaults to NULL.
478 /// ExternDirective - This is the directive used to declare external
481 const char *ExternDirective; // Defaults to NULL.
483 /// SetDirective - This is the name of a directive that can be used to tell
484 /// the assembler to set the value of a variable to some expression.
485 const char *SetDirective; // Defaults to null.
487 /// LCOMMDirective - This is the name of a directive (if supported) that can
488 /// be used to efficiently declare a local (internal) block of zero
489 /// initialized data in the .bss/.data section. The syntax expected is:
490 /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
492 const char *LCOMMDirective; // Defaults to null.
494 const char *COMMDirective; // Defaults to "\t.comm\t".
496 /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
497 /// argument that specifies the alignment of the declaration.
498 bool COMMDirectiveTakesAlignment; // Defaults to true.
500 /// HasDotTypeDotSizeDirective - True if the target has .type and .size
501 /// directives, this is true for most ELF targets.
502 bool HasDotTypeDotSizeDirective; // Defaults to true.
504 /// HasSingleParameterDotFile - True if the target has a single parameter
505 /// .file directive, this is true for ELF targets.
506 bool HasSingleParameterDotFile; // Defaults to true.
508 /// UsedDirective - This directive, if non-null, is used to declare a global
509 /// as being used somehow that the assembler can't see. This prevents dead
510 /// code elimination on some targets.
511 const char *UsedDirective; // Defaults to null.
513 /// WeakRefDirective - This directive, if non-null, is used to declare a
514 /// global as being a weak undefined symbol.
515 const char *WeakRefDirective; // Defaults to null.
517 /// WeakDefDirective - This directive, if non-null, is used to declare a
518 /// global as being a weak defined symbol.
519 const char *WeakDefDirective; // Defaults to null.
521 /// HiddenDirective - This directive, if non-null, is used to declare a
522 /// global or function as having hidden visibility.
523 const char *HiddenDirective; // Defaults to "\t.hidden\t".
525 /// ProtectedDirective - This directive, if non-null, is used to declare a
526 /// global or function as having protected visibility.
527 const char *ProtectedDirective; // Defaults to "\t.protected\t".
529 //===--- Dwarf Emission Directives -----------------------------------===//
531 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
532 /// offsets for debug information. Defaults to false.
533 bool AbsoluteDebugSectionOffsets;
535 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
536 /// offsets for EH information. Defaults to false.
537 bool AbsoluteEHSectionOffsets;
539 /// HasLEB128 - True if target asm supports leb128 directives.
541 bool HasLEB128; // Defaults to false.
543 /// hasDotLocAndDotFile - True if target asm supports .loc and .file
544 /// directives for emitting debugging information.
546 bool HasDotLocAndDotFile; // Defaults to false.
548 /// SupportsDebugInformation - True if target supports emission of debugging
550 bool SupportsDebugInformation;
552 /// SupportsExceptionHandling - True if target supports
553 /// exception handling.
555 bool SupportsExceptionHandling; // Defaults to false.
557 /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
559 bool DwarfRequiresFrameSection; // Defaults to true.
561 /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
562 /// encode inline subroutine information.
563 bool DwarfUsesInlineInfoSection; // Defaults to false.
565 /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
566 /// doesn't show up in the symbol table of the object file.
567 bool Is_EHSymbolPrivate; // Defaults to true.
569 /// GlobalEHDirective - This is the directive used to make exception frame
570 /// tables globally visible.
572 const char *GlobalEHDirective; // Defaults to NULL.
574 /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
575 /// handle a weak_definition of constant 0 for an omitted EH frame.
576 bool SupportsWeakOmittedEHFrame; // Defaults to true.
578 /// DwarfSectionOffsetDirective - Special section offset directive.
579 const char* DwarfSectionOffsetDirective; // Defaults to NULL
581 /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
583 const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
585 /// DwarfInfoSection - Section directive for Dwarf info.
587 const char *DwarfInfoSection; // Defaults to ".debug_info".
589 /// DwarfLineSection - Section directive for Dwarf info.
591 const char *DwarfLineSection; // Defaults to ".debug_line".
593 /// DwarfFrameSection - Section directive for Dwarf info.
595 const char *DwarfFrameSection; // Defaults to ".debug_frame".
597 /// DwarfPubNamesSection - Section directive for Dwarf info.
599 const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
601 /// DwarfPubTypesSection - Section directive for Dwarf info.
603 const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
605 /// DwarfDebugInlineSection - Section directive for inline info.
607 const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined"
609 /// DwarfStrSection - Section directive for Dwarf info.
611 const char *DwarfStrSection; // Defaults to ".debug_str".
613 /// DwarfLocSection - Section directive for Dwarf info.
615 const char *DwarfLocSection; // Defaults to ".debug_loc".
617 /// DwarfARangesSection - Section directive for Dwarf info.
619 const char *DwarfARangesSection; // Defaults to ".debug_aranges".
621 /// DwarfRangesSection - Section directive for Dwarf info.
623 const char *DwarfRangesSection; // Defaults to ".debug_ranges".
625 /// DwarfMacroInfoSection - Section directive for DWARF macro info.
627 const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo".
629 /// DwarfEHFrameSection - Section directive for Exception frames.
631 const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
633 /// DwarfExceptionSection - Section directive for Exception table.
635 const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
637 //===--- CBE Asm Translation Table -----------------------------------===//
639 const char *const *AsmTransCBE; // Defaults to empty
642 explicit TargetAsmInfo(const TargetMachine &TM);
643 virtual ~TargetAsmInfo();
645 const Section *getOrCreateSection(const char *Name,
647 SectionKind::Kind K) const;
649 /// Measure the specified inline asm to determine an approximation of its
651 virtual unsigned getInlineAsmLength(const char *Str) const;
653 /// emitUsedDirectiveFor - This hook allows targets to selectively decide
654 /// not to emit the UsedDirective for some symbols in llvm.used.
655 // FIXME: REMOVE this (rdar://7071300)
656 virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
657 Mangler *Mang) const {
661 /// PreferredEHDataFormat - This hook allows the target to select data
662 /// format used for encoding pointers in exception handling data. Reason is
663 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
664 /// if the symbol can be relocated.
665 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
669 /// getSectionForMergeableConstant - Given a Mergeable constant with the
670 /// specified size and relocation information, return a section that it
671 /// should be placed in.
672 virtual const Section *getSectionForMergeableConstant(SectionKind Kind)const;
675 /// getKindForNamedSection - If this target wants to be able to override
676 /// section flags based on the name of the section specified for a global
677 /// variable, it can implement this. This is used on ELF systems so that
678 /// ".tbss" gets the TLS bit set etc.
679 virtual SectionKind::Kind getKindForNamedSection(const char *Section,
680 SectionKind::Kind K) const{
684 /// SectionForGlobal - This method computes the appropriate section to emit
685 /// the specified global variable or function definition. This should not
686 /// be passed external (or available externally) globals.
687 // FIXME: MOVE TO ASMPRINTER.
688 const Section* SectionForGlobal(const GlobalValue *GV) const;
690 /// getSpecialCasedSectionGlobals - Allow the target to completely override
691 /// section assignment of a global.
692 /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
693 /// getFlagsForNamedSection.
694 virtual const Section *
695 getSpecialCasedSectionGlobals(const GlobalValue *GV,
696 SectionKind Kind) const {
700 /// getSectionFlagsAsString - Turn the flags in the specified SectionKind
701 /// into a string that can be printed to the assembly file after the
702 /// ".section foo" part of a section directive.
703 virtual void getSectionFlagsAsString(SectionKind Kind,
704 SmallVectorImpl<char> &Str) const {
707 // FIXME: Eliminate this.
708 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
709 SectionKind Kind) const;
711 /// getSLEB128Size - Compute the number of bytes required for a signed
713 static unsigned getSLEB128Size(int Value);
715 /// getULEB128Size - Compute the number of bytes required for an unsigned
717 static unsigned getULEB128Size(unsigned Value);
719 // Data directive accessors.
721 const char *getData8bitsDirective(unsigned AS = 0) const {
722 return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
724 const char *getData16bitsDirective(unsigned AS = 0) const {
725 return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
727 const char *getData32bitsDirective(unsigned AS = 0) const {
728 return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
730 const char *getData64bitsDirective(unsigned AS = 0) const {
731 return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
737 const Section *getTextSection() const {
740 const Section *getDataSection() const {
743 const char *getBSSSection() const {
746 const Section *getBSSSection_() const {
749 const Section *getReadOnlySection() const {
750 return ReadOnlySection;
752 const Section *getTLSDataSection() const {
753 return TLSDataSection;
755 const Section *getTLSBSSSection() const {
756 return TLSBSSSection;
758 const char *getZeroFillDirective() const {
759 return ZeroFillDirective;
761 const char *getNonexecutableStackDirective() const {
762 return NonexecutableStackDirective;
764 bool needsSet() const {
767 const char *getPCSymbol() const {
770 char getSeparatorChar() const {
771 return SeparatorChar;
773 unsigned getCommentColumn() const {
774 return CommentColumn;
776 const char *getCommentString() const {
777 return CommentString;
779 unsigned getOperandColumn(int operand) const {
780 return FirstOperandColumn + (MaxOperandLength+1)*(operand-1);
782 const char *getGlobalPrefix() const {
785 const char *getPrivateGlobalPrefix() const {
786 return PrivateGlobalPrefix;
788 const char *getLinkerPrivateGlobalPrefix() const {
789 return LinkerPrivateGlobalPrefix;
791 const char *getJumpTableSpecialLabelPrefix() const {
792 return JumpTableSpecialLabelPrefix;
794 const char *getGlobalVarAddrPrefix() const {
795 return GlobalVarAddrPrefix;
797 const char *getGlobalVarAddrSuffix() const {
798 return GlobalVarAddrSuffix;
800 const char *getFunctionAddrPrefix() const {
801 return FunctionAddrPrefix;
803 const char *getFunctionAddrSuffix() const {
804 return FunctionAddrSuffix;
806 const char *getPersonalityPrefix() const {
807 return PersonalityPrefix;
809 const char *getPersonalitySuffix() const {
810 return PersonalitySuffix;
812 bool getNeedsIndirectEncoding() const {
813 return NeedsIndirectEncoding;
815 const char *getInlineAsmStart() const {
816 return InlineAsmStart;
818 const char *getInlineAsmEnd() const {
821 unsigned getAssemblerDialect() const {
822 return AssemblerDialect;
824 bool doesAllowQuotesInName() const {
825 return AllowQuotesInName;
827 const char *getZeroDirective() const {
828 return ZeroDirective;
830 const char *getZeroDirectiveSuffix() const {
831 return ZeroDirectiveSuffix;
833 const char *getAsciiDirective() const {
834 return AsciiDirective;
836 const char *getAscizDirective() const {
837 return AscizDirective;
839 const char *getJumpTableDirective() const {
840 return JumpTableDirective;
842 const char *getAlignDirective() const {
843 return AlignDirective;
845 bool getAlignmentIsInBytes() const {
846 return AlignmentIsInBytes;
848 unsigned getTextAlignFillValue() const {
849 return TextAlignFillValue;
851 const char *getSwitchToSectionDirective() const {
852 return SwitchToSectionDirective;
854 const char *getTextSectionStartSuffix() const {
855 return TextSectionStartSuffix;
857 const char *getDataSectionStartSuffix() const {
858 return DataSectionStartSuffix;
860 const char *getSectionEndDirectiveSuffix() const {
861 return SectionEndDirectiveSuffix;
863 const char *getConstantPoolSection() const {
864 return ConstantPoolSection;
866 const char *getJumpTableDataSection() const {
867 return JumpTableDataSection;
869 const char *getCStringSection() const {
870 return CStringSection;
872 const Section *getCStringSection_() const {
873 return CStringSection_;
875 const char *getStaticCtorsSection() const {
876 return StaticCtorsSection;
878 const char *getStaticDtorsSection() const {
879 return StaticDtorsSection;
881 const char *getGlobalDirective() const {
882 return GlobalDirective;
884 const char *getExternDirective() const {
885 return ExternDirective;
887 const char *getSetDirective() const {
890 const char *getLCOMMDirective() const {
891 return LCOMMDirective;
893 const char *getCOMMDirective() const {
894 return COMMDirective;
896 bool getCOMMDirectiveTakesAlignment() const {
897 return COMMDirectiveTakesAlignment;
899 bool hasDotTypeDotSizeDirective() const {
900 return HasDotTypeDotSizeDirective;
902 bool hasSingleParameterDotFile() const {
903 return HasSingleParameterDotFile;
905 const char *getUsedDirective() const {
906 return UsedDirective;
908 const char *getWeakRefDirective() const {
909 return WeakRefDirective;
911 const char *getWeakDefDirective() const {
912 return WeakDefDirective;
914 const char *getHiddenDirective() const {
915 return HiddenDirective;
917 const char *getProtectedDirective() const {
918 return ProtectedDirective;
920 bool isAbsoluteDebugSectionOffsets() const {
921 return AbsoluteDebugSectionOffsets;
923 bool isAbsoluteEHSectionOffsets() const {
924 return AbsoluteEHSectionOffsets;
926 bool hasLEB128() const {
929 bool hasDotLocAndDotFile() const {
930 return HasDotLocAndDotFile;
932 bool doesSupportDebugInformation() const {
933 return SupportsDebugInformation;
935 bool doesSupportExceptionHandling() const {
936 return SupportsExceptionHandling;
938 bool doesDwarfRequireFrameSection() const {
939 return DwarfRequiresFrameSection;
941 bool doesDwarfUsesInlineInfoSection() const {
942 return DwarfUsesInlineInfoSection;
944 bool is_EHSymbolPrivate() const {
945 return Is_EHSymbolPrivate;
947 const char *getGlobalEHDirective() const {
948 return GlobalEHDirective;
950 bool getSupportsWeakOmittedEHFrame() const {
951 return SupportsWeakOmittedEHFrame;
953 const char *getDwarfSectionOffsetDirective() const {
954 return DwarfSectionOffsetDirective;
956 const char *getDwarfAbbrevSection() const {
957 return DwarfAbbrevSection;
959 const char *getDwarfInfoSection() const {
960 return DwarfInfoSection;
962 const char *getDwarfLineSection() const {
963 return DwarfLineSection;
965 const char *getDwarfFrameSection() const {
966 return DwarfFrameSection;
968 const char *getDwarfPubNamesSection() const {
969 return DwarfPubNamesSection;
971 const char *getDwarfPubTypesSection() const {
972 return DwarfPubTypesSection;
974 const char *getDwarfDebugInlineSection() const {
975 return DwarfDebugInlineSection;
977 const char *getDwarfStrSection() const {
978 return DwarfStrSection;
980 const char *getDwarfLocSection() const {
981 return DwarfLocSection;
983 const char *getDwarfARangesSection() const {
984 return DwarfARangesSection;
986 const char *getDwarfRangesSection() const {
987 return DwarfRangesSection;
989 const char *getDwarfMacroInfoSection() const {
990 return DwarfMacroInfoSection;
992 const char *getDwarfEHFrameSection() const {
993 return DwarfEHFrameSection;
995 const char *getDwarfExceptionSection() const {
996 return DwarfExceptionSection;
998 const char *const *getAsmCBE() const {