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