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;
147 bool isWeak() const { return Weak; }
148 bool hasExplicitSection() const { return ExplicitSection; }
151 bool isMetadata() const { return K == Metadata; }
152 bool isText() const { return K == Text; }
154 bool isReadOnly() const {
155 return K == ReadOnly || K == MergeableCString || isMergeableConst();
158 bool isMergeableCString() const { return K == MergeableCString; }
159 bool isMergeableConst() const {
160 return K == MergeableConst || K == MergeableConst4 ||
161 K == MergeableConst8 || K == MergeableConst16;
164 bool isMergeableConst4() const { return K == MergeableConst4; }
165 bool isMergeableConst8() const { return K == MergeableConst8; }
166 bool isMergeableConst16() const { return K == MergeableConst16; }
168 bool isWriteable() const {
169 return isThreadLocal() || isGlobalWriteableData();
172 bool isThreadLocal() const {
173 return K == ThreadData || K == ThreadBSS;
176 bool isThreadBSS() const { return K == ThreadBSS; }
177 bool isThreadData() const { return K == ThreadData; }
179 bool isGlobalWriteableData() const {
180 return isBSS() || isDataRel() || isReadOnlyWithRel();
183 bool isBSS() const { return K == BSS; }
185 bool isDataRel() const {
186 return K == DataRel || K == DataRelLocal || K == DataNoRel;
189 bool isDataRelLocal() const {
190 return K == DataRelLocal || K == DataNoRel;
193 bool isDataNoRel() const { return K == DataNoRel; }
195 bool isReadOnlyWithRel() const {
196 return K == ReadOnlyWithRel || K == ReadOnlyWithRelLocal;
199 bool isReadOnlyWithRelLocal() const {
200 return K == ReadOnlyWithRelLocal;
203 static SectionKind get(Kind K, bool isWeak = false,
204 bool hasExplicitSection = false) {
208 Res.ExplicitSection = hasExplicitSection;
214 friend class TargetAsmInfo;
215 friend class StringMapEntry<Section>;
216 friend class StringMap<Section>;
220 explicit Section() { }
223 const std::string &getName() const { return Name; }
224 SectionKind getKind() const { return Kind; }
227 /// TargetAsmInfo - This class is intended to be used as a base class for asm
228 /// properties and features specific to the target.
229 class TargetAsmInfo {
231 mutable StringMap<Section> Sections;
233 /// TM - The current TargetMachine.
234 const TargetMachine &TM;
236 //===------------------------------------------------------------------===//
237 // Properties to be set by the target writer, used to configure asm printer.
240 /// TextSection - Section directive for standard text.
242 const Section *TextSection; // Defaults to ".text".
244 /// DataSection - Section directive for standard data.
246 const Section *DataSection; // Defaults to ".data".
248 /// BSSSection - Section directive for uninitialized data. Null if this
249 /// target doesn't support a BSS section.
251 const char *BSSSection; // Default to ".bss".
252 const Section *BSSSection_;
254 /// ReadOnlySection - This is the directive that is emitted to switch to a
255 /// read-only section for constant data (e.g. data declared const,
257 const Section *ReadOnlySection; // Defaults to NULL
259 /// TLSDataSection - Section directive for Thread Local data.
261 const Section *TLSDataSection; // Defaults to ".tdata".
263 /// TLSBSSSection - Section directive for Thread Local uninitialized data.
264 /// Null if this target doesn't support a BSS section.
266 const Section *TLSBSSSection; // Defaults to ".tbss".
268 /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
269 /// section on this target. Null if this target doesn't support zerofill.
270 const char *ZeroFillDirective; // Default is null.
272 /// NonexecutableStackDirective - Directive for declaring to the
273 /// linker and beyond that the emitted code does not require stack
274 /// memory to be executable.
275 const char *NonexecutableStackDirective; // Default is null.
277 /// NeedsSet - True if target asm treats expressions in data directives
278 /// as linktime-relocatable. For assembly-time computation, we need to
279 /// use a .set. Thus:
282 /// is computed at assembly time, while
284 /// is relocated if the relative locations of x and y change at linktime.
285 /// We want both these things in different places.
286 bool NeedsSet; // Defaults to false.
288 /// MaxInstLength - This is the maximum possible length of an instruction,
289 /// which is needed to compute the size of an inline asm.
290 unsigned MaxInstLength; // Defaults to 4.
292 /// PCSymbol - The symbol used to represent the current PC. Used in PC
293 /// relative expressions.
294 const char *PCSymbol; // Defaults to "$".
296 /// SeparatorChar - This character, if specified, is used to separate
297 /// instructions from each other when on the same line. This is used to
298 /// measure inline asm instructions.
299 char SeparatorChar; // Defaults to ';'
301 /// CommentColumn - This indicates the comment num (zero-based) at
302 /// which asm comments should be printed.
303 unsigned CommentColumn; // Defaults to 60
305 /// CommentString - This indicates the comment character used by the
307 const char *CommentString; // Defaults to "#"
309 /// FirstOperandColumn - The output column where the first operand
310 /// should be printed
311 unsigned FirstOperandColumn; // Defaults to 0 (ignored)
313 /// MaxOperandLength - The maximum length of any printed asm
315 unsigned MaxOperandLength; // Defaults to 0 (ignored)
317 /// GlobalPrefix - If this is set to a non-empty string, it is prepended
318 /// onto all global symbols. This is often used for "_" or ".".
319 const char *GlobalPrefix; // Defaults to ""
321 /// PrivateGlobalPrefix - This prefix is used for globals like constant
322 /// pool entries that are completely private to the .s file and should not
323 /// have names in the .o file. This is often "." or "L".
324 const char *PrivateGlobalPrefix; // Defaults to "."
326 /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
327 /// be passed through the assembler but be removed by the linker. This
328 /// is "l" on Darwin, currently used for some ObjC metadata.
329 const char *LinkerPrivateGlobalPrefix; // Defaults to ""
331 /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
332 /// emitted before jump tables with the specified prefix.
333 const char *JumpTableSpecialLabelPrefix; // Default to null.
335 /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
336 /// will enclose any GlobalVariable (that isn't a function)
338 const char *GlobalVarAddrPrefix; // Defaults to ""
339 const char *GlobalVarAddrSuffix; // Defaults to ""
341 /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
342 /// will enclose any GlobalVariable that points to a function.
344 const char *FunctionAddrPrefix; // Defaults to ""
345 const char *FunctionAddrSuffix; // Defaults to ""
347 /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
348 /// enclose any personality function in the common frame section.
350 const char *PersonalityPrefix; // Defaults to ""
351 const char *PersonalitySuffix; // Defaults to ""
353 /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
356 bool NeedsIndirectEncoding; // Defaults to false
358 /// InlineAsmStart/End - If these are nonempty, they contain a directive to
359 /// emit before and after an inline assembly statement.
360 const char *InlineAsmStart; // Defaults to "#APP\n"
361 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
363 /// AssemblerDialect - Which dialect of an assembler variant to use.
364 unsigned AssemblerDialect; // Defaults to 0
366 /// AllowQuotesInName - This is true if the assembler allows for complex
367 /// symbol names to be surrounded in quotes. This defaults to false.
368 bool AllowQuotesInName;
370 //===--- Data Emission Directives -------------------------------------===//
372 /// ZeroDirective - this should be set to the directive used to get some
373 /// number of zero bytes emitted to the current section. Common cases are
374 /// "\t.zero\t" and "\t.space\t". If this is set to null, the
375 /// Data*bitsDirective's will be used to emit zero bytes.
376 const char *ZeroDirective; // Defaults to "\t.zero\t"
377 const char *ZeroDirectiveSuffix; // Defaults to ""
379 /// AsciiDirective - This directive allows emission of an ascii string with
380 /// the standard C escape characters embedded into it.
381 const char *AsciiDirective; // Defaults to "\t.ascii\t"
383 /// AscizDirective - If not null, this allows for special handling of
384 /// zero terminated strings on this target. This is commonly supported as
385 /// ".asciz". If a target doesn't support this, it can be set to null.
386 const char *AscizDirective; // Defaults to "\t.asciz\t"
388 /// DataDirectives - These directives are used to output some unit of
389 /// integer data to the current section. If a data directive is set to
390 /// null, smaller data directives will be used to emit the large sizes.
391 const char *Data8bitsDirective; // Defaults to "\t.byte\t"
392 const char *Data16bitsDirective; // Defaults to "\t.short\t"
393 const char *Data32bitsDirective; // Defaults to "\t.long\t"
394 const char *Data64bitsDirective; // Defaults to "\t.quad\t"
396 /// getDataASDirective - Return the directive that should be used to emit
397 /// data of the specified size to the specified numeric address space.
398 virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
399 assert(AS != 0 && "Don't know the directives for default addr space");
403 //===--- Alignment Information ----------------------------------------===//
405 /// AlignDirective - The directive used to emit round up to an alignment
408 const char *AlignDirective; // Defaults to "\t.align\t"
410 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
411 /// emits ".align N" directives, where N is the number of bytes to align to.
412 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
414 bool AlignmentIsInBytes; // Defaults to true
416 /// TextAlignFillValue - If non-zero, this is used to fill the executable
417 /// space created as the result of a alignment directive.
418 unsigned TextAlignFillValue;
420 //===--- Section Switching Directives ---------------------------------===//
422 /// SwitchToSectionDirective - This is the directive used when we want to
423 /// emit a global to an arbitrary section. The section name is emited after
425 const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
427 /// TextSectionStartSuffix - This is printed after each start of section
428 /// directive for text sections.
429 const char *TextSectionStartSuffix; // Defaults to "".
431 /// DataSectionStartSuffix - This is printed after each start of section
432 /// directive for data sections.
433 const char *DataSectionStartSuffix; // Defaults to "".
435 /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
436 /// section with the section name and this suffix printed.
437 const char *SectionEndDirectiveSuffix;// Defaults to null.
439 /// ConstantPoolSection - This is the section that we SwitchToSection right
440 /// before emitting the constant pool for a function.
441 const char *ConstantPoolSection; // Defaults to "\t.section .rodata"
443 /// JumpTableDataSection - This is the section that we SwitchToSection right
444 /// before emitting the jump tables for a function when the relocation model
446 const char *JumpTableDataSection; // Defaults to "\t.section .rodata"
448 /// JumpTableDirective - if non-null, the directive to emit before a jump
450 const char *JumpTableDirective;
452 /// CStringSection - If not null, this allows for special handling of
453 /// cstring constants (null terminated string that does not contain any
454 /// other null bytes) on this target. This is commonly supported as
456 const char *CStringSection; // Defaults to NULL
457 const Section *CStringSection_;
459 /// StaticCtorsSection - This is the directive that is emitted to switch to
460 /// a section to emit the static constructor list.
461 /// Defaults to "\t.section .ctors,\"aw\",@progbits".
462 const char *StaticCtorsSection;
464 /// StaticDtorsSection - This is the directive that is emitted to switch to
465 /// a section to emit the static destructor list.
466 /// Defaults to "\t.section .dtors,\"aw\",@progbits".
467 const char *StaticDtorsSection;
469 //===--- Global Variable Emission Directives --------------------------===//
471 /// GlobalDirective - This is the directive used to declare a global entity.
473 const char *GlobalDirective; // Defaults to NULL.
475 /// ExternDirective - This is the directive used to declare external
478 const char *ExternDirective; // Defaults to NULL.
480 /// SetDirective - This is the name of a directive that can be used to tell
481 /// the assembler to set the value of a variable to some expression.
482 const char *SetDirective; // Defaults to null.
484 /// LCOMMDirective - This is the name of a directive (if supported) that can
485 /// be used to efficiently declare a local (internal) block of zero
486 /// initialized data in the .bss/.data section. The syntax expected is:
487 /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
489 const char *LCOMMDirective; // Defaults to null.
491 const char *COMMDirective; // Defaults to "\t.comm\t".
493 /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
494 /// argument that specifies the alignment of the declaration.
495 bool COMMDirectiveTakesAlignment; // Defaults to true.
497 /// HasDotTypeDotSizeDirective - True if the target has .type and .size
498 /// directives, this is true for most ELF targets.
499 bool HasDotTypeDotSizeDirective; // Defaults to true.
501 /// HasSingleParameterDotFile - True if the target has a single parameter
502 /// .file directive, this is true for ELF targets.
503 bool HasSingleParameterDotFile; // Defaults to true.
505 /// UsedDirective - This directive, if non-null, is used to declare a global
506 /// as being used somehow that the assembler can't see. This prevents dead
507 /// code elimination on some targets.
508 const char *UsedDirective; // Defaults to null.
510 /// WeakRefDirective - This directive, if non-null, is used to declare a
511 /// global as being a weak undefined symbol.
512 const char *WeakRefDirective; // Defaults to null.
514 /// WeakDefDirective - This directive, if non-null, is used to declare a
515 /// global as being a weak defined symbol.
516 const char *WeakDefDirective; // Defaults to null.
518 /// HiddenDirective - This directive, if non-null, is used to declare a
519 /// global or function as having hidden visibility.
520 const char *HiddenDirective; // Defaults to "\t.hidden\t".
522 /// ProtectedDirective - This directive, if non-null, is used to declare a
523 /// global or function as having protected visibility.
524 const char *ProtectedDirective; // Defaults to "\t.protected\t".
526 //===--- Dwarf Emission Directives -----------------------------------===//
528 /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
529 /// offsets for debug information. Defaults to false.
530 bool AbsoluteDebugSectionOffsets;
532 /// AbsoluteEHSectionOffsets - True if we should emit abolute section
533 /// offsets for EH information. Defaults to false.
534 bool AbsoluteEHSectionOffsets;
536 /// HasLEB128 - True if target asm supports leb128 directives.
538 bool HasLEB128; // Defaults to false.
540 /// hasDotLocAndDotFile - True if target asm supports .loc and .file
541 /// directives for emitting debugging information.
543 bool HasDotLocAndDotFile; // Defaults to false.
545 /// SupportsDebugInformation - True if target supports emission of debugging
547 bool SupportsDebugInformation;
549 /// SupportsExceptionHandling - True if target supports
550 /// exception handling.
552 bool SupportsExceptionHandling; // Defaults to false.
554 /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
556 bool DwarfRequiresFrameSection; // Defaults to true.
558 /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
559 /// encode inline subroutine information.
560 bool DwarfUsesInlineInfoSection; // Defaults to false.
562 /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
563 /// doesn't show up in the symbol table of the object file.
564 bool Is_EHSymbolPrivate; // Defaults to true.
566 /// GlobalEHDirective - This is the directive used to make exception frame
567 /// tables globally visible.
569 const char *GlobalEHDirective; // Defaults to NULL.
571 /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
572 /// handle a weak_definition of constant 0 for an omitted EH frame.
573 bool SupportsWeakOmittedEHFrame; // Defaults to true.
575 /// DwarfSectionOffsetDirective - Special section offset directive.
576 const char* DwarfSectionOffsetDirective; // Defaults to NULL
578 /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
580 const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
582 /// DwarfInfoSection - Section directive for Dwarf info.
584 const char *DwarfInfoSection; // Defaults to ".debug_info".
586 /// DwarfLineSection - Section directive for Dwarf info.
588 const char *DwarfLineSection; // Defaults to ".debug_line".
590 /// DwarfFrameSection - Section directive for Dwarf info.
592 const char *DwarfFrameSection; // Defaults to ".debug_frame".
594 /// DwarfPubNamesSection - Section directive for Dwarf info.
596 const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
598 /// DwarfPubTypesSection - Section directive for Dwarf info.
600 const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
602 /// DwarfDebugInlineSection - Section directive for inline info.
604 const char *DwarfDebugInlineSection; // Defaults to ".debug_inlined"
606 /// DwarfStrSection - Section directive for Dwarf info.
608 const char *DwarfStrSection; // Defaults to ".debug_str".
610 /// DwarfLocSection - Section directive for Dwarf info.
612 const char *DwarfLocSection; // Defaults to ".debug_loc".
614 /// DwarfARangesSection - Section directive for Dwarf info.
616 const char *DwarfARangesSection; // Defaults to ".debug_aranges".
618 /// DwarfRangesSection - Section directive for Dwarf info.
620 const char *DwarfRangesSection; // Defaults to ".debug_ranges".
622 /// DwarfMacroInfoSection - Section directive for DWARF macro info.
624 const char *DwarfMacroInfoSection; // Defaults to ".debug_macinfo".
626 /// DwarfEHFrameSection - Section directive for Exception frames.
628 const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
630 /// DwarfExceptionSection - Section directive for Exception table.
632 const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
634 //===--- CBE Asm Translation Table -----------------------------------===//
636 const char *const *AsmTransCBE; // Defaults to empty
639 explicit TargetAsmInfo(const TargetMachine &TM);
640 virtual ~TargetAsmInfo();
642 const Section* getNamedSection(const char *Name,
643 SectionKind::Kind K) const;
644 const Section* getUnnamedSection(const char *Directive,
645 SectionKind::Kind K) const;
647 /// Measure the specified inline asm to determine an approximation of its
649 virtual unsigned getInlineAsmLength(const char *Str) const;
651 /// emitUsedDirectiveFor - This hook allows targets to selectively decide
652 /// not to emit the UsedDirective for some symbols in llvm.used.
653 // FIXME: REMOVE this (rdar://7071300)
654 virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
655 Mangler *Mang) const {
659 /// PreferredEHDataFormat - This hook allows the target to select data
660 /// format used for encoding pointers in exception handling data. Reason is
661 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
662 /// if the symbol can be relocated.
663 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
667 /// getSectionForMergeableConstant - Given a Mergeable constant with the
668 /// specified size and relocation information, return a section that it
669 /// should be placed in.
670 virtual const Section *getSectionForMergeableConstant(SectionKind Kind)const;
673 /// getSectionPrefixForUniqueGlobal - Return a string that we should prepend
674 /// onto a global's name in order to get the unique section name for the
675 /// global. This is important for globals that need to be merged across
676 /// translation units.
678 getSectionPrefixForUniqueGlobal(SectionKind Kind) const {
682 /// getKindForNamedSection - If this target wants to be able to override
683 /// section flags based on the name of the section specified for a global
684 /// variable, it can implement this. This is used on ELF systems so that
685 /// ".tbss" gets the TLS bit set etc.
686 virtual SectionKind::Kind getKindForNamedSection(const char *Section,
687 SectionKind::Kind K) const{
691 /// SectionForGlobal - This method computes the appropriate section to emit
692 /// the specified global variable or function definition. This should not
693 /// be passed external (or available externally) globals.
694 // FIXME: MOVE TO ASMPRINTER.
695 const Section* SectionForGlobal(const GlobalValue *GV) const;
697 /// getSpecialCasedSectionGlobals - Allow the target to completely override
698 /// section assignment of a global.
699 /// FIXME: ELIMINATE this by making PIC16 implement ADDRESS with
700 /// getFlagsForNamedSection.
701 virtual const Section *
702 getSpecialCasedSectionGlobals(const GlobalValue *GV,
703 SectionKind Kind) const {
707 /// getSectionFlagsAsString - Turn the flags in the specified SectionKind
708 /// into a string that can be printed to the assembly file after the
709 /// ".section foo" part of a section directive.
710 virtual void getSectionFlagsAsString(SectionKind Kind,
711 SmallVectorImpl<char> &Str) const {
714 // FIXME: Eliminate this.
715 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV,
716 SectionKind Kind) const;
718 /// getSLEB128Size - Compute the number of bytes required for a signed
720 static unsigned getSLEB128Size(int Value);
722 /// getULEB128Size - Compute the number of bytes required for an unsigned
724 static unsigned getULEB128Size(unsigned Value);
726 // Data directive accessors.
728 const char *getData8bitsDirective(unsigned AS = 0) const {
729 return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
731 const char *getData16bitsDirective(unsigned AS = 0) const {
732 return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
734 const char *getData32bitsDirective(unsigned AS = 0) const {
735 return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
737 const char *getData64bitsDirective(unsigned AS = 0) const {
738 return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
744 const Section *getTextSection() const {
747 const Section *getDataSection() const {
750 const char *getBSSSection() const {
753 const Section *getBSSSection_() const {
756 const Section *getReadOnlySection() const {
757 return ReadOnlySection;
759 const Section *getTLSDataSection() const {
760 return TLSDataSection;
762 const Section *getTLSBSSSection() const {
763 return TLSBSSSection;
765 const char *getZeroFillDirective() const {
766 return ZeroFillDirective;
768 const char *getNonexecutableStackDirective() const {
769 return NonexecutableStackDirective;
771 bool needsSet() const {
774 const char *getPCSymbol() const {
777 char getSeparatorChar() const {
778 return SeparatorChar;
780 unsigned getCommentColumn() const {
781 return CommentColumn;
783 const char *getCommentString() const {
784 return CommentString;
786 unsigned getOperandColumn(int operand) const {
787 return FirstOperandColumn + (MaxOperandLength+1)*(operand-1);
789 const char *getGlobalPrefix() const {
792 const char *getPrivateGlobalPrefix() const {
793 return PrivateGlobalPrefix;
795 const char *getLinkerPrivateGlobalPrefix() const {
796 return LinkerPrivateGlobalPrefix;
798 const char *getJumpTableSpecialLabelPrefix() const {
799 return JumpTableSpecialLabelPrefix;
801 const char *getGlobalVarAddrPrefix() const {
802 return GlobalVarAddrPrefix;
804 const char *getGlobalVarAddrSuffix() const {
805 return GlobalVarAddrSuffix;
807 const char *getFunctionAddrPrefix() const {
808 return FunctionAddrPrefix;
810 const char *getFunctionAddrSuffix() const {
811 return FunctionAddrSuffix;
813 const char *getPersonalityPrefix() const {
814 return PersonalityPrefix;
816 const char *getPersonalitySuffix() const {
817 return PersonalitySuffix;
819 bool getNeedsIndirectEncoding() const {
820 return NeedsIndirectEncoding;
822 const char *getInlineAsmStart() const {
823 return InlineAsmStart;
825 const char *getInlineAsmEnd() const {
828 unsigned getAssemblerDialect() const {
829 return AssemblerDialect;
831 bool doesAllowQuotesInName() const {
832 return AllowQuotesInName;
834 const char *getZeroDirective() const {
835 return ZeroDirective;
837 const char *getZeroDirectiveSuffix() const {
838 return ZeroDirectiveSuffix;
840 const char *getAsciiDirective() const {
841 return AsciiDirective;
843 const char *getAscizDirective() const {
844 return AscizDirective;
846 const char *getJumpTableDirective() const {
847 return JumpTableDirective;
849 const char *getAlignDirective() const {
850 return AlignDirective;
852 bool getAlignmentIsInBytes() const {
853 return AlignmentIsInBytes;
855 unsigned getTextAlignFillValue() const {
856 return TextAlignFillValue;
858 const char *getSwitchToSectionDirective() const {
859 return SwitchToSectionDirective;
861 const char *getTextSectionStartSuffix() const {
862 return TextSectionStartSuffix;
864 const char *getDataSectionStartSuffix() const {
865 return DataSectionStartSuffix;
867 const char *getSectionEndDirectiveSuffix() const {
868 return SectionEndDirectiveSuffix;
870 const char *getConstantPoolSection() const {
871 return ConstantPoolSection;
873 const char *getJumpTableDataSection() const {
874 return JumpTableDataSection;
876 const char *getCStringSection() const {
877 return CStringSection;
879 const Section *getCStringSection_() const {
880 return CStringSection_;
882 const char *getStaticCtorsSection() const {
883 return StaticCtorsSection;
885 const char *getStaticDtorsSection() const {
886 return StaticDtorsSection;
888 const char *getGlobalDirective() const {
889 return GlobalDirective;
891 const char *getExternDirective() const {
892 return ExternDirective;
894 const char *getSetDirective() const {
897 const char *getLCOMMDirective() const {
898 return LCOMMDirective;
900 const char *getCOMMDirective() const {
901 return COMMDirective;
903 bool getCOMMDirectiveTakesAlignment() const {
904 return COMMDirectiveTakesAlignment;
906 bool hasDotTypeDotSizeDirective() const {
907 return HasDotTypeDotSizeDirective;
909 bool hasSingleParameterDotFile() const {
910 return HasSingleParameterDotFile;
912 const char *getUsedDirective() const {
913 return UsedDirective;
915 const char *getWeakRefDirective() const {
916 return WeakRefDirective;
918 const char *getWeakDefDirective() const {
919 return WeakDefDirective;
921 const char *getHiddenDirective() const {
922 return HiddenDirective;
924 const char *getProtectedDirective() const {
925 return ProtectedDirective;
927 bool isAbsoluteDebugSectionOffsets() const {
928 return AbsoluteDebugSectionOffsets;
930 bool isAbsoluteEHSectionOffsets() const {
931 return AbsoluteEHSectionOffsets;
933 bool hasLEB128() const {
936 bool hasDotLocAndDotFile() const {
937 return HasDotLocAndDotFile;
939 bool doesSupportDebugInformation() const {
940 return SupportsDebugInformation;
942 bool doesSupportExceptionHandling() const {
943 return SupportsExceptionHandling;
945 bool doesDwarfRequireFrameSection() const {
946 return DwarfRequiresFrameSection;
948 bool doesDwarfUsesInlineInfoSection() const {
949 return DwarfUsesInlineInfoSection;
951 bool is_EHSymbolPrivate() const {
952 return Is_EHSymbolPrivate;
954 const char *getGlobalEHDirective() const {
955 return GlobalEHDirective;
957 bool getSupportsWeakOmittedEHFrame() const {
958 return SupportsWeakOmittedEHFrame;
960 const char *getDwarfSectionOffsetDirective() const {
961 return DwarfSectionOffsetDirective;
963 const char *getDwarfAbbrevSection() const {
964 return DwarfAbbrevSection;
966 const char *getDwarfInfoSection() const {
967 return DwarfInfoSection;
969 const char *getDwarfLineSection() const {
970 return DwarfLineSection;
972 const char *getDwarfFrameSection() const {
973 return DwarfFrameSection;
975 const char *getDwarfPubNamesSection() const {
976 return DwarfPubNamesSection;
978 const char *getDwarfPubTypesSection() const {
979 return DwarfPubTypesSection;
981 const char *getDwarfDebugInlineSection() const {
982 return DwarfDebugInlineSection;
984 const char *getDwarfStrSection() const {
985 return DwarfStrSection;
987 const char *getDwarfLocSection() const {
988 return DwarfLocSection;
990 const char *getDwarfARangesSection() const {
991 return DwarfARangesSection;
993 const char *getDwarfRangesSection() const {
994 return DwarfRangesSection;
996 const char *getDwarfMacroInfoSection() const {
997 return DwarfMacroInfoSection;
999 const char *getDwarfEHFrameSection() const {
1000 return DwarfEHFrameSection;
1002 const char *getDwarfExceptionSection() const {
1003 return DwarfExceptionSection;
1005 const char *const *getAsmCBE() const {