MCAsmInfo.h revision 3420e7f360dab7712a9ec4f51d233c7e73642ec7
182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===//
282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//
382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//                     The LLVM Compiler Infrastructure
482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//
582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// This file is distributed under the University of Illinois Open Source
682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// License. See LICENSE.TXT for details.
782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//
882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===----------------------------------------------------------------------===//
982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//
1082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// This file contains a class to be used as the basis for target specific
1182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// asm writers.  This class primarily takes care of global printing constants,
1282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// which are used in very similar ways across all targets.
1382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//
1482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===----------------------------------------------------------------------===//
15af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner
1682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#ifndef LLVM_TARGET_ASM_INFO_H
1782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#define LLVM_TARGET_ASM_INFO_H
18af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner
192d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng#include "llvm/MC/MachineLocation.h"
20152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner#include "llvm/MC/MCDirectives.h"
2182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#include <cassert>
222d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng#include <vector>
2382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2482d748d55c549dd055528ed10dbb534618ca8115Chris Lattnernamespace llvm {
25bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCExpr;
26f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner  class MCSection;
27bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCStreamer;
28bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCSymbol;
29f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner  class MCContext;
30f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
313965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov  namespace ExceptionHandling {
32d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis    enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
333965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov  }
3482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
3536a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer  namespace LCOMM {
3636a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    enum LCOMMType { None, NoAlignment, ByteAlignment };
3736a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer  }
3836a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer
39d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis  /// MCAsmInfo - This class is intended to be used as a base class for asm
40d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis  /// properties and features specific to the target.
4182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  class MCAsmInfo {
4282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  protected:
4382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===------------------------------------------------------------------===//
4482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Properties to be set by the target writer, used to configure asm printer.
4582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
46ed4cf997abe9db574728aa6c1b06a9887848e7f0Jim Grosbach
471be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// PointerSize - Pointer size in bytes.
481be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///               Default is 4.
491be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    unsigned PointerSize;
501be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
511be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// IsLittleEndian - True if target is little endian.
521be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///                  Default is true.
531be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool IsLittleEndian;
541be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
551be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// StackGrowsUp - True if target stack grow up.
561be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///                Default is false.
571be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool StackGrowsUp;
5882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
59f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// HasSubsectionsViaSymbols - True if this target has the MachO
60f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// .subsections_via_symbols directive.
61f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    bool HasSubsectionsViaSymbols;           // Default is false.
62f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
63aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    /// HasMachoZeroFillDirective - True if this is a MachO target that supports
64aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    /// the macho-specific .zerofill directive for emitting BSS Symbols.
6571eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool HasMachoZeroFillDirective;               // Default is false.
66f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
6751f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    /// HasMachoTBSSDirective - True if this is a MachO target that supports
6851f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    /// the macho-specific .tbss directive for emitting thread local BSS Symbols
6951f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    bool HasMachoTBSSDirective;                 // Default is false.
70f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
7171eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should
7271eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// emit a ".reference .constructors_used" or ".reference .destructors_used"
7371eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// directive after the a static ctor/dtor list.  This directive is only
7471eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// emitted in Static relocation model.
7571eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool HasStaticCtorDtorReferenceInStaticMode;  // Default is false.
76f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
77767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// LinkerRequiresNonEmptyDwarfLines - True if the linker has a bug and
78767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// requires that the debug_line section be of a minimum size. In practice
79767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// such a linker requires a non empty line sequence if a file is present.
80767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    bool LinkerRequiresNonEmptyDwarfLines; // Default to false.
81767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola
8282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// MaxInstLength - This is the maximum possible length of an instruction,
8382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which is needed to compute the size of an inline asm.
84eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned MaxInstLength;                  // Defaults to 4.
85f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
8682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// PCSymbol - The symbol used to represent the current PC.  Used in PC
8782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// relative expressions.
88eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *PCSymbol;                    // Defaults to "$".
8982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
90d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    /// SeparatorString - This string, if specified, is used to separate
91d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    /// instructions from each other when on the same line.
92d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    const char *SeparatorString;             // Defaults to ';'
9382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
9482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// CommentColumn - This indicates the comment num (zero-based) at
9582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which asm comments should be printed.
9673163f875ad7e5d56aa7d0d29509eb1e04542742Daniel Dunbar    unsigned CommentColumn;                  // Defaults to 40
9782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
9882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// CommentString - This indicates the comment character used by the
9982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// assembler.
100eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *CommentString;               // Defaults to "#"
10182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
102e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    /// LabelSuffix - This is appended to emitted labels.
103e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    const char *LabelSuffix;                 // Defaults to ":"
104e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner
10582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// GlobalPrefix - If this is set to a non-empty string, it is prepended
10682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// onto all global symbols.  This is often used for "_" or ".".
107eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *GlobalPrefix;                // Defaults to ""
10882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
10982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// PrivateGlobalPrefix - This prefix is used for globals like constant
11082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// pool entries that are completely private to the .s file and should not
11182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// have names in the .o file.  This is often "." or "L".
112eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *PrivateGlobalPrefix;         // Defaults to "."
113f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
11482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
11582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// be passed through the assembler but be removed by the linker.  This
11682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// is "l" on Darwin, currently used for some ObjC metadata.
117eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *LinkerPrivateGlobalPrefix;   // Defaults to ""
118f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
11982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// InlineAsmStart/End - If these are nonempty, they contain a directive to
12082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// emit before and after an inline assembly statement.
121eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *InlineAsmStart;              // Defaults to "#APP\n"
122eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *InlineAsmEnd;                // Defaults to "#NO_APP\n"
12382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
124bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// Code16Directive, Code32Directive, Code64Directive - These are assembly
125bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// directives that tells the assembler to interpret the following
126bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// instructions differently.
127bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code16Directive;             // Defaults to ".code16"
128bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code32Directive;             // Defaults to ".code32"
129bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code64Directive;             // Defaults to ".code64"
130bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng
13182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AssemblerDialect - Which dialect of an assembler variant to use.
132eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned AssemblerDialect;               // Defaults to 0
13382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
13482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AllowQuotesInName - This is true if the assembler allows for complex
13582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// symbol names to be surrounded in quotes.  This defaults to false.
13682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool AllowQuotesInName;
137c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov
138c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    /// AllowNameToStartWithDigit - This is true if the assembler allows symbol
139c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    /// names to start with a digit (e.g., "0x0021").  This defaults to false.
140c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    bool AllowNameToStartWithDigit;
141b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang
142b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    /// AllowPeriodsInName - This is true if the assembler allows periods in
143b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    /// symbol names.  This defaults to true.
144b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    bool AllowPeriodsInName;
145b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang
1463420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    /// AllowUTF8 - This is true if the assembler accepts UTF-8 input.
1473420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    // FIXME: Make this a more general encoding setting?
1483420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    bool AllowUTF8;
1493420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt
15082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Data Emission Directives -------------------------------------===//
15182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
15282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// ZeroDirective - this should be set to the directive used to get some
15382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// number of zero bytes emitted to the current section.  Common cases are
15482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// "\t.zero\t" and "\t.space\t".  If this is set to null, the
15582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Data*bitsDirective's will be used to emit zero bytes.
156eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *ZeroDirective;               // Defaults to "\t.zero\t"
15782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
15882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AsciiDirective - This directive allows emission of an ascii string with
15982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// the standard C escape characters embedded into it.
160eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AsciiDirective;              // Defaults to "\t.ascii\t"
161f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
16282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AscizDirective - If not null, this allows for special handling of
16382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// zero terminated strings on this target.  This is commonly supported as
16482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// ".asciz".  If a target doesn't support this, it can be set to null.
165eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AscizDirective;              // Defaults to "\t.asciz\t"
16682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
16782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// DataDirectives - These directives are used to output some unit of
16882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// integer data to the current section.  If a data directive is set to
16982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// null, smaller data directives will be used to emit the large sizes.
170eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data8bitsDirective;          // Defaults to "\t.byte\t"
171eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data16bitsDirective;         // Defaults to "\t.short\t"
172eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data32bitsDirective;         // Defaults to "\t.long\t"
173eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data64bitsDirective;         // Defaults to "\t.quad\t"
17482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
1752fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// [Data|Code]Begin - These magic labels are used to marked a region as
1762fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// data or code, and are used to provide additional information for
1772fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// correct disassembly on targets that like to mix data and code within
1782fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// a segment.  These labels will be implicitly suffixed by the streamer
1792fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// to give them unique names.
1802fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *DataBegin;                   // Defaults to "$d."
1812fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *CodeBegin;                   // Defaults to "$a."
1822fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *JT8Begin;                    // Defaults to "$a."
1832fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *JT16Begin;                   // Defaults to "$a."
1842fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *JT32Begin;                   // Defaults to "$a."
1852fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    bool SupportsDataRegions;
1862fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson
1876c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// GPRel64Directive - if non-null, a directive that is used to emit a word
1886c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// which should be relocated as a 64-bit GP-relative offset, e.g. .gpdword
1896c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// on Mips.
1906c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    const char *GPRel64Directive;            // Defaults to NULL.
1916c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka
19278f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// GPRel32Directive - if non-null, a directive that is used to emit a word
19378f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword
19478f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// on Mips or .gprel32 on Alpha.
19578f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    const char *GPRel32Directive;            // Defaults to NULL.
196f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
19782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// getDataASDirective - Return the directive that should be used to emit
19882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// data of the specified size to the specified numeric address space.
19982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
20082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      assert(AS != 0 && "Don't know the directives for default addr space");
2015ec2e6b586bf4029763711d6860b57d312eb2d2eChris Lattner      return 0;
20282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
20382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
20482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun
20582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Style" syntax for section switching ("#alloc,#write" etc) instead of the
20682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// normal ELF syntax (,"a,w") in .section directives.
207eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool SunStyleELFSectionSwitchSyntax;     // Defaults to false.
20882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
20982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF
210f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach    /// '.section' directive before the '.bss' one. It's used for PPC/Linux
21182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which doesn't support the '.bss' directive only.
212eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool UsesELFSectionDirectiveForBSS;      // Defaults to false.
213f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
2148a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft
2158a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// style mangling for functions with X86_StdCall/X86_FastCall calling
2168a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// convention.
2178a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    bool HasMicrosoftFastStdCallMangling;    // Defaults to false.
218f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
21982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Alignment Information ----------------------------------------===//
22082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
22182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AlignDirective - The directive used to emit round up to an alignment
22282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// boundary.
22382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
224eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AlignDirective;              // Defaults to "\t.align\t"
22582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
22682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
22782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// emits ".align N" directives, where N is the number of bytes to align to.
22882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
22982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// boundary.
230eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool AlignmentIsInBytes;                 // Defaults to true
23182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
23282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// TextAlignFillValue - If non-zero, this is used to fill the executable
23382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// space created as the result of a alignment directive.
234eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned TextAlignFillValue;             // Defaults to 0
23582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
23682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Global Variable Emission Directives --------------------------===//
237f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
23882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// GlobalDirective - This is the directive used to declare a global entity.
23982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
240eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *GlobalDirective;             // Defaults to NULL.
24182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
242f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach    /// ExternDirective - This is the directive used to declare external
24382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// globals.
24482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
245eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *ExternDirective;             // Defaults to NULL.
246f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
247cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    /// HasSetDirective - True if the assembler supports the .set directive.
248cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    bool HasSetDirective;                    // Defaults to true.
249f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
25090a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    /// HasAggressiveSymbolFolding - False if the assembler requires that we use
2515d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// Lc = a - b
2525d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// .long Lc
25390a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    /// instead of
2545d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// .long a - b
25590a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    bool HasAggressiveSymbolFolding;           // Defaults to true.
2565d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola
25736a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    /// LCOMMDirectiveType - Describes if the target supports the .lcomm
25836a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    /// directive and whether it has an alignment parameter.
25936a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    LCOMM::LCOMMType LCOMMDirectiveType;     // Defaults to LCOMM::None.
260f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
2612e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    /// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
2622e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    /// alignment is to be specified in bytes instead of log2(n).
2632e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    bool COMMDirectiveAlignmentIsInBytes;    // Defaults to true;
264f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
26582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasDotTypeDotSizeDirective - True if the target has .type and .size
26682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// directives, this is true for most ELF targets.
267eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool HasDotTypeDotSizeDirective;         // Defaults to true.
26882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
26982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasSingleParameterDotFile - True if the target has a single parameter
27082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// .file directive, this is true for ELF targets.
271eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool HasSingleParameterDotFile;          // Defaults to true.
27282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2733a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip
2743a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    /// directive.
2753a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool HasNoDeadStrip;                     // Defaults to false.
27682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
277e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    /// HasSymbolResolver - True if this target supports the MachO
278e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    /// .symbol_resolver directive.
279e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    bool HasSymbolResolver;                     // Defaults to false.
280e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby
28182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// WeakRefDirective - This directive, if non-null, is used to declare a
28282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// global as being a weak undefined symbol.
283eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *WeakRefDirective;            // Defaults to NULL.
284f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
28582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// WeakDefDirective - This directive, if non-null, is used to declare a
28682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// global as being a weak defined symbol.
287eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *WeakDefDirective;            // Defaults to NULL.
28841eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner
28941eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    /// LinkOnceDirective - This directive, if non-null is used to declare a
29041eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    /// global as being a weak defined symbol.  This is used on cygwin/mingw.
29141eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *LinkOnceDirective;           // Defaults to NULL.
292f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
293152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to
294152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// declare a symbol as having hidden visibility.
295152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr HiddenVisibilityAttr;       // Defaults to MCSA_Hidden.
29682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2975129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    /// HiddenDeclarationVisibilityAttr - This attribute, if not MCSA_Invalid,
2985129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    /// is used to declare an undefined symbol as having hidden visibility.
2995129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    MCSymbolAttr HiddenDeclarationVisibilityAttr;   // Defaults to MCSA_Hidden.
3005129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings
3015129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings
302152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used
303152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// to declare a symbol as having protected visibility.
304152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr ProtectedVisibilityAttr;    // Defaults to MCSA_Protected
30582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
30682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Dwarf Emission Directives -----------------------------------===//
30782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
30882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasLEB128 - True if target asm supports leb128 directives.
309b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool HasLEB128;                          // Defaults to false.
31082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
31182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// SupportsDebugInformation - True if target supports emission of debugging
31282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// information.
313b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool SupportsDebugInformation;           // Defaults to false.
31482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
315b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    /// SupportsExceptionHandling - True if target supports exception handling.
316b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None
31782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
31882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
31982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// encode inline subroutine information.
320b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool DwarfUsesInlineInfoSection;         // Defaults to false.
32182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
32282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// DwarfSectionOffsetDirective - Special section offset directive.
32382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char* DwarfSectionOffsetDirective; // Defaults to NULL
324f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
325dc52ecf6fdbee63652d2dac0dccc17e23ac7797fRafael Espindola    /// DwarfRequiresRelocationForSectionOffset - True if we need to produce a
326746cb670c3cd4f79b288d56d8e9f195685a5381aNick Lewycky    /// relocation when we want a section offset in dwarf.
327dc52ecf6fdbee63652d2dac0dccc17e23ac7797fRafael Espindola    bool DwarfRequiresRelocationForSectionOffset;  // Defaults to true;
328ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel
329746cb670c3cd4f79b288d56d8e9f195685a5381aNick Lewycky    /// DwarfUsesLabelOffsetDifference - True if Dwarf2 output can
330746cb670c3cd4f79b288d56d8e9f195685a5381aNick Lewycky    /// use EmitLabelOffsetDifference.
331b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel    bool DwarfUsesLabelOffsetForRanges;
332b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel
333390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky    /// DwarfUsesRelocationsForStringPool - True if this Dwarf output must use
334390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky    /// relocations to refer to entries in the string pool.
335390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky    bool DwarfUsesRelocationsForStringPool;
336390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky
3373014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    /// DwarfRegNumForCFI - True if dwarf register numbers are printed
3383014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    /// instead of symbolic register names in .cfi_* directives.
3393014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    bool DwarfRegNumForCFI;  // Defaults to false;
3403014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka
34182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- CBE Asm Translation Table -----------------------------------===//
34282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
343eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *const *AsmTransCBE;          // Defaults to empty
34482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
3452d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    //===--- Prologue State ----------------------------------------------===//
3462d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
3472d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    std::vector<MachineMove> InitialFrameState;
3482d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
34982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  public:
3508eeba35babf3114966fc4e6e8522057e46b610dbChris Lattner    explicit MCAsmInfo();
35182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    virtual ~MCAsmInfo();
35282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
353f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    // FIXME: move these methods to DwarfPrinter when the JIT stops using them.
35482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    static unsigned getSLEB128Size(int Value);
35582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    static unsigned getULEB128Size(unsigned Value);
35682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
3571be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// getPointerSize - Get the pointer size in bytes.
3581be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    unsigned getPointerSize() const {
3591be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return PointerSize;
3601be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3611be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
3621be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// islittleendian - True if the target is little endian.
3631be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool isLittleEndian() const {
3641be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return IsLittleEndian;
3651be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3661be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
3671be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// isStackGrowthDirectionUp - True if target stack grow up.
3681be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool isStackGrowthDirectionUp() const {
3691be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return StackGrowsUp;
3701be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3711be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
372f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
373f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
37482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Data directive accessors.
37582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
37682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getData8bitsDirective(unsigned AS = 0) const {
37782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
37882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
37982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getData16bitsDirective(unsigned AS = 0) const {
38082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
38182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
38282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getData32bitsDirective(unsigned AS = 0) const {
38382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
38482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
38582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getData64bitsDirective(unsigned AS = 0) const {
38682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
38782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
3886c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    const char *getGPRel64Directive() const { return GPRel64Directive; }
38978f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    const char *getGPRel32Directive() const { return GPRel32Directive; }
39082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
3912fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    /// [Code|Data]Begin label name accessors.
3922fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *getCodeBeginLabelName() const { return CodeBegin; }
3932fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *getDataBeginLabelName() const { return DataBegin; }
3942fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *getJumpTable8BeginLabelName() const { return JT8Begin; }
3952fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *getJumpTable16BeginLabelName() const { return JT16Begin; }
3962fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    const char *getJumpTable32BeginLabelName() const { return JT32Begin; }
3972fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson    bool getSupportsDataRegions() const { return SupportsDataRegions; }
3982fec6c5ff153786744ba7d0d302b73179731c5e9Owen Anderson
399f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// getNonexecutableStackSection - Targets can implement this method to
400f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// specify a section to switch to if the translation unit doesn't have any
401f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// trampolines that require an executable stack.
40274aae4726a66733c5872588287535a984f9a94c7Chris Lattner    virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
403f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner      return 0;
404f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    }
405f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
406bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola    virtual const MCExpr *
407bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola    getExprForPersonalitySymbol(const MCSymbol *Sym,
408debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                                unsigned Encoding,
409bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola                                MCStreamer &Streamer) const;
410bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola
411debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola    const MCExpr *
412debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola    getExprForFDESymbol(const MCSymbol *Sym,
413debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                        unsigned Encoding,
414debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                        MCStreamer &Streamer) const;
415a0057ca13f06b8de08483c3e3a143a7236c67097Rafael Espindola
41682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool usesSunStyleELFSectionSwitchSyntax() const {
41782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return SunStyleELFSectionSwitchSyntax;
41882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
419f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
42082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool usesELFSectionDirectiveForBSS() const {
42182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return UsesELFSectionDirectiveForBSS;
42282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
42382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
4248a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    bool hasMicrosoftFastStdCallMangling() const {
4258a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner      return HasMicrosoftFastStdCallMangling;
4268a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    }
427f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
42882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Accessors.
42982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
430aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
431c1a887d76d95100e7e05aa76e077710bc4e0b1cfEric Christopher    bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
43271eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool hasStaticCtorDtorReferenceInStaticMode() const {
43371eae713153e564ec743c5c4162ff258c255de78Chris Lattner      return HasStaticCtorDtorReferenceInStaticMode;
43471eae713153e564ec743c5c4162ff258c255de78Chris Lattner    }
435767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    bool getLinkerRequiresNonEmptyDwarfLines() const {
436767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola      return LinkerRequiresNonEmptyDwarfLines;
437767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    }
43882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getMaxInstLength() const {
43982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return MaxInstLength;
44082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
44182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getPCSymbol() const {
44282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return PCSymbol;
44382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
444d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    const char *getSeparatorString() const {
445d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach      return SeparatorString;
44682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
44782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getCommentColumn() const {
44882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return CommentColumn;
44982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
45082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getCommentString() const {
45182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return CommentString;
45282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
453e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    const char *getLabelSuffix() const {
454e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner      return LabelSuffix;
455e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    }
45682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getGlobalPrefix() const {
45782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return GlobalPrefix;
45882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
45982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getPrivateGlobalPrefix() const {
46082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return PrivateGlobalPrefix;
46182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
46282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getLinkerPrivateGlobalPrefix() const {
46382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return LinkerPrivateGlobalPrefix;
46482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
46582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getInlineAsmStart() const {
46682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return InlineAsmStart;
46782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
46882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getInlineAsmEnd() const {
46982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return InlineAsmEnd;
47082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
471bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode16Directive() const {
472bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code16Directive;
473bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
474bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode32Directive() const {
475bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code32Directive;
476bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
477bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode64Directive() const {
478bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code64Directive;
479bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
48082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getAssemblerDialect() const {
48182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AssemblerDialect;
48282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
48382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesAllowQuotesInName() const {
48482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AllowQuotesInName;
48582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
486c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    bool doesAllowNameToStartWithDigit() const {
487c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov      return AllowNameToStartWithDigit;
488c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    }
489b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    bool doesAllowPeriodsInName() const {
490b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang      return AllowPeriodsInName;
491b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    }
4923420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    bool doesAllowUTF8() const {
4933420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt      return AllowUTF8;
4943420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    }
49582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getZeroDirective() const {
49682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ZeroDirective;
49782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
49882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAsciiDirective() const {
49982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AsciiDirective;
50082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAscizDirective() const {
50282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AscizDirective;
50382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAlignDirective() const {
50582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AlignDirective;
50682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool getAlignmentIsInBytes() const {
50882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AlignmentIsInBytes;
50982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
51082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getTextAlignFillValue() const {
51182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return TextAlignFillValue;
51282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
51382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getGlobalDirective() const {
51482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return GlobalDirective;
51582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
51682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getExternDirective() const {
51782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExternDirective;
51882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
519cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    bool hasSetDirective() const { return HasSetDirective; }
52090a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    bool hasAggressiveSymbolFolding() const {
52190a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola      return HasAggressiveSymbolFolding;
52290a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    }
52336a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    LCOMM::LCOMMType getLCOMMDirectiveType() const {
52436a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer      return LCOMMDirectiveType;
52536a16015ac108e2f0dd2d6d96a6d364bc74c50d7Benjamin Kramer    }
5263a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
5272e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    bool getCOMMDirectiveAlignmentIsInBytes() const {
5282e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola      return COMMDirectiveAlignmentIsInBytes;
5292e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    }
5303a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
5313a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool hasNoDeadStrip() const { return HasNoDeadStrip; }
532e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    bool hasSymbolResolver() const { return HasSymbolResolver; }
53341eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getWeakRefDirective() const { return WeakRefDirective; }
53441eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getWeakDefDirective() const { return WeakDefDirective; }
53541eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getLinkOnceDirective() const { return LinkOnceDirective; }
536f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
537152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
5385129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
5395129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings      return HiddenDeclarationVisibilityAttr;
5405129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    }
541152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr getProtectedVisibilityAttr() const {
542152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner      return ProtectedVisibilityAttr;
54382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
54482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool hasLEB128() const {
54582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return HasLEB128;
54682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
54782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesSupportDebugInformation() const {
54882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return SupportsDebugInformation;
54982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
55082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesSupportExceptionHandling() const {
55182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExceptionsType != ExceptionHandling::None;
55282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
55382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ExceptionHandling::ExceptionsType getExceptionHandlingType() const {
55482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExceptionsType;
55582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
5563965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov    bool isExceptionHandlingDwarf() const {
5573965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov      return
558254784f9e0ae59fc060ccd54b39cd1e94ac91356Rafael Espindola        (ExceptionsType == ExceptionHandling::DwarfCFI ||
559645aef1480384292b042c98ffe623a59ab0af049Charles Davis         ExceptionsType == ExceptionHandling::ARM ||
560645aef1480384292b042c98ffe623a59ab0af049Charles Davis         ExceptionsType == ExceptionHandling::Win64);
5613965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov    }
562b83e2bbfbc107a71632bd42f2be8186554b16e1fEric Christopher    bool doesDwarfUseInlineInfoSection() const {
56382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return DwarfUsesInlineInfoSection;
56482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
56582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getDwarfSectionOffsetDirective() const {
56682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return DwarfSectionOffsetDirective;
56782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
568dc52ecf6fdbee63652d2dac0dccc17e23ac7797fRafael Espindola    bool doesDwarfRequireRelocationForSectionOffset() const {
569dc52ecf6fdbee63652d2dac0dccc17e23ac7797fRafael Espindola      return DwarfRequiresRelocationForSectionOffset;
570ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel    }
571b83e2bbfbc107a71632bd42f2be8186554b16e1fEric Christopher    bool doesDwarfUseLabelOffsetForRanges() const {
572b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel      return DwarfUsesLabelOffsetForRanges;
573b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel    }
574390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky    bool doesDwarfUseRelocationsForStringPool() const {
575390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky      return DwarfUsesRelocationsForStringPool;
576390c40d96adb2eb4a778a0890c6c8743057e289eNick Lewycky    }
5773014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    bool useDwarfRegNumForCFI() const {
5783014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka      return DwarfRegNumForCFI;
5793014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    }
58082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *const *getAsmCBE() const {
58182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AsmTransCBE;
58282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
5832d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
5842d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    void addInitialFrameState(MCSymbol *label, const MachineLocation &D,
5852d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng                              const MachineLocation &S) {
5862d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng      InitialFrameState.push_back(MachineMove(label, D, S));
5872d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    }
5882d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    const std::vector<MachineMove> &getInitialFrameState() const {
5892d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng      return InitialFrameState;
5902d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    }
59182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  };
59282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner}
59382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
59482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#endif
595