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