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