Fix bug 3140.
[oota-llvm.git] / include / llvm / Target / TargetAsmInfo.h
1 //===-- llvm/Target/TargetAsmInfo.h - Asm info ------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
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.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_TARGET_ASM_INFO_H
17 #define LLVM_TARGET_ASM_INFO_H
18
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/Support/DataTypes.h"
22 #include <string>
23
24 namespace llvm {
25   // DWARF encoding query type
26   namespace DwarfEncoding {
27     enum Target {
28       Data       = 0,
29       CodeLabels = 1,
30       Functions  = 2
31     };
32   }
33
34   namespace SectionKind {
35     enum Kind {
36       Unknown = 0,      ///< Custom section
37       Text,             ///< Text section
38       Data,             ///< Data section
39       BSS,              ///< BSS section
40       ROData,           ///< Readonly data section
41       RODataMergeStr,   ///< Readonly data section (mergeable strings)
42       RODataMergeConst, ///< Readonly data section (mergeable constants)
43       SmallData,        ///< Small data section
44       SmallBSS,         ///< Small bss section
45       SmallROData,      ///< Small readonly section
46       ThreadData,       ///< Initialized TLS data objects
47       ThreadBSS         ///< Uninitialized TLS data objects
48     };
49
50     static inline bool isReadOnly(Kind K) {
51       return (K == SectionKind::ROData ||
52               K == SectionKind::RODataMergeConst ||
53               K == SectionKind::RODataMergeStr ||
54               K == SectionKind::SmallROData);
55     }
56
57     static inline bool isBSS(Kind K) {
58       return (K == SectionKind::BSS ||
59               K == SectionKind::SmallBSS);
60     }
61   }
62
63   namespace SectionFlags {
64     const unsigned Invalid    = -1U;
65     const unsigned None       = 0;
66     const unsigned Code       = 1 << 0;  ///< Section contains code
67     const unsigned Writeable  = 1 << 1;  ///< Section is writeable
68     const unsigned BSS        = 1 << 2;  ///< Section contains only zeroes
69     const unsigned Mergeable  = 1 << 3;  ///< Section contains mergeable data
70     const unsigned Strings    = 1 << 4;  ///< Section contains C-type strings
71     const unsigned TLS        = 1 << 5;  ///< Section contains thread-local data
72     const unsigned Debug      = 1 << 6;  ///< Section contains debug data
73     const unsigned Linkonce   = 1 << 7;  ///< Section is linkonce
74     const unsigned Small      = 1 << 8;  ///< Section is small
75     const unsigned TypeFlags  = 0xFF;
76     // Some gap for future flags
77     const unsigned Named      = 1 << 23; ///< Section is named
78     const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
79
80     static inline unsigned getEntitySize(unsigned Flags) {
81       return (Flags >> 24) & 0xFF;
82     }
83
84     static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
85       return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24));
86     }
87
88     struct KeyInfo {
89       static inline unsigned getEmptyKey() { return Invalid; }
90       static inline unsigned getTombstoneKey() { return Invalid - 1; }
91       static unsigned getHashValue(const unsigned &Key) { return Key; }
92       static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
93       static bool isPod() { return true; }
94     };
95
96     typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
97   }
98
99   class TargetMachine;
100   class CallInst;
101   class GlobalValue;
102   class Type;
103   class Mangler;
104
105   class Section {
106     friend class TargetAsmInfo;
107     friend class StringMapEntry<Section>;
108
109     std::string Name;
110     unsigned Flags;
111
112     explicit Section(unsigned F = SectionFlags::Invalid):Flags(F) { }
113   public:
114     bool isNamed() const { return Flags & SectionFlags::Named; }
115     unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
116
117     const std::string& getName() const { return Name; }
118     unsigned getFlags() const { return Flags; }
119   };
120
121   /// TargetAsmInfo - This class is intended to be used as a base class for asm
122   /// properties and features specific to the target.
123   class TargetAsmInfo {
124   private:
125     mutable StringMap<Section> Sections;
126     mutable SectionFlags::FlagsStringsMapType FlagsStrings;
127     void fillDefaultValues();
128   protected:
129     /// TM - The current TargetMachine.
130     const TargetMachine &TM;
131
132     //===------------------------------------------------------------------===//
133     // Properties to be set by the target writer, used to configure asm printer.
134     //
135
136     /// TextSection - Section directive for standard text.
137     ///
138     const Section *TextSection;           // Defaults to ".text".
139
140     /// DataSection - Section directive for standard data.
141     ///
142     const Section *DataSection;           // Defaults to ".data".
143
144     /// BSSSection - Section directive for uninitialized data.  Null if this
145     /// target doesn't support a BSS section.
146     ///
147     const char *BSSSection;               // Default to ".bss".
148     const Section *BSSSection_;
149
150     /// ReadOnlySection - This is the directive that is emitted to switch to a
151     /// read-only section for constant data (e.g. data declared const,
152     /// jump tables).
153     const Section *ReadOnlySection;       // Defaults to NULL
154
155     /// SmallDataSection - This is the directive that is emitted to switch to a
156     /// small data section.
157     ///
158     const Section *SmallDataSection;      // Defaults to NULL
159
160     /// SmallBSSSection - This is the directive that is emitted to switch to a
161     /// small bss section.
162     ///
163     const Section *SmallBSSSection;       // Defaults to NULL
164
165     /// SmallRODataSection - This is the directive that is emitted to switch to 
166     /// a small read-only data section.
167     ///
168     const Section *SmallRODataSection;    // Defaults to NULL
169
170     /// TLSDataSection - Section directive for Thread Local data.
171     ///
172     const Section *TLSDataSection;        // Defaults to ".tdata".
173
174     /// TLSBSSSection - Section directive for Thread Local uninitialized data.
175     /// Null if this target doesn't support a BSS section.
176     ///
177     const Section *TLSBSSSection;         // Defaults to ".tbss".
178
179     /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
180     /// section on this target.  Null if this target doesn't support zerofill.
181     const char *ZeroFillDirective;        // Default is null.
182
183     /// NonexecutableStackDirective - Directive for declaring to the
184     /// linker and beyond that the emitted code does not require stack
185     /// memory to be executable.
186     const char *NonexecutableStackDirective; // Default is null.
187
188     /// NeedsSet - True if target asm treats expressions in data directives
189     /// as linktime-relocatable.  For assembly-time computation, we need to
190     /// use a .set.  Thus:
191     /// .set w, x-y
192     /// .long w
193     /// is computed at assembly time, while
194     /// .long x-y
195     /// is relocated if the relative locations of x and y change at linktime.
196     /// We want both these things in different places.
197     bool NeedsSet;                        // Defaults to false.
198     
199     /// MaxInstLength - This is the maximum possible length of an instruction,
200     /// which is needed to compute the size of an inline asm.
201     unsigned MaxInstLength;               // Defaults to 4.
202     
203     /// PCSymbol - The symbol used to represent the current PC.  Used in PC
204     /// relative expressions.
205     const char *PCSymbol;                 // Defaults to "$".
206
207     /// SeparatorChar - This character, if specified, is used to separate
208     /// instructions from each other when on the same line.  This is used to
209     /// measure inline asm instructions.
210     char SeparatorChar;                   // Defaults to ';'
211
212     /// CommentString - This indicates the comment character used by the
213     /// assembler.
214     const char *CommentString;            // Defaults to "#"
215
216     /// GlobalPrefix - If this is set to a non-empty string, it is prepended
217     /// onto all global symbols.  This is often used for "_" or ".".
218     const char *GlobalPrefix;             // Defaults to ""
219
220     /// PrivateGlobalPrefix - This prefix is used for globals like constant
221     /// pool entries that are completely private to the .s file and should not
222     /// have names in the .o file.  This is often "." or "L".
223     const char *PrivateGlobalPrefix;      // Defaults to "."
224     
225     /// LessPrivateGlobalPrefix - This prefix is used for symbols that should
226     /// be passed through the assembler but be removed by the linker.  This
227     /// is "l" on Darwin, currently used for some ObjC metadata.
228     const char *LessPrivateGlobalPrefix;      // Defaults to ""
229     
230     /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
231     /// emitted before jump tables with the specified prefix.
232     const char *JumpTableSpecialLabelPrefix;  // Default to null.
233     
234     /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
235     /// will enclose any GlobalVariable (that isn't a function)
236     ///
237     const char *GlobalVarAddrPrefix;      // Defaults to ""
238     const char *GlobalVarAddrSuffix;      // Defaults to ""
239
240     /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
241     /// will enclose any GlobalVariable that points to a function.
242     /// For example, this is used by the IA64 backend to materialize
243     /// function descriptors, by decorating the ".data8" object with the
244     /// @verbatim @fptr( ) @endverbatim
245     /// link-relocation operator.
246     ///
247     const char *FunctionAddrPrefix;       // Defaults to ""
248     const char *FunctionAddrSuffix;       // Defaults to ""
249
250     /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
251     /// enclose any personality function in the common frame section.
252     /// 
253     const char *PersonalityPrefix;        // Defaults to ""
254     const char *PersonalitySuffix;        // Defaults to ""
255
256     /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
257     /// for EH in Dwarf.
258     /// 
259     bool NeedsIndirectEncoding;           // Defaults to false
260
261     /// InlineAsmStart/End - If these are nonempty, they contain a directive to
262     /// emit before and after an inline assembly statement.
263     const char *InlineAsmStart;           // Defaults to "#APP\n"
264     const char *InlineAsmEnd;             // Defaults to "#NO_APP\n"
265
266     /// AssemblerDialect - Which dialect of an assembler variant to use.
267     unsigned AssemblerDialect;            // Defaults to 0
268
269     /// StringConstantPrefix - Prefix for FEs to use when generating unnamed
270     /// constant strings.  These names get run through the Mangler later; if
271     /// you want the Mangler not to add the GlobalPrefix as well, 
272     /// use '\1' as the first character.
273     const char *StringConstantPrefix;     // Defaults to ".str"
274
275     //===--- Data Emission Directives -------------------------------------===//
276
277     /// ZeroDirective - this should be set to the directive used to get some
278     /// number of zero bytes emitted to the current section.  Common cases are
279     /// "\t.zero\t" and "\t.space\t".  If this is set to null, the
280     /// Data*bitsDirective's will be used to emit zero bytes.
281     const char *ZeroDirective;            // Defaults to "\t.zero\t"
282     const char *ZeroDirectiveSuffix;      // Defaults to ""
283
284     /// AsciiDirective - This directive allows emission of an ascii string with
285     /// the standard C escape characters embedded into it.
286     const char *AsciiDirective;           // Defaults to "\t.ascii\t"
287     
288     /// AscizDirective - If not null, this allows for special handling of
289     /// zero terminated strings on this target.  This is commonly supported as
290     /// ".asciz".  If a target doesn't support this, it can be set to null.
291     const char *AscizDirective;           // Defaults to "\t.asciz\t"
292
293     /// DataDirectives - These directives are used to output some unit of
294     /// integer data to the current section.  If a data directive is set to
295     /// null, smaller data directives will be used to emit the large sizes.
296     const char *Data8bitsDirective;       // Defaults to "\t.byte\t"
297     const char *Data16bitsDirective;      // Defaults to "\t.short\t"
298     const char *Data32bitsDirective;      // Defaults to "\t.long\t"
299     const char *Data64bitsDirective;      // Defaults to "\t.quad\t"
300
301     //===--- Alignment Information ----------------------------------------===//
302
303     /// AlignDirective - The directive used to emit round up to an alignment
304     /// boundary.
305     ///
306     const char *AlignDirective;           // Defaults to "\t.align\t"
307
308     /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
309     /// emits ".align N" directives, where N is the number of bytes to align to.
310     /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
311     /// boundary.
312     bool AlignmentIsInBytes;              // Defaults to true
313
314     /// TextAlignFillValue - If non-zero, this is used to fill the executable
315     /// space created as the result of a alignment directive.
316     unsigned TextAlignFillValue;
317
318     //===--- Section Switching Directives ---------------------------------===//
319     
320     /// SwitchToSectionDirective - This is the directive used when we want to
321     /// emit a global to an arbitrary section.  The section name is emited after
322     /// this.
323     const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
324     
325     /// TextSectionStartSuffix - This is printed after each start of section
326     /// directive for text sections.
327     const char *TextSectionStartSuffix;   // Defaults to "".
328
329     /// DataSectionStartSuffix - This is printed after each start of section
330     /// directive for data sections.
331     const char *DataSectionStartSuffix;   // Defaults to "".
332     
333     /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
334     /// section with the section name and this suffix printed.
335     const char *SectionEndDirectiveSuffix;// Defaults to null.
336     
337     /// ConstantPoolSection - This is the section that we SwitchToSection right
338     /// before emitting the constant pool for a function.
339     const char *ConstantPoolSection;      // Defaults to "\t.section .rodata"
340
341     /// JumpTableDataSection - This is the section that we SwitchToSection right
342     /// before emitting the jump tables for a function when the relocation model
343     /// is not PIC.
344     const char *JumpTableDataSection;     // Defaults to "\t.section .rodata"
345     
346     /// JumpTableDirective - if non-null, the directive to emit before a jump
347     /// table.
348     const char *JumpTableDirective;
349
350     /// CStringSection - If not null, this allows for special handling of
351     /// cstring constants (null terminated string that does not contain any
352     /// other null bytes) on this target. This is commonly supported as
353     /// ".cstring".
354     const char *CStringSection;           // Defaults to NULL
355     const Section *CStringSection_;
356
357     /// StaticCtorsSection - This is the directive that is emitted to switch to
358     /// a section to emit the static constructor list.
359     /// Defaults to "\t.section .ctors,\"aw\",@progbits".
360     const char *StaticCtorsSection;
361
362     /// StaticDtorsSection - This is the directive that is emitted to switch to
363     /// a section to emit the static destructor list.
364     /// Defaults to "\t.section .dtors,\"aw\",@progbits".
365     const char *StaticDtorsSection;
366
367     //===--- Global Variable Emission Directives --------------------------===//
368     
369     /// GlobalDirective - This is the directive used to declare a global entity.
370     ///
371     const char *GlobalDirective;          // Defaults to NULL.
372     
373     /// SetDirective - This is the name of a directive that can be used to tell
374     /// the assembler to set the value of a variable to some expression.
375     const char *SetDirective;             // Defaults to null.
376     
377     /// LCOMMDirective - This is the name of a directive (if supported) that can
378     /// be used to efficiently declare a local (internal) block of zero
379     /// initialized data in the .bss/.data section.  The syntax expected is:
380     /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
381     /// @endverbatim
382     const char *LCOMMDirective;           // Defaults to null.
383     
384     const char *COMMDirective;            // Defaults to "\t.comm\t".
385
386     /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
387     /// argument that specifies the alignment of the declaration.
388     bool COMMDirectiveTakesAlignment;     // Defaults to true.
389     
390     /// HasDotTypeDotSizeDirective - True if the target has .type and .size
391     /// directives, this is true for most ELF targets.
392     bool HasDotTypeDotSizeDirective;      // Defaults to true.
393
394     /// HasSingleParameterDotFile - True if the target has a single parameter
395     /// .file directive, this is true for ELF targets.
396     bool HasSingleParameterDotFile;      // Defaults to true.
397
398     /// UsedDirective - This directive, if non-null, is used to declare a global
399     /// as being used somehow that the assembler can't see.  This prevents dead
400     /// code elimination on some targets.
401     const char *UsedDirective;            // Defaults to null.
402
403     /// WeakRefDirective - This directive, if non-null, is used to declare a
404     /// global as being a weak undefined symbol.
405     const char *WeakRefDirective;         // Defaults to null.
406     
407     /// WeakDefDirective - This directive, if non-null, is used to declare a
408     /// global as being a weak defined symbol.
409     const char *WeakDefDirective;         // Defaults to null.
410     
411     /// HiddenDirective - This directive, if non-null, is used to declare a
412     /// global or function as having hidden visibility.
413     const char *HiddenDirective;          // Defaults to "\t.hidden\t".
414
415     /// ProtectedDirective - This directive, if non-null, is used to declare a
416     /// global or function as having protected visibility.
417     const char *ProtectedDirective;       // Defaults to "\t.protected\t".
418
419     //===--- Dwarf Emission Directives -----------------------------------===//
420
421     /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
422     /// offsets for debug information. Defaults to false.
423     bool AbsoluteDebugSectionOffsets;
424
425     /// AbsoluteEHSectionOffsets - True if we should emit abolute section
426     /// offsets for EH information. Defaults to false.
427     bool AbsoluteEHSectionOffsets;
428
429     /// HasLEB128 - True if target asm supports leb128 directives.
430     ///
431     bool HasLEB128; // Defaults to false.
432     
433     /// hasDotLocAndDotFile - True if target asm supports .loc and .file
434     /// directives for emitting debugging information.
435     ///
436     bool HasDotLocAndDotFile; // Defaults to false.
437     
438     /// SupportsDebugInformation - True if target supports emission of debugging
439     /// information.
440     bool SupportsDebugInformation;
441         
442     /// SupportsExceptionHandling - True if target supports
443     /// exception handling.
444     ///
445     bool SupportsExceptionHandling; // Defaults to false.
446     
447     /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
448     ///
449     bool DwarfRequiresFrameSection; // Defaults to true.
450
451     /// GlobalEHDirective - This is the directive used to make exception frame
452     /// tables globally visible.
453     ///
454     const char *GlobalEHDirective;          // Defaults to NULL.
455
456     /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
457     /// handle a weak_definition of constant 0 for an omitted EH frame.
458     bool SupportsWeakOmittedEHFrame;  // Defaults to true.
459
460     /// DwarfSectionOffsetDirective - Special section offset directive.
461     const char* DwarfSectionOffsetDirective; // Defaults to NULL
462     
463     /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
464     ///
465     const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
466
467     /// DwarfInfoSection - Section directive for Dwarf info.
468     ///
469     const char *DwarfInfoSection; // Defaults to ".debug_info".
470
471     /// DwarfLineSection - Section directive for Dwarf info.
472     ///
473     const char *DwarfLineSection; // Defaults to ".debug_line".
474     
475     /// DwarfFrameSection - Section directive for Dwarf info.
476     ///
477     const char *DwarfFrameSection; // Defaults to ".debug_frame".
478     
479     /// DwarfPubNamesSection - Section directive for Dwarf info.
480     ///
481     const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
482     
483     /// DwarfPubTypesSection - Section directive for Dwarf info.
484     ///
485     const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
486     
487     /// DwarfStrSection - Section directive for Dwarf info.
488     ///
489     const char *DwarfStrSection; // Defaults to ".debug_str".
490
491     /// DwarfLocSection - Section directive for Dwarf info.
492     ///
493     const char *DwarfLocSection; // Defaults to ".debug_loc".
494
495     /// DwarfARangesSection - Section directive for Dwarf info.
496     ///
497     const char *DwarfARangesSection; // Defaults to ".debug_aranges".
498
499     /// DwarfRangesSection - Section directive for Dwarf info.
500     ///
501     const char *DwarfRangesSection; // Defaults to ".debug_ranges".
502
503     /// DwarfMacInfoSection - Section directive for Dwarf info.
504     ///
505     const char *DwarfMacInfoSection; // Defaults to ".debug_macinfo".
506     
507     /// DwarfEHFrameSection - Section directive for Exception frames.
508     ///
509     const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
510     
511     /// DwarfExceptionSection - Section directive for Exception table.
512     ///
513     const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
514
515     //===--- CBE Asm Translation Table -----------------------------------===//
516
517     const char *const *AsmTransCBE; // Defaults to empty
518
519   public:
520     explicit TargetAsmInfo(const TargetMachine &TM);
521     virtual ~TargetAsmInfo();
522
523     const Section* getNamedSection(const char *Name,
524                                    unsigned Flags = SectionFlags::None,
525                                    bool Override = false) const;
526     const Section* getUnnamedSection(const char *Directive,
527                                      unsigned Flags = SectionFlags::None,
528                                      bool Override = false) const;
529
530     /// Measure the specified inline asm to determine an approximation of its
531     /// length.
532     virtual unsigned getInlineAsmLength(const char *Str) const;
533
534     /// ExpandInlineAsm - This hook allows the target to expand an inline asm
535     /// call to be explicit llvm code if it wants to.  This is useful for
536     /// turning simple inline asms into LLVM intrinsics, which gives the
537     /// compiler more information about the behavior of the code.
538     virtual bool ExpandInlineAsm(CallInst *CI) const {
539       return false;
540     }
541
542     /// emitUsedDirectiveFor - This hook allows targets to selectively decide
543     /// not to emit the UsedDirective for some symbols in llvm.used.
544     virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
545                                       Mangler *Mang) const {
546       return (GV!=0);
547     }
548
549     /// PreferredEHDataFormat - This hook allows the target to select data
550     /// format used for encoding pointers in exception handling data. Reason is
551     /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
552     /// if the symbol can be relocated.
553     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
554                                            bool Global) const;
555
556     /// SectionKindForGlobal - This hook allows the target to select proper
557     /// section kind used for global emission.
558     virtual SectionKind::Kind
559     SectionKindForGlobal(const GlobalValue *GV) const;
560
561
562     /// SectionFlagsForGlobal - This hook allows the target to select proper
563     /// section flags either for given global or for section.
564     virtual unsigned
565     SectionFlagsForGlobal(const GlobalValue *GV = NULL,
566                           const char* name = NULL) const;
567
568     /// SectionForGlobal - This hooks returns proper section name for given
569     /// global with all necessary flags and marks.
570     virtual const Section* SectionForGlobal(const GlobalValue *GV) const;
571
572     // Helper methods for SectionForGlobal
573     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
574                                                SectionKind::Kind kind) const;
575
576     const std::string& getSectionFlags(unsigned Flags) const;
577     virtual std::string printSectionFlags(unsigned flags) const { return ""; }
578
579     virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
580
581     virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
582
583     /// getSLEB128Size - Compute the number of bytes required for a signed
584     /// leb128 value.
585
586     static unsigned getSLEB128Size(int Value);
587
588     /// getULEB128Size - Compute the number of bytes required for an unsigned
589     /// leb128 value.
590
591     static unsigned getULEB128Size(unsigned Value);
592
593     // Accessors.
594     //
595     const Section *getTextSection() const {
596       return TextSection;
597     }
598     const Section *getDataSection() const {
599       return DataSection;
600     }
601     const char *getBSSSection() const {
602       return BSSSection;
603     }
604     const Section *getBSSSection_() const {
605       return BSSSection_;
606     }
607     const Section *getReadOnlySection() const {
608       return ReadOnlySection;
609     }
610     const Section *getSmallDataSection() const {
611       return SmallDataSection;
612     }
613     const Section *getSmallBSSSection() const {
614       return SmallBSSSection;
615     }
616     const Section *getSmallRODataSection() const {
617       return SmallRODataSection;
618     }
619     const Section *getTLSDataSection() const {
620       return TLSDataSection;
621     }
622     const Section *getTLSBSSSection() const {
623       return TLSBSSSection;
624     }
625     const char *getZeroFillDirective() const {
626       return ZeroFillDirective;
627     }
628     const char *getNonexecutableStackDirective() const {
629       return NonexecutableStackDirective;
630     }
631     bool needsSet() const {
632       return NeedsSet;
633     }
634     const char *getPCSymbol() const {
635       return PCSymbol;
636     }
637     char getSeparatorChar() const {
638       return SeparatorChar;
639     }
640     const char *getCommentString() const {
641       return CommentString;
642     }
643     const char *getGlobalPrefix() const {
644       return GlobalPrefix;
645     }
646     const char *getPrivateGlobalPrefix() const {
647       return PrivateGlobalPrefix;
648     }
649     const char *getLessPrivateGlobalPrefix() const {
650       return LessPrivateGlobalPrefix;
651     }
652     const char *getJumpTableSpecialLabelPrefix() const {
653       return JumpTableSpecialLabelPrefix;
654     }
655     const char *getGlobalVarAddrPrefix() const {
656       return GlobalVarAddrPrefix;
657     }
658     const char *getGlobalVarAddrSuffix() const {
659       return GlobalVarAddrSuffix;
660     }
661     const char *getFunctionAddrPrefix() const {
662       return FunctionAddrPrefix;
663     }
664     const char *getFunctionAddrSuffix() const {
665       return FunctionAddrSuffix;
666     }
667     const char *getPersonalityPrefix() const {
668       return PersonalityPrefix;
669     }
670     const char *getPersonalitySuffix() const {
671       return PersonalitySuffix;
672     }
673     bool getNeedsIndirectEncoding() const {
674       return NeedsIndirectEncoding;
675     }
676     const char *getInlineAsmStart() const {
677       return InlineAsmStart;
678     }
679     const char *getInlineAsmEnd() const {
680       return InlineAsmEnd;
681     }
682     unsigned getAssemblerDialect() const {
683       return AssemblerDialect;
684     }
685     const char *getStringConstantPrefix() const {
686       return StringConstantPrefix;
687     }
688     const char *getZeroDirective() const {
689       return ZeroDirective;
690     }
691     const char *getZeroDirectiveSuffix() const {
692       return ZeroDirectiveSuffix;
693     }
694     const char *getAsciiDirective() const {
695       return AsciiDirective;
696     }
697     const char *getAscizDirective() const {
698       return AscizDirective;
699     }
700     const char *getData8bitsDirective() const {
701       return Data8bitsDirective;
702     }
703     const char *getData16bitsDirective() const {
704       return Data16bitsDirective;
705     }
706     const char *getData32bitsDirective() const {
707       return Data32bitsDirective;
708     }
709     const char *getData64bitsDirective() const {
710       return Data64bitsDirective;
711     }
712     const char *getJumpTableDirective() const {
713       return JumpTableDirective;
714     }
715     const char *getAlignDirective() const {
716       return AlignDirective;
717     }
718     bool getAlignmentIsInBytes() const {
719       return AlignmentIsInBytes;
720     }
721     unsigned getTextAlignFillValue() const {
722       return TextAlignFillValue;
723     }
724     const char *getSwitchToSectionDirective() const {
725       return SwitchToSectionDirective;
726     }
727     const char *getTextSectionStartSuffix() const {
728       return TextSectionStartSuffix;
729     }
730     const char *getDataSectionStartSuffix() const {
731       return DataSectionStartSuffix;
732     }
733     const char *getSectionEndDirectiveSuffix() const {
734       return SectionEndDirectiveSuffix;
735     }
736     const char *getConstantPoolSection() const {
737       return ConstantPoolSection;
738     }
739     const char *getJumpTableDataSection() const {
740       return JumpTableDataSection;
741     }
742     const char *getCStringSection() const {
743       return CStringSection;
744     }
745     const Section *getCStringSection_() const {
746       return CStringSection_;
747     }
748     const char *getStaticCtorsSection() const {
749       return StaticCtorsSection;
750     }
751     const char *getStaticDtorsSection() const {
752       return StaticDtorsSection;
753     }
754     const char *getGlobalDirective() const {
755       return GlobalDirective;
756     }
757     const char *getSetDirective() const {
758       return SetDirective;
759     }
760     const char *getLCOMMDirective() const {
761       return LCOMMDirective;
762     }
763     const char *getCOMMDirective() const {
764       return COMMDirective;
765     }
766     bool getCOMMDirectiveTakesAlignment() const {
767       return COMMDirectiveTakesAlignment;
768     }
769     bool hasDotTypeDotSizeDirective() const {
770       return HasDotTypeDotSizeDirective;
771     }
772     bool hasSingleParameterDotFile() const {
773       return HasSingleParameterDotFile;
774     }
775     const char *getUsedDirective() const {
776       return UsedDirective;
777     }
778     const char *getWeakRefDirective() const {
779       return WeakRefDirective;
780     }
781     const char *getWeakDefDirective() const {
782       return WeakDefDirective;
783     }
784     const char *getHiddenDirective() const {
785       return HiddenDirective;
786     }
787     const char *getProtectedDirective() const {
788       return ProtectedDirective;
789     }
790     bool isAbsoluteDebugSectionOffsets() const {
791       return AbsoluteDebugSectionOffsets;
792     }
793     bool isAbsoluteEHSectionOffsets() const {
794       return AbsoluteEHSectionOffsets;
795     }
796     bool hasLEB128() const {
797       return HasLEB128;
798     }
799     bool hasDotLocAndDotFile() const {
800       return HasDotLocAndDotFile;
801     }
802     bool doesSupportDebugInformation() const {
803       return SupportsDebugInformation;
804     }
805     bool doesSupportExceptionHandling() const {
806       return SupportsExceptionHandling;
807     }
808     bool doesDwarfRequireFrameSection() const {
809       return DwarfRequiresFrameSection;
810     }
811     const char *getGlobalEHDirective() const {
812       return GlobalEHDirective;
813     }
814     bool getSupportsWeakOmittedEHFrame() const {
815       return SupportsWeakOmittedEHFrame;
816     }
817     const char *getDwarfSectionOffsetDirective() const {
818       return DwarfSectionOffsetDirective;
819     }
820     const char *getDwarfAbbrevSection() const {
821       return DwarfAbbrevSection;
822     }
823     const char *getDwarfInfoSection() const {
824       return DwarfInfoSection;
825     }
826     const char *getDwarfLineSection() const {
827       return DwarfLineSection;
828     }
829     const char *getDwarfFrameSection() const {
830       return DwarfFrameSection;
831     }
832     const char *getDwarfPubNamesSection() const {
833       return DwarfPubNamesSection;
834     }
835     const char *getDwarfPubTypesSection() const {
836       return DwarfPubTypesSection;
837     }
838     const char *getDwarfStrSection() const {
839       return DwarfStrSection;
840     }
841     const char *getDwarfLocSection() const {
842       return DwarfLocSection;
843     }
844     const char *getDwarfARangesSection() const {
845       return DwarfARangesSection;
846     }
847     const char *getDwarfRangesSection() const {
848       return DwarfRangesSection;
849     }
850     const char *getDwarfMacInfoSection() const {
851       return DwarfMacInfoSection;
852     }
853     const char *getDwarfEHFrameSection() const {
854       return DwarfEHFrameSection;
855     }
856     const char *getDwarfExceptionSection() const {
857       return DwarfExceptionSection;
858     }
859     const char *const *getAsmCBE() const {
860       return AsmTransCBE;
861     }
862   };
863 }
864
865 #endif