LLVM API Documentation

TargetAsmInfo.h

Go to the documentation of this file.
00001 //===-- llvm/Target/TargetAsmInfo.h - Asm info ------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains a class to be used as the basis for target specific
00011 // asm writers.  This class primarily takes care of global printing constants,
00012 // which are used in very similar ways across all targets.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_TARGET_ASM_INFO_H
00017 #define LLVM_TARGET_ASM_INFO_H
00018 
00019 #include "llvm/ADT/DenseMap.h"
00020 #include "llvm/ADT/StringMap.h"
00021 #include "llvm/Support/DataTypes.h"
00022 #include <string>
00023 
00024 namespace llvm {
00025   // DWARF encoding query type
00026   namespace DwarfEncoding {
00027     enum Target {
00028       Data       = 0,
00029       CodeLabels = 1,
00030       Functions  = 2
00031     };
00032   }
00033 
00034   namespace SectionKind {
00035     enum Kind {
00036       Unknown = 0,      ///< Custom section
00037       Text,             ///< Text section
00038       Data,             ///< Data section
00039       BSS,              ///< BSS section
00040       ROData,           ///< Readonly data section
00041       RODataMergeStr,   ///< Readonly data section (mergeable strings)
00042       RODataMergeConst, ///< Readonly data section (mergeable constants)
00043       SmallData,        ///< Small data section
00044       SmallBSS,         ///< Small bss section
00045       SmallROData,      ///< Small readonly section
00046       ThreadData,       ///< Initialized TLS data objects
00047       ThreadBSS         ///< Uninitialized TLS data objects
00048     };
00049 
00050     static inline bool isReadOnly(Kind K) {
00051       return (K == SectionKind::ROData ||
00052               K == SectionKind::RODataMergeConst ||
00053               K == SectionKind::RODataMergeStr ||
00054               K == SectionKind::SmallROData);
00055     }
00056 
00057     static inline bool isBSS(Kind K) {
00058       return (K == SectionKind::BSS ||
00059               K == SectionKind::SmallBSS);
00060     }
00061   }
00062 
00063   namespace SectionFlags {
00064     const unsigned Invalid    = -1U;
00065     const unsigned None       = 0;
00066     const unsigned Code       = 1 << 0;  ///< Section contains code
00067     const unsigned Writeable  = 1 << 1;  ///< Section is writeable
00068     const unsigned BSS        = 1 << 2;  ///< Section contains only zeroes
00069     const unsigned Mergeable  = 1 << 3;  ///< Section contains mergeable data
00070     const unsigned Strings    = 1 << 4;  ///< Section contains C-type strings
00071     const unsigned TLS        = 1 << 5;  ///< Section contains thread-local data
00072     const unsigned Debug      = 1 << 6;  ///< Section contains debug data
00073     const unsigned Linkonce   = 1 << 7;  ///< Section is linkonce
00074     const unsigned Small      = 1 << 8;  ///< Section is small
00075     const unsigned TypeFlags  = 0xFF;
00076     // Some gap for future flags
00077     const unsigned Named      = 1 << 23; ///< Section is named
00078     const unsigned EntitySize = 0xFF << 24; ///< Entity size for mergeable stuff
00079 
00080     static inline unsigned getEntitySize(unsigned Flags) {
00081       return (Flags >> 24) & 0xFF;
00082     }
00083 
00084     static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
00085       return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24));
00086     }
00087 
00088     struct KeyInfo {
00089       static inline unsigned getEmptyKey() { return Invalid; }
00090       static inline unsigned getTombstoneKey() { return Invalid - 1; }
00091       static unsigned getHashValue(const unsigned &Key) { return Key; }
00092       static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
00093       static bool isPod() { return true; }
00094     };
00095 
00096     typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
00097   }
00098 
00099   class TargetMachine;
00100   class CallInst;
00101   class GlobalValue;
00102   class Type;
00103   class Mangler;
00104 
00105   class Section {
00106     friend class TargetAsmInfo;
00107     friend class StringMapEntry<Section>;
00108 
00109     std::string Name;
00110     unsigned Flags;
00111 
00112     explicit Section(unsigned F = SectionFlags::Invalid):Flags(F) { }
00113   public:
00114     bool isNamed() const { return Flags & SectionFlags::Named; }
00115     unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
00116 
00117     const std::string& getName() const { return Name; }
00118     unsigned getFlags() const { return Flags; }
00119   };
00120 
00121   /// TargetAsmInfo - This class is intended to be used as a base class for asm
00122   /// properties and features specific to the target.
00123   class TargetAsmInfo {
00124   private:
00125     mutable StringMap<Section> Sections;
00126     mutable SectionFlags::FlagsStringsMapType FlagsStrings;
00127     void fillDefaultValues();
00128   protected:
00129     /// TM - The current TargetMachine.
00130     const TargetMachine &TM;
00131 
00132     //===------------------------------------------------------------------===//
00133     // Properties to be set by the target writer, used to configure asm printer.
00134     //
00135 
00136     /// TextSection - Section directive for standard text.
00137     ///
00138     const Section *TextSection;           // Defaults to ".text".
00139 
00140     /// DataSection - Section directive for standard data.
00141     ///
00142     const Section *DataSection;           // Defaults to ".data".
00143 
00144     /// BSSSection - Section directive for uninitialized data.  Null if this
00145     /// target doesn't support a BSS section.
00146     ///
00147     const char *BSSSection;               // Default to ".bss".
00148     const Section *BSSSection_;
00149 
00150     /// ReadOnlySection - This is the directive that is emitted to switch to a
00151     /// read-only section for constant data (e.g. data declared const,
00152     /// jump tables).
00153     const Section *ReadOnlySection;       // Defaults to NULL
00154 
00155     /// SmallDataSection - This is the directive that is emitted to switch to a
00156     /// small data section.
00157     ///
00158     const Section *SmallDataSection;      // Defaults to NULL
00159 
00160     /// SmallBSSSection - This is the directive that is emitted to switch to a
00161     /// small bss section.
00162     ///
00163     const Section *SmallBSSSection;       // Defaults to NULL
00164 
00165     /// SmallRODataSection - This is the directive that is emitted to switch to 
00166     /// a small read-only data section.
00167     ///
00168     const Section *SmallRODataSection;    // Defaults to NULL
00169 
00170     /// TLSDataSection - Section directive for Thread Local data.
00171     ///
00172     const Section *TLSDataSection;        // Defaults to ".tdata".
00173 
00174     /// TLSBSSSection - Section directive for Thread Local uninitialized data.
00175     /// Null if this target doesn't support a BSS section.
00176     ///
00177     const Section *TLSBSSSection;         // Defaults to ".tbss".
00178 
00179     /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
00180     /// section on this target.  Null if this target doesn't support zerofill.
00181     const char *ZeroFillDirective;        // Default is null.
00182 
00183     /// NonexecutableStackDirective - Directive for declaring to the
00184     /// linker and beyond that the emitted code does not require stack
00185     /// memory to be executable.
00186     const char *NonexecutableStackDirective; // Default is null.
00187 
00188     /// NeedsSet - True if target asm treats expressions in data directives
00189     /// as linktime-relocatable.  For assembly-time computation, we need to
00190     /// use a .set.  Thus:
00191     /// .set w, x-y
00192     /// .long w
00193     /// is computed at assembly time, while
00194     /// .long x-y
00195     /// is relocated if the relative locations of x and y change at linktime.
00196     /// We want both these things in different places.
00197     bool NeedsSet;                        // Defaults to false.
00198     
00199     /// MaxInstLength - This is the maximum possible length of an instruction,
00200     /// which is needed to compute the size of an inline asm.
00201     unsigned MaxInstLength;               // Defaults to 4.
00202     
00203     /// PCSymbol - The symbol used to represent the current PC.  Used in PC
00204     /// relative expressions.
00205     const char *PCSymbol;                 // Defaults to "$".
00206 
00207     /// SeparatorChar - This character, if specified, is used to separate
00208     /// instructions from each other when on the same line.  This is used to
00209     /// measure inline asm instructions.
00210     char SeparatorChar;                   // Defaults to ';'
00211 
00212     /// CommentString - This indicates the comment character used by the
00213     /// assembler.
00214     const char *CommentString;            // Defaults to "#"
00215 
00216     /// GlobalPrefix - If this is set to a non-empty string, it is prepended
00217     /// onto all global symbols.  This is often used for "_" or ".".
00218     const char *GlobalPrefix;             // Defaults to ""
00219 
00220     /// PrivateGlobalPrefix - This prefix is used for globals like constant
00221     /// pool entries that are completely private to the .s file and should not
00222     /// have names in the .o file.  This is often "." or "L".
00223     const char *PrivateGlobalPrefix;      // Defaults to "."
00224     
00225     /// LessPrivateGlobalPrefix - This prefix is used for symbols that should
00226     /// be passed through the assembler but be removed by the linker.  This
00227     /// is "l" on Darwin, currently used for some ObjC metadata.
00228     const char *LessPrivateGlobalPrefix;      // Defaults to ""
00229     
00230     /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
00231     /// emitted before jump tables with the specified prefix.
00232     const char *JumpTableSpecialLabelPrefix;  // Default to null.
00233     
00234     /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
00235     /// will enclose any GlobalVariable (that isn't a function)
00236     ///
00237     const char *GlobalVarAddrPrefix;      // Defaults to ""
00238     const char *GlobalVarAddrSuffix;      // Defaults to ""
00239 
00240     /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings
00241     /// will enclose any GlobalVariable that points to a function.
00242     /// For example, this is used by the IA64 backend to materialize
00243     /// function descriptors, by decorating the ".data8" object with the
00244     /// @verbatim @fptr( ) @endverbatim
00245     /// link-relocation operator.
00246     ///
00247     const char *FunctionAddrPrefix;       // Defaults to ""
00248     const char *FunctionAddrSuffix;       // Defaults to ""
00249 
00250     /// PersonalityPrefix/Suffix - If these are nonempty, these strings will
00251     /// enclose any personality function in the common frame section.
00252     /// 
00253     const char *PersonalityPrefix;        // Defaults to ""
00254     const char *PersonalitySuffix;        // Defaults to ""
00255 
00256     /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit
00257     /// for EH in Dwarf.
00258     /// 
00259     bool NeedsIndirectEncoding;           // Defaults to false
00260 
00261     /// InlineAsmStart/End - If these are nonempty, they contain a directive to
00262     /// emit before and after an inline assembly statement.
00263     const char *InlineAsmStart;           // Defaults to "#APP\n"
00264     const char *InlineAsmEnd;             // Defaults to "#NO_APP\n"
00265 
00266     /// AssemblerDialect - Which dialect of an assembler variant to use.
00267     unsigned AssemblerDialect;            // Defaults to 0
00268 
00269     /// StringConstantPrefix - Prefix for FEs to use when generating unnamed
00270     /// constant strings.  These names get run through the Mangler later; if
00271     /// you want the Mangler not to add the GlobalPrefix as well, 
00272     /// use '\1' as the first character.
00273     const char *StringConstantPrefix;     // Defaults to ".str"
00274 
00275     //===--- Data Emission Directives -------------------------------------===//
00276 
00277     /// ZeroDirective - this should be set to the directive used to get some
00278     /// number of zero bytes emitted to the current section.  Common cases are
00279     /// "\t.zero\t" and "\t.space\t".  If this is set to null, the
00280     /// Data*bitsDirective's will be used to emit zero bytes.
00281     const char *ZeroDirective;            // Defaults to "\t.zero\t"
00282     const char *ZeroDirectiveSuffix;      // Defaults to ""
00283 
00284     /// AsciiDirective - This directive allows emission of an ascii string with
00285     /// the standard C escape characters embedded into it.
00286     const char *AsciiDirective;           // Defaults to "\t.ascii\t"
00287     
00288     /// AscizDirective - If not null, this allows for special handling of
00289     /// zero terminated strings on this target.  This is commonly supported as
00290     /// ".asciz".  If a target doesn't support this, it can be set to null.
00291     const char *AscizDirective;           // Defaults to "\t.asciz\t"
00292 
00293     /// DataDirectives - These directives are used to output some unit of
00294     /// integer data to the current section.  If a data directive is set to
00295     /// null, smaller data directives will be used to emit the large sizes.
00296     const char *Data8bitsDirective;       // Defaults to "\t.byte\t"
00297     const char *Data16bitsDirective;      // Defaults to "\t.short\t"
00298     const char *Data32bitsDirective;      // Defaults to "\t.long\t"
00299     const char *Data64bitsDirective;      // Defaults to "\t.quad\t"
00300 
00301     /// getASDirective - Targets can override it to provide different data
00302     /// directives for various sizes and non-default address spaces.
00303     virtual const char *getASDirective(unsigned size, 
00304                                        unsigned AS) const {
00305       assert (AS > 0 
00306               && "Dont know the directives for default addr space");
00307       return NULL;
00308     }
00309 
00310     //===--- Alignment Information ----------------------------------------===//
00311 
00312     /// AlignDirective - The directive used to emit round up to an alignment
00313     /// boundary.
00314     ///
00315     const char *AlignDirective;           // Defaults to "\t.align\t"
00316 
00317     /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
00318     /// emits ".align N" directives, where N is the number of bytes to align to.
00319     /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
00320     /// boundary.
00321     bool AlignmentIsInBytes;              // Defaults to true
00322 
00323     /// TextAlignFillValue - If non-zero, this is used to fill the executable
00324     /// space created as the result of a alignment directive.
00325     unsigned TextAlignFillValue;
00326 
00327     //===--- Section Switching Directives ---------------------------------===//
00328     
00329     /// SwitchToSectionDirective - This is the directive used when we want to
00330     /// emit a global to an arbitrary section.  The section name is emited after
00331     /// this.
00332     const char *SwitchToSectionDirective; // Defaults to "\t.section\t"
00333     
00334     /// TextSectionStartSuffix - This is printed after each start of section
00335     /// directive for text sections.
00336     const char *TextSectionStartSuffix;   // Defaults to "".
00337 
00338     /// DataSectionStartSuffix - This is printed after each start of section
00339     /// directive for data sections.
00340     const char *DataSectionStartSuffix;   // Defaults to "".
00341     
00342     /// SectionEndDirectiveSuffix - If non-null, the asm printer will close each
00343     /// section with the section name and this suffix printed.
00344     const char *SectionEndDirectiveSuffix;// Defaults to null.
00345     
00346     /// ConstantPoolSection - This is the section that we SwitchToSection right
00347     /// before emitting the constant pool for a function.
00348     const char *ConstantPoolSection;      // Defaults to "\t.section .rodata"
00349 
00350     /// JumpTableDataSection - This is the section that we SwitchToSection right
00351     /// before emitting the jump tables for a function when the relocation model
00352     /// is not PIC.
00353     const char *JumpTableDataSection;     // Defaults to "\t.section .rodata"
00354     
00355     /// JumpTableDirective - if non-null, the directive to emit before a jump
00356     /// table.
00357     const char *JumpTableDirective;
00358 
00359     /// CStringSection - If not null, this allows for special handling of
00360     /// cstring constants (null terminated string that does not contain any
00361     /// other null bytes) on this target. This is commonly supported as
00362     /// ".cstring".
00363     const char *CStringSection;           // Defaults to NULL
00364     const Section *CStringSection_;
00365 
00366     /// StaticCtorsSection - This is the directive that is emitted to switch to
00367     /// a section to emit the static constructor list.
00368     /// Defaults to "\t.section .ctors,\"aw\",@progbits".
00369     const char *StaticCtorsSection;
00370 
00371     /// StaticDtorsSection - This is the directive that is emitted to switch to
00372     /// a section to emit the static destructor list.
00373     /// Defaults to "\t.section .dtors,\"aw\",@progbits".
00374     const char *StaticDtorsSection;
00375 
00376     //===--- Global Variable Emission Directives --------------------------===//
00377     
00378     /// GlobalDirective - This is the directive used to declare a global entity.
00379     ///
00380     const char *GlobalDirective;          // Defaults to NULL.
00381     
00382     /// SetDirective - This is the name of a directive that can be used to tell
00383     /// the assembler to set the value of a variable to some expression.
00384     const char *SetDirective;             // Defaults to null.
00385     
00386     /// LCOMMDirective - This is the name of a directive (if supported) that can
00387     /// be used to efficiently declare a local (internal) block of zero
00388     /// initialized data in the .bss/.data section.  The syntax expected is:
00389     /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES, ALIGNMENT
00390     /// @endverbatim
00391     const char *LCOMMDirective;           // Defaults to null.
00392     
00393     const char *COMMDirective;            // Defaults to "\t.comm\t".
00394 
00395     /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
00396     /// argument that specifies the alignment of the declaration.
00397     bool COMMDirectiveTakesAlignment;     // Defaults to true.
00398     
00399     /// HasDotTypeDotSizeDirective - True if the target has .type and .size
00400     /// directives, this is true for most ELF targets.
00401     bool HasDotTypeDotSizeDirective;      // Defaults to true.
00402 
00403     /// HasSingleParameterDotFile - True if the target has a single parameter
00404     /// .file directive, this is true for ELF targets.
00405     bool HasSingleParameterDotFile;      // Defaults to true.
00406 
00407     /// UsedDirective - This directive, if non-null, is used to declare a global
00408     /// as being used somehow that the assembler can't see.  This prevents dead
00409     /// code elimination on some targets.
00410     const char *UsedDirective;            // Defaults to null.
00411 
00412     /// WeakRefDirective - This directive, if non-null, is used to declare a
00413     /// global as being a weak undefined symbol.
00414     const char *WeakRefDirective;         // Defaults to null.
00415     
00416     /// WeakDefDirective - This directive, if non-null, is used to declare a
00417     /// global as being a weak defined symbol.
00418     const char *WeakDefDirective;         // Defaults to null.
00419     
00420     /// HiddenDirective - This directive, if non-null, is used to declare a
00421     /// global or function as having hidden visibility.
00422     const char *HiddenDirective;          // Defaults to "\t.hidden\t".
00423 
00424     /// ProtectedDirective - This directive, if non-null, is used to declare a
00425     /// global or function as having protected visibility.
00426     const char *ProtectedDirective;       // Defaults to "\t.protected\t".
00427 
00428     //===--- Dwarf Emission Directives -----------------------------------===//
00429 
00430     /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
00431     /// offsets for debug information. Defaults to false.
00432     bool AbsoluteDebugSectionOffsets;
00433 
00434     /// AbsoluteEHSectionOffsets - True if we should emit abolute section
00435     /// offsets for EH information. Defaults to false.
00436     bool AbsoluteEHSectionOffsets;
00437 
00438     /// HasLEB128 - True if target asm supports leb128 directives.
00439     ///
00440     bool HasLEB128; // Defaults to false.
00441 
00442     /// hasDotLocAndDotFile - True if target asm supports .loc and .file
00443     /// directives for emitting debugging information.
00444     ///
00445     bool HasDotLocAndDotFile; // Defaults to false.
00446 
00447     /// SupportsDebugInformation - True if target supports emission of debugging
00448     /// information.
00449     bool SupportsDebugInformation;
00450 
00451     /// SupportsExceptionHandling - True if target supports
00452     /// exception handling.
00453     ///
00454     bool SupportsExceptionHandling; // Defaults to false.
00455 
00456     /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
00457     ///
00458     bool DwarfRequiresFrameSection; // Defaults to true.
00459 
00460     /// SupportsMacInfo - true if the Dwarf output supports macro information
00461     ///
00462     bool SupportsMacInfoSection;            // Defaults to true
00463 
00464     /// NonLocalEHFrameLabel - If set, the EH_frame label needs to be non-local.
00465     ///
00466     bool NonLocalEHFrameLabel;              // Defaults to false.
00467 
00468     /// GlobalEHDirective - This is the directive used to make exception frame
00469     /// tables globally visible.
00470     ///
00471     const char *GlobalEHDirective;          // Defaults to NULL.
00472 
00473     /// SupportsWeakEmptyEHFrame - True if target assembler and linker will
00474     /// handle a weak_definition of constant 0 for an omitted EH frame.
00475     bool SupportsWeakOmittedEHFrame;  // Defaults to true.
00476 
00477     /// DwarfSectionOffsetDirective - Special section offset directive.
00478     const char* DwarfSectionOffsetDirective; // Defaults to NULL
00479     
00480     /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
00481     ///
00482     const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
00483 
00484     /// DwarfInfoSection - Section directive for Dwarf info.
00485     ///
00486     const char *DwarfInfoSection; // Defaults to ".debug_info".
00487 
00488     /// DwarfLineSection - Section directive for Dwarf info.
00489     ///
00490     const char *DwarfLineSection; // Defaults to ".debug_line".
00491     
00492     /// DwarfFrameSection - Section directive for Dwarf info.
00493     ///
00494     const char *DwarfFrameSection; // Defaults to ".debug_frame".
00495     
00496     /// DwarfPubNamesSection - Section directive for Dwarf info.
00497     ///
00498     const char *DwarfPubNamesSection; // Defaults to ".debug_pubnames".
00499     
00500     /// DwarfPubTypesSection - Section directive for Dwarf info.
00501     ///
00502     const char *DwarfPubTypesSection; // Defaults to ".debug_pubtypes".
00503     
00504     /// DwarfStrSection - Section directive for Dwarf info.
00505     ///
00506     const char *DwarfStrSection; // Defaults to ".debug_str".
00507 
00508     /// DwarfLocSection - Section directive for Dwarf info.
00509     ///
00510     const char *DwarfLocSection; // Defaults to ".debug_loc".
00511 
00512     /// DwarfARangesSection - Section directive for Dwarf info.
00513     ///
00514     const char *DwarfARangesSection; // Defaults to ".debug_aranges".
00515 
00516     /// DwarfRangesSection - Section directive for Dwarf info.
00517     ///
00518     const char *DwarfRangesSection; // Defaults to ".debug_ranges".
00519 
00520     /// DwarfMacInfoSection - Section directive for Dwarf info.
00521     ///
00522     const char *DwarfMacInfoSection; // Defaults to ".debug_macinfo".
00523     
00524     /// DwarfEHFrameSection - Section directive for Exception frames.
00525     ///
00526     const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
00527     
00528     /// DwarfExceptionSection - Section directive for Exception table.
00529     ///
00530     const char *DwarfExceptionSection; // Defaults to ".gcc_except_table".
00531 
00532     //===--- CBE Asm Translation Table -----------------------------------===//
00533 
00534     const char *const *AsmTransCBE; // Defaults to empty
00535 
00536   public:
00537     explicit TargetAsmInfo(const TargetMachine &TM);
00538     virtual ~TargetAsmInfo();
00539 
00540     const Section* getNamedSection(const char *Name,
00541                                    unsigned Flags = SectionFlags::None,
00542                                    bool Override = false) const;
00543     const Section* getUnnamedSection(const char *Directive,
00544                                      unsigned Flags = SectionFlags::None,
00545                                      bool Override = false) const;
00546 
00547     /// Measure the specified inline asm to determine an approximation of its
00548     /// length.
00549     virtual unsigned getInlineAsmLength(const char *Str) const;
00550 
00551     /// ExpandInlineAsm - This hook allows the target to expand an inline asm
00552     /// call to be explicit llvm code if it wants to.  This is useful for
00553     /// turning simple inline asms into LLVM intrinsics, which gives the
00554     /// compiler more information about the behavior of the code.
00555     virtual bool ExpandInlineAsm(CallInst *CI) const {
00556       return false;
00557     }
00558 
00559     /// emitUsedDirectiveFor - This hook allows targets to selectively decide
00560     /// not to emit the UsedDirective for some symbols in llvm.used.
00561     virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
00562                                       Mangler *Mang) const {
00563       return (GV!=0);
00564     }
00565 
00566     /// PreferredEHDataFormat - This hook allows the target to select data
00567     /// format used for encoding pointers in exception handling data. Reason is
00568     /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
00569     /// if the symbol can be relocated.
00570     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
00571                                            bool Global) const;
00572 
00573     /// SectionKindForGlobal - This hook allows the target to select proper
00574     /// section kind used for global emission.
00575     virtual SectionKind::Kind
00576     SectionKindForGlobal(const GlobalValue *GV) const;
00577 
00578 
00579     /// SectionFlagsForGlobal - This hook allows the target to select proper
00580     /// section flags either for given global or for section.
00581     virtual unsigned
00582     SectionFlagsForGlobal(const GlobalValue *GV = NULL,
00583                           const char* name = NULL) const;
00584 
00585     /// SectionForGlobal - This hooks returns proper section name for given
00586     /// global with all necessary flags and marks.
00587     virtual const Section* SectionForGlobal(const GlobalValue *GV) const;
00588 
00589     // Helper methods for SectionForGlobal
00590     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
00591                                                SectionKind::Kind kind) const;
00592 
00593     const std::string& getSectionFlags(unsigned Flags) const;
00594     virtual std::string printSectionFlags(unsigned flags) const { return ""; }
00595 
00596     virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
00597 
00598     virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
00599 
00600     /// getSLEB128Size - Compute the number of bytes required for a signed
00601     /// leb128 value.
00602 
00603     static unsigned getSLEB128Size(int Value);
00604 
00605     /// getULEB128Size - Compute the number of bytes required for an unsigned
00606     /// leb128 value.
00607 
00608     static unsigned getULEB128Size(unsigned Value);
00609 
00610     // Data directive accessors
00611     //
00612     const char *getData8bitsDirective(unsigned AS = 0) const {
00613       return AS == 0 ? Data8bitsDirective : getASDirective(8, AS);
00614     }
00615     const char *getData16bitsDirective(unsigned AS = 0) const {
00616       return AS == 0 ? Data16bitsDirective : getASDirective(16, AS);
00617     }
00618     const char *getData32bitsDirective(unsigned AS = 0) const {
00619       return AS == 0 ? Data32bitsDirective : getASDirective(32, AS);
00620     }
00621     const char *getData64bitsDirective(unsigned AS = 0) const {
00622       return AS == 0 ? Data64bitsDirective : getASDirective(64, AS);
00623     }
00624 
00625 
00626     // Accessors.
00627     //
00628     const Section *getTextSection() const {
00629       return TextSection;
00630     }
00631     const Section *getDataSection() const {
00632       return DataSection;
00633     }
00634     const char *getBSSSection() const {
00635       return BSSSection;
00636     }
00637     const Section *getBSSSection_() const {
00638       return BSSSection_;
00639     }
00640     const Section *getReadOnlySection() const {
00641       return ReadOnlySection;
00642     }
00643     const Section *getSmallDataSection() const {
00644       return SmallDataSection;
00645     }
00646     const Section *getSmallBSSSection() const {
00647       return SmallBSSSection;
00648     }
00649     const Section *getSmallRODataSection() const {
00650       return SmallRODataSection;
00651     }
00652     const Section *getTLSDataSection() const {
00653       return TLSDataSection;
00654     }
00655     const Section *getTLSBSSSection() const {
00656       return TLSBSSSection;
00657     }
00658     const char *getZeroFillDirective() const {
00659       return ZeroFillDirective;
00660     }
00661     const char *getNonexecutableStackDirective() const {
00662       return NonexecutableStackDirective;
00663     }
00664     bool needsSet() const {
00665       return NeedsSet;
00666     }
00667     const char *getPCSymbol() const {
00668       return PCSymbol;
00669     }
00670     char getSeparatorChar() const {
00671       return SeparatorChar;
00672     }
00673     const char *getCommentString() const {
00674       return CommentString;
00675     }
00676     const char *getGlobalPrefix() const {
00677       return GlobalPrefix;
00678     }
00679     const char *getPrivateGlobalPrefix() const {
00680       return PrivateGlobalPrefix;
00681     }
00682     /// EHGlobalPrefix - Prefix for EH_frame and the .eh symbols.
00683     /// This is normally PrivateGlobalPrefix, but some targets want
00684     /// these symbols to be visible.
00685     virtual const char *getEHGlobalPrefix() const {
00686       return PrivateGlobalPrefix;
00687     }
00688     const char *getLessPrivateGlobalPrefix() const {
00689       return LessPrivateGlobalPrefix;
00690     }
00691     const char *getJumpTableSpecialLabelPrefix() const {
00692       return JumpTableSpecialLabelPrefix;
00693     }
00694     const char *getGlobalVarAddrPrefix() const {
00695       return GlobalVarAddrPrefix;
00696     }
00697     const char *getGlobalVarAddrSuffix() const {
00698       return GlobalVarAddrSuffix;
00699     }
00700     const char *getFunctionAddrPrefix() const {
00701       return FunctionAddrPrefix;
00702     }
00703     const char *getFunctionAddrSuffix() const {
00704       return FunctionAddrSuffix;
00705     }
00706     const char *getPersonalityPrefix() const {
00707       return PersonalityPrefix;
00708     }
00709     const char *getPersonalitySuffix() const {
00710       return PersonalitySuffix;
00711     }
00712     bool getNeedsIndirectEncoding() const {
00713       return NeedsIndirectEncoding;
00714     }
00715     const char *getInlineAsmStart() const {
00716       return InlineAsmStart;
00717     }
00718     const char *getInlineAsmEnd() const {
00719       return InlineAsmEnd;
00720     }
00721     unsigned getAssemblerDialect() const {
00722       return AssemblerDialect;
00723     }
00724     const char *getStringConstantPrefix() const {
00725       return StringConstantPrefix;
00726     }
00727     const char *getZeroDirective() const {
00728       return ZeroDirective;
00729     }
00730     const char *getZeroDirectiveSuffix() const {
00731       return ZeroDirectiveSuffix;
00732     }
00733     const char *getAsciiDirective() const {
00734       return AsciiDirective;
00735     }
00736     const char *getAscizDirective() const {
00737       return AscizDirective;
00738     }
00739     const char *getJumpTableDirective() const {
00740       return JumpTableDirective;
00741     }
00742     const char *getAlignDirective() const {
00743       return AlignDirective;
00744     }
00745     bool getAlignmentIsInBytes() const {
00746       return AlignmentIsInBytes;
00747     }
00748     unsigned getTextAlignFillValue() const {
00749       return TextAlignFillValue;
00750     }
00751     const char *getSwitchToSectionDirective() const {
00752       return SwitchToSectionDirective;
00753     }
00754     const char *getTextSectionStartSuffix() const {
00755       return TextSectionStartSuffix;
00756     }
00757     const char *getDataSectionStartSuffix() const {
00758       return DataSectionStartSuffix;
00759     }
00760     const char *getSectionEndDirectiveSuffix() const {
00761       return SectionEndDirectiveSuffix;
00762     }
00763     const char *getConstantPoolSection() const {
00764       return ConstantPoolSection;
00765     }
00766     const char *getJumpTableDataSection() const {
00767       return JumpTableDataSection;
00768     }
00769     const char *getCStringSection() const {
00770       return CStringSection;
00771     }
00772     const Section *getCStringSection_() const {
00773       return CStringSection_;
00774     }
00775     const char *getStaticCtorsSection() const {
00776       return StaticCtorsSection;
00777     }
00778     const char *getStaticDtorsSection() const {
00779       return StaticDtorsSection;
00780     }
00781     const char *getGlobalDirective() const {
00782       return GlobalDirective;
00783     }
00784     const char *getSetDirective() const {
00785       return SetDirective;
00786     }
00787     const char *getLCOMMDirective() const {
00788       return LCOMMDirective;
00789     }
00790     const char *getCOMMDirective() const {
00791       return COMMDirective;
00792     }
00793     bool getCOMMDirectiveTakesAlignment() const {
00794       return COMMDirectiveTakesAlignment;
00795     }
00796     bool hasDotTypeDotSizeDirective() const {
00797       return HasDotTypeDotSizeDirective;
00798     }
00799     bool hasSingleParameterDotFile() const {
00800       return HasSingleParameterDotFile;
00801     }
00802     const char *getUsedDirective() const {
00803       return UsedDirective;
00804     }
00805     const char *getWeakRefDirective() const {
00806       return WeakRefDirective;
00807     }
00808     const char *getWeakDefDirective() const {
00809       return WeakDefDirective;
00810     }
00811     const char *getHiddenDirective() const {
00812       return HiddenDirective;
00813     }
00814     const char *getProtectedDirective() const {
00815       return ProtectedDirective;
00816     }
00817     bool isAbsoluteDebugSectionOffsets() const {
00818       return AbsoluteDebugSectionOffsets;
00819     }
00820     bool isAbsoluteEHSectionOffsets() const {
00821       return AbsoluteEHSectionOffsets;
00822     }
00823     bool hasLEB128() const {
00824       return HasLEB128;
00825     }
00826     bool hasDotLocAndDotFile() const {
00827       return HasDotLocAndDotFile;
00828     }
00829     bool doesSupportDebugInformation() const {
00830       return SupportsDebugInformation;
00831     }
00832     bool doesSupportExceptionHandling() const {
00833       return SupportsExceptionHandling;
00834     }
00835     bool doesDwarfRequireFrameSection() const {
00836       return DwarfRequiresFrameSection;
00837     }
00838     bool doesSupportMacInfoSection() const {
00839       return SupportsMacInfoSection;
00840     }
00841     bool doesRequireNonLocalEHFrameLabel() const {
00842       return NonLocalEHFrameLabel;
00843     }
00844     const char *getGlobalEHDirective() const {
00845       return GlobalEHDirective;
00846     }
00847     bool getSupportsWeakOmittedEHFrame() const {
00848       return SupportsWeakOmittedEHFrame;
00849     }
00850     const char *getDwarfSectionOffsetDirective() const {
00851       return DwarfSectionOffsetDirective;
00852     }
00853     const char *getDwarfAbbrevSection() const {
00854       return DwarfAbbrevSection;
00855     }
00856     const char *getDwarfInfoSection() const {
00857       return DwarfInfoSection;
00858     }
00859     const char *getDwarfLineSection() const {
00860       return DwarfLineSection;
00861     }
00862     const char *getDwarfFrameSection() const {
00863       return DwarfFrameSection;
00864     }
00865     const char *getDwarfPubNamesSection() const {
00866       return DwarfPubNamesSection;
00867     }
00868     const char *getDwarfPubTypesSection() const {
00869       return DwarfPubTypesSection;
00870     }
00871     const char *getDwarfStrSection() const {
00872       return DwarfStrSection;
00873     }
00874     const char *getDwarfLocSection() const {
00875       return DwarfLocSection;
00876     }
00877     const char *getDwarfARangesSection() const {
00878       return DwarfARangesSection;
00879     }
00880     const char *getDwarfRangesSection() const {
00881       return DwarfRangesSection;
00882     }
00883     const char *getDwarfMacInfoSection() const {
00884       return DwarfMacInfoSection;
00885     }
00886     const char *getDwarfEHFrameSection() const {
00887       return DwarfEHFrameSection;
00888     }
00889     const char *getDwarfExceptionSection() const {
00890       return DwarfExceptionSection;
00891     }
00892     const char *const *getAsmCBE() const {
00893       return AsmTransCBE;
00894     }
00895   };
00896 }
00897 
00898 #endif