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
16674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#ifndef LLVM_MC_MCASMINFO_H
17674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#define LLVM_MC_MCASMINFO_H
18af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner
19152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner#include "llvm/MC/MCDirectives.h"
204a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola#include "llvm/MC/MCDwarf.h"
21255f89faee13dc491cb64fbeae3c763e7e2ea4e6Chandler Carruth#include "llvm/MC/MachineLocation.h"
2282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#include <cassert>
232d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng#include <vector>
2482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2582d748d55c549dd055528ed10dbb534618ca8115Chris Lattnernamespace llvm {
26bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCExpr;
27f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner  class MCSection;
28bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCStreamer;
29bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola  class MCSymbol;
30f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner  class MCContext;
31f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
323965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov  namespace ExceptionHandling {
33d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis    enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
343965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov  }
3582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
36a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer  namespace LCOMM {
37a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer    enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
38a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer  }
39a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer
40d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis  /// MCAsmInfo - This class is intended to be used as a base class for asm
41d652b1368b1e381382951f450e5eeca870d91dd6Charles Davis  /// properties and features specific to the target.
4282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  class MCAsmInfo {
4382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  protected:
4482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===------------------------------------------------------------------===//
4582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Properties to be set by the target writer, used to configure asm printer.
4682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
47ed4cf997abe9db574728aa6c1b06a9887848e7f0Jim Grosbach
481be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// PointerSize - Pointer size in bytes.
491be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///               Default is 4.
501be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    unsigned PointerSize;
511be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
529dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    /// CalleeSaveStackSlotSize - Size of the stack slot reserved for
539dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    ///                           callee-saved registers, in bytes.
549dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    ///                           Default is same as pointer size.
559dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    unsigned CalleeSaveStackSlotSize;
569dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky
571be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// IsLittleEndian - True if target is little endian.
581be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///                  Default is true.
591be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool IsLittleEndian;
601be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
611be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// StackGrowsUp - True if target stack grow up.
621be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    ///                Default is false.
631be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool StackGrowsUp;
6482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
65f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// HasSubsectionsViaSymbols - True if this target has the MachO
66f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// .subsections_via_symbols directive.
67f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    bool HasSubsectionsViaSymbols;           // Default is false.
68f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
69aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    /// HasMachoZeroFillDirective - True if this is a MachO target that supports
70aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    /// the macho-specific .zerofill directive for emitting BSS Symbols.
7171eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool HasMachoZeroFillDirective;               // Default is false.
72f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
7351f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    /// HasMachoTBSSDirective - True if this is a MachO target that supports
7451f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    /// the macho-specific .tbss directive for emitting thread local BSS Symbols
7551f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher    bool HasMachoTBSSDirective;                 // Default is false.
76f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
7771eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should
7871eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// emit a ".reference .constructors_used" or ".reference .destructors_used"
7971eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// directive after the a static ctor/dtor list.  This directive is only
8071eae713153e564ec743c5c4162ff258c255de78Chris Lattner    /// emitted in Static relocation model.
8171eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool HasStaticCtorDtorReferenceInStaticMode;  // Default is false.
82f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
83767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// LinkerRequiresNonEmptyDwarfLines - True if the linker has a bug and
84767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// requires that the debug_line section be of a minimum size. In practice
85767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    /// such a linker requires a non empty line sequence if a file is present.
86767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    bool LinkerRequiresNonEmptyDwarfLines; // Default to false.
87767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola
8882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// MaxInstLength - This is the maximum possible length of an instruction,
8982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which is needed to compute the size of an inline asm.
90eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned MaxInstLength;                  // Defaults to 4.
91f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
92c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand    /// MinInstAlignment - Every possible instruction length is a multiple of
93c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand    /// this value.  Factored out in .debug_frame and .debug_line.
94c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand    unsigned MinInstAlignment;                  // Defaults to 1.
95c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand
9682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// PCSymbol - The symbol used to represent the current PC.  Used in PC
9782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// relative expressions.
98eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *PCSymbol;                    // Defaults to "$".
9982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
100d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    /// SeparatorString - This string, if specified, is used to separate
101d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    /// instructions from each other when on the same line.
102d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    const char *SeparatorString;             // Defaults to ';'
10382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
10482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// CommentColumn - This indicates the comment num (zero-based) at
10582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which asm comments should be printed.
10673163f875ad7e5d56aa7d0d29509eb1e04542742Daniel Dunbar    unsigned CommentColumn;                  // Defaults to 40
10782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
10882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// CommentString - This indicates the comment character used by the
10982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// assembler.
110eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *CommentString;               // Defaults to "#"
11182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
112e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    /// LabelSuffix - This is appended to emitted labels.
113e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    const char *LabelSuffix;                 // Defaults to ":"
114e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner
1152c3a4641a7785da78839caf574277df9cd93b52cReed Kotler    /// LabelSuffix - This is appended to emitted labels.
1162c3a4641a7785da78839caf574277df9cd93b52cReed Kotler    const char *DebugLabelSuffix;                 // Defaults to ":"
1172c3a4641a7785da78839caf574277df9cd93b52cReed Kotler
11882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// GlobalPrefix - If this is set to a non-empty string, it is prepended
11982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// onto all global symbols.  This is often used for "_" or ".".
120eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *GlobalPrefix;                // Defaults to ""
12182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
12282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// PrivateGlobalPrefix - This prefix is used for globals like constant
12382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// pool entries that are completely private to the .s file and should not
12482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// have names in the .o file.  This is often "." or "L".
125eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *PrivateGlobalPrefix;         // Defaults to "."
126f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
12782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
12882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// be passed through the assembler but be removed by the linker.  This
12982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// is "l" on Darwin, currently used for some ObjC metadata.
130eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *LinkerPrivateGlobalPrefix;   // Defaults to ""
131f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
13282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// InlineAsmStart/End - If these are nonempty, they contain a directive to
13382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// emit before and after an inline assembly statement.
134eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *InlineAsmStart;              // Defaults to "#APP\n"
135eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *InlineAsmEnd;                // Defaults to "#NO_APP\n"
13682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
137bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// Code16Directive, Code32Directive, Code64Directive - These are assembly
138bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// directives that tells the assembler to interpret the following
139bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    /// instructions differently.
140bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code16Directive;             // Defaults to ".code16"
141bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code32Directive;             // Defaults to ".code32"
142bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *Code64Directive;             // Defaults to ".code64"
143bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng
14482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AssemblerDialect - Which dialect of an assembler variant to use.
145eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned AssemblerDialect;               // Defaults to 0
14682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
14782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AllowQuotesInName - This is true if the assembler allows for complex
14882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// symbol names to be surrounded in quotes.  This defaults to false.
14982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool AllowQuotesInName;
150c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov
151c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    /// AllowNameToStartWithDigit - This is true if the assembler allows symbol
152c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    /// names to start with a digit (e.g., "0x0021").  This defaults to false.
153c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    bool AllowNameToStartWithDigit;
154b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang
155b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    /// AllowPeriodsInName - This is true if the assembler allows periods in
156b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    /// symbol names.  This defaults to true.
157b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    bool AllowPeriodsInName;
158b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang
1593420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    /// AllowUTF8 - This is true if the assembler accepts UTF-8 input.
1603420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    // FIXME: Make this a more general encoding setting?
1613420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    bool AllowUTF8;
1623420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt
1633e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    /// UseDataRegionDirectives - This is true if data region markers should
1643e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    /// be printed as ".data_region/.end_data_region" directives. If false,
1653e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    /// use "$d/$a" labels instead.
1663e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    bool UseDataRegionDirectives;
1673e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach
16882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Data Emission Directives -------------------------------------===//
16982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
17082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// ZeroDirective - this should be set to the directive used to get some
17182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// number of zero bytes emitted to the current section.  Common cases are
17282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// "\t.zero\t" and "\t.space\t".  If this is set to null, the
17382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Data*bitsDirective's will be used to emit zero bytes.
174eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *ZeroDirective;               // Defaults to "\t.zero\t"
17582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
17682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AsciiDirective - This directive allows emission of an ascii string with
17782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// the standard C escape characters embedded into it.
178eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AsciiDirective;              // Defaults to "\t.ascii\t"
179f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
18082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AscizDirective - If not null, this allows for special handling of
18182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// zero terminated strings on this target.  This is commonly supported as
18282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// ".asciz".  If a target doesn't support this, it can be set to null.
183eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AscizDirective;              // Defaults to "\t.asciz\t"
18482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
18582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// DataDirectives - These directives are used to output some unit of
18682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// integer data to the current section.  If a data directive is set to
18782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// null, smaller data directives will be used to emit the large sizes.
188eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data8bitsDirective;          // Defaults to "\t.byte\t"
189eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data16bitsDirective;         // Defaults to "\t.short\t"
190eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data32bitsDirective;         // Defaults to "\t.long\t"
191eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *Data64bitsDirective;         // Defaults to "\t.quad\t"
19282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
1936c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// GPRel64Directive - if non-null, a directive that is used to emit a word
1946c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// which should be relocated as a 64-bit GP-relative offset, e.g. .gpdword
1956c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    /// on Mips.
1966c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    const char *GPRel64Directive;            // Defaults to NULL.
1976c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka
19878f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// GPRel32Directive - if non-null, a directive that is used to emit a word
19978f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword
20078f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    /// on Mips or .gprel32 on Alpha.
20178f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    const char *GPRel32Directive;            // Defaults to NULL.
202f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
20382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun
20482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Style" syntax for section switching ("#alloc,#write" etc) instead of the
20582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// normal ELF syntax (,"a,w") in .section directives.
206eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool SunStyleELFSectionSwitchSyntax;     // Defaults to false.
20782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
20882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF
209f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach    /// '.section' directive before the '.bss' one. It's used for PPC/Linux
21082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// which doesn't support the '.bss' directive only.
211eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool UsesELFSectionDirectiveForBSS;      // Defaults to false.
212f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
2138a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft
2148a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// style mangling for functions with X86_StdCall/X86_FastCall calling
2158a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    /// convention.
2168a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    bool HasMicrosoftFastStdCallMangling;    // Defaults to false.
217f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
2189a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault    bool NeedsDwarfSectionOffsetDirective;
2199a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault
22082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Alignment Information ----------------------------------------===//
22182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
22282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AlignDirective - The directive used to emit round up to an alignment
22382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// boundary.
22482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
225eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *AlignDirective;              // Defaults to "\t.align\t"
22682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
22782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
22882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// emits ".align N" directives, where N is the number of bytes to align to.
22982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
23082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// boundary.
231eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool AlignmentIsInBytes;                 // Defaults to true
23282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
23382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// TextAlignFillValue - If non-zero, this is used to fill the executable
23482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// space created as the result of a alignment directive.
235eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    unsigned TextAlignFillValue;             // Defaults to 0
23682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
23782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Global Variable Emission Directives --------------------------===//
238f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
23982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// GlobalDirective - This is the directive used to declare a global entity.
24082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
241eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *GlobalDirective;             // Defaults to NULL.
24282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
243f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach    /// ExternDirective - This is the directive used to declare external
24482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// globals.
24582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ///
246eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *ExternDirective;             // Defaults to NULL.
247f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
248cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    /// HasSetDirective - True if the assembler supports the .set directive.
249cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    bool HasSetDirective;                    // Defaults to true.
250f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
25190a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    /// HasAggressiveSymbolFolding - False if the assembler requires that we use
2525d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// Lc = a - b
2535d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// .long Lc
25490a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    /// instead of
2555d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola    /// .long a - b
25690a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    bool HasAggressiveSymbolFolding;           // Defaults to true.
2575d4918dbd116b0b5e561c431b1ea527ee1b9302aRafael Espindola
25839646d96e76aea5d20bffb386233a0dbb5932a21Benjamin Kramer    /// COMMDirectiveAlignmentIsInBytes - True is .comm's and .lcomms optional
2592e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    /// alignment is to be specified in bytes instead of log2(n).
2602e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    bool COMMDirectiveAlignmentIsInBytes;    // Defaults to true;
261f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
262a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer    /// LCOMMDirectiveAlignment - Describes if the .lcomm directive for the
263a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer    /// target supports an alignment argument and how it is interpreted.
264a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer    LCOMM::LCOMMType LCOMMDirectiveAlignmentType; // Defaults to NoAlignment.
26539646d96e76aea5d20bffb386233a0dbb5932a21Benjamin Kramer
26682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasDotTypeDotSizeDirective - True if the target has .type and .size
26782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// directives, this is true for most ELF targets.
268eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool HasDotTypeDotSizeDirective;         // Defaults to true.
26982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
27082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasSingleParameterDotFile - True if the target has a single parameter
27182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// .file directive, this is true for ELF targets.
272eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    bool HasSingleParameterDotFile;          // Defaults to true.
27382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2743a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip
2753a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    /// directive.
2763a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool HasNoDeadStrip;                     // Defaults to false.
27782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
278e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    /// HasSymbolResolver - True if this target supports the MachO
279e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    /// .symbol_resolver directive.
280e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    bool HasSymbolResolver;                     // Defaults to false.
281e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby
28282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// WeakRefDirective - This directive, if non-null, is used to declare a
28382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// global as being a weak undefined symbol.
284eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *WeakRefDirective;            // Defaults to NULL.
285f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
28682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// WeakDefDirective - This directive, if non-null, is used to declare a
28782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// global as being a weak defined symbol.
288eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling    const char *WeakDefDirective;            // Defaults to NULL.
28941eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner
29041eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    /// LinkOnceDirective - This directive, if non-null is used to declare a
29141eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    /// global as being a weak defined symbol.  This is used on cygwin/mingw.
29241eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *LinkOnceDirective;           // Defaults to NULL.
293f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
294152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to
295152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// declare a symbol as having hidden visibility.
296152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr HiddenVisibilityAttr;       // Defaults to MCSA_Hidden.
29782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
2985129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    /// HiddenDeclarationVisibilityAttr - This attribute, if not MCSA_Invalid,
2995129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    /// is used to declare an undefined symbol as having hidden visibility.
3005129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    MCSymbolAttr HiddenDeclarationVisibilityAttr;   // Defaults to MCSA_Hidden.
3015129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings
3025129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings
303152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used
304152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    /// to declare a symbol as having protected visibility.
305152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr ProtectedVisibilityAttr;    // Defaults to MCSA_Protected
30682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
30782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //===--- Dwarf Emission Directives -----------------------------------===//
30882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
30982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// HasLEB128 - True if target asm supports leb128 directives.
310b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool HasLEB128;                          // Defaults to false.
31182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
31282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// SupportsDebugInformation - True if target supports emission of debugging
31382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// information.
314b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool SupportsDebugInformation;           // Defaults to false.
31582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
316b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    /// SupportsExceptionHandling - True if target supports exception handling.
317b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None
31882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
31982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
32082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    /// encode inline subroutine information.
321b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling    bool DwarfUsesInlineInfoSection;         // Defaults to false.
32282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
323ffccd923101ae177c1a2c407618d8f03a312d69bNick Lewycky    /// DwarfUsesRelocationsAcrossSections - True if Dwarf2 output generally
324ffccd923101ae177c1a2c407618d8f03a312d69bNick Lewycky    /// uses relocations for references to other .debug_* sections.
325ffccd923101ae177c1a2c407618d8f03a312d69bNick Lewycky    bool DwarfUsesRelocationsAcrossSections;
326b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel
3273014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    /// DwarfRegNumForCFI - True if dwarf register numbers are printed
3283014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    /// instead of symbolic register names in .cfi_* directives.
3293014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    bool DwarfRegNumForCFI;  // Defaults to false;
3303014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka
3312d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    //===--- Prologue State ----------------------------------------------===//
3322d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
3334a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola    std::vector<MCCFIInstruction> InitialFrameState;
3342d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
33582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  public:
3368eeba35babf3114966fc4e6e8522057e46b610dbChris Lattner    explicit MCAsmInfo();
33782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    virtual ~MCAsmInfo();
33882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
339f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    // FIXME: move these methods to DwarfPrinter when the JIT stops using them.
340fe2e66a6dab6162fb10ed2d576cd122f34d2626fDavid Blaikie    static unsigned getSLEB128Size(int64_t Value);
341fe2e66a6dab6162fb10ed2d576cd122f34d2626fDavid Blaikie    static unsigned getULEB128Size(uint64_t Value);
34282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
3431be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// getPointerSize - Get the pointer size in bytes.
3441be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    unsigned getPointerSize() const {
3451be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return PointerSize;
3461be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3471be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
3489dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    /// getCalleeSaveStackSlotSize - Get the callee-saved register stack slot
3499dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    /// size in bytes.
3509dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    unsigned getCalleeSaveStackSlotSize() const {
351e752feee5228bfa33acee35ef9c606ce12f0f173Eli Bendersky      return CalleeSaveStackSlotSize;
3529dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    }
3539dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky
3549dd2a3b1f2c253e20262535bb89b1ab6cc680eceEli Bendersky    /// isLittleEndian - True if the target is little endian.
3551be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool isLittleEndian() const {
3561be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return IsLittleEndian;
3571be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3581be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
3591be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    /// isStackGrowthDirectionUp - True if target stack grow up.
3601be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    bool isStackGrowthDirectionUp() const {
3611be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng      return StackGrowsUp;
3621be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng    }
3631be0e271a07925b928ba89848934f1ea6f1854e2Evan Cheng
364f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
365f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
36682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Data directive accessors.
36782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
368a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola    const char *getData8bitsDirective() const {
369a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola      return Data8bitsDirective;
37082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
371a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola    const char *getData16bitsDirective() const {
372a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola      return Data16bitsDirective;
37382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
374a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola    const char *getData32bitsDirective() const {
375a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola      return Data32bitsDirective;
37682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
377a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola    const char *getData64bitsDirective() const {
378a3863ea2dacafc925a8272ebf9884fc64bef686cRafael Espindola      return Data64bitsDirective;
37982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
3806c2cf8b1fbcf70fd9db6fe44032c1ceaa2299760Akira Hatanaka    const char *getGPRel64Directive() const { return GPRel64Directive; }
38178f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner    const char *getGPRel32Directive() const { return GPRel32Directive; }
38282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
383f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// getNonexecutableStackSection - Targets can implement this method to
384f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// specify a section to switch to if the translation unit doesn't have any
385f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    /// trampolines that require an executable stack.
38674aae4726a66733c5872588287535a984f9a94c7Chris Lattner    virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
387f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner      return 0;
388f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner    }
389f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
390bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola    virtual const MCExpr *
391bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola    getExprForPersonalitySymbol(const MCSymbol *Sym,
392debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                                unsigned Encoding,
393bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola                                MCStreamer &Streamer) const;
394bfa27cc5d72e061a96efbb461864d40bc8089ec2Rafael Espindola
395debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola    const MCExpr *
396debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola    getExprForFDESymbol(const MCSymbol *Sym,
397debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                        unsigned Encoding,
398debd7e4e8bc5cfe61bfb71835ce2b1a3fbccc2beRafael Espindola                        MCStreamer &Streamer) const;
399a0057ca13f06b8de08483c3e3a143a7236c67097Rafael Espindola
40082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool usesSunStyleELFSectionSwitchSyntax() const {
40182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return SunStyleELFSectionSwitchSyntax;
40282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
403f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
40482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool usesELFSectionDirectiveForBSS() const {
40582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return UsesELFSectionDirectiveForBSS;
40682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
40782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
4088a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    bool hasMicrosoftFastStdCallMangling() const {
4098a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner      return HasMicrosoftFastStdCallMangling;
4108a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner    }
411f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
4129a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault    bool needsDwarfSectionOffsetDirective() const {
4139a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault      return NeedsDwarfSectionOffsetDirective;
4149a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault    }
4159a0e12a6ed7db1bf49e4676932427e91ae4eb9beMatt Arsenault
41682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    // Accessors.
41782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    //
418aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner    bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
419c1a887d76d95100e7e05aa76e077710bc4e0b1cfEric Christopher    bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
42071eae713153e564ec743c5c4162ff258c255de78Chris Lattner    bool hasStaticCtorDtorReferenceInStaticMode() const {
42171eae713153e564ec743c5c4162ff258c255de78Chris Lattner      return HasStaticCtorDtorReferenceInStaticMode;
42271eae713153e564ec743c5c4162ff258c255de78Chris Lattner    }
423767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    bool getLinkerRequiresNonEmptyDwarfLines() const {
424767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola      return LinkerRequiresNonEmptyDwarfLines;
425767b1be3900bdc693aa0ad3e554ba034845f67f7Rafael Espindola    }
42682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getMaxInstLength() const {
42782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return MaxInstLength;
42882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
429c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand    unsigned getMinInstAlignment() const {
430c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand      return MinInstAlignment;
431c1f4a4b2640dfc871bacacef53a95f1c96a9fe48Ulrich Weigand    }
43282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getPCSymbol() const {
43382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return PCSymbol;
43482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
435d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach    const char *getSeparatorString() const {
436d31d304f83f9c8df6870057509414b8d004bc8daJim Grosbach      return SeparatorString;
43782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
43882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getCommentColumn() const {
43982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return CommentColumn;
44082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
44182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getCommentString() const {
44282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return CommentString;
44382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
444e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    const char *getLabelSuffix() const {
445e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner      return LabelSuffix;
446e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner    }
4472c3a4641a7785da78839caf574277df9cd93b52cReed Kotler
4482c3a4641a7785da78839caf574277df9cd93b52cReed Kotler    const char *getDebugLabelSuffix() const {
4492c3a4641a7785da78839caf574277df9cd93b52cReed Kotler      return DebugLabelSuffix;
4502c3a4641a7785da78839caf574277df9cd93b52cReed Kotler    }
4512c3a4641a7785da78839caf574277df9cd93b52cReed Kotler
45282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getGlobalPrefix() const {
45382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return GlobalPrefix;
45482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
45582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getPrivateGlobalPrefix() const {
45682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return PrivateGlobalPrefix;
45782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
45882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getLinkerPrivateGlobalPrefix() const {
45982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return LinkerPrivateGlobalPrefix;
46082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
46182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getInlineAsmStart() const {
46282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return InlineAsmStart;
46382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
46482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getInlineAsmEnd() const {
46582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return InlineAsmEnd;
46682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
467bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode16Directive() const {
468bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code16Directive;
469bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
470bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode32Directive() const {
471bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code32Directive;
472bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
473bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    const char *getCode64Directive() const {
474bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng      return Code64Directive;
475bd27f5adbd8f3b8ab8def5aa43fbc406ac9b8cbeEvan Cheng    }
47682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getAssemblerDialect() const {
47782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AssemblerDialect;
47882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
47982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesAllowQuotesInName() const {
48082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AllowQuotesInName;
48182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
482c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    bool doesAllowNameToStartWithDigit() const {
483c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov      return AllowNameToStartWithDigit;
484c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov    }
485b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    bool doesAllowPeriodsInName() const {
486b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang      return AllowPeriodsInName;
487b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang    }
4883420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    bool doesAllowUTF8() const {
4893420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt      return AllowUTF8;
4903420e7f360dab7712a9ec4f51d233c7e73642ec7Sean Hunt    }
4913e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    bool doesSupportDataRegionDirectives() const {
4923e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach      return UseDataRegionDirectives;
4933e96531186ba574b0c25a4be62d24b8b7d752c9fJim Grosbach    }
49482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getZeroDirective() const {
49582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ZeroDirective;
49682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
49782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAsciiDirective() const {
49882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AsciiDirective;
49982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAscizDirective() const {
50182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AscizDirective;
50282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getAlignDirective() const {
50482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AlignDirective;
50582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool getAlignmentIsInBytes() const {
50782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return AlignmentIsInBytes;
50882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
50982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    unsigned getTextAlignFillValue() const {
51082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return TextAlignFillValue;
51182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
51282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getGlobalDirective() const {
51382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return GlobalDirective;
51482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
51582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    const char *getExternDirective() const {
51682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExternDirective;
51782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
518cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner    bool hasSetDirective() const { return HasSetDirective; }
51990a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    bool hasAggressiveSymbolFolding() const {
52090a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola      return HasAggressiveSymbolFolding;
52190a5a0cd7c353651c953020b1e41b4c6e2f21883Rafael Espindola    }
5222e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    bool getCOMMDirectiveAlignmentIsInBytes() const {
5232e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola      return COMMDirectiveAlignmentIsInBytes;
5242e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola    }
525a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer    LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const {
526a9e37c5eaf79c3a32f2921536fb7e12514e86fb2Benjamin Kramer      return LCOMMDirectiveAlignmentType;
52739646d96e76aea5d20bffb386233a0dbb5932a21Benjamin Kramer    }
52839646d96e76aea5d20bffb386233a0dbb5932a21Benjamin Kramer    bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
5293a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
5303a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner    bool hasNoDeadStrip() const { return HasNoDeadStrip; }
531e8e98d7f2eaa0613442ce21ab6a040c0f04f5b4dKevin Enderby    bool hasSymbolResolver() const { return HasSymbolResolver; }
53241eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getWeakRefDirective() const { return WeakRefDirective; }
53341eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getWeakDefDirective() const { return WeakDefDirective; }
53441eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner    const char *getLinkOnceDirective() const { return LinkOnceDirective; }
535f10dfa910def9cdca566edbd6d2089b075a57b21Jim Grosbach
536152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
5375129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
5385129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings      return HiddenDeclarationVisibilityAttr;
5395129bdecd87c518713765acd6998c80f9eef36a2Stuart Hastings    }
540152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner    MCSymbolAttr getProtectedVisibilityAttr() const {
541152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner      return ProtectedVisibilityAttr;
54282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
54382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool hasLEB128() const {
54482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return HasLEB128;
54582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
54682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesSupportDebugInformation() const {
54782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return SupportsDebugInformation;
54882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
54982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    bool doesSupportExceptionHandling() const {
55082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExceptionsType != ExceptionHandling::None;
55182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
55282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    ExceptionHandling::ExceptionsType getExceptionHandlingType() const {
55382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return ExceptionsType;
55482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
5553965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov    bool isExceptionHandlingDwarf() const {
5563965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov      return
557254784f9e0ae59fc060ccd54b39cd1e94ac91356Rafael Espindola        (ExceptionsType == ExceptionHandling::DwarfCFI ||
558645aef1480384292b042c98ffe623a59ab0af049Charles Davis         ExceptionsType == ExceptionHandling::ARM ||
559645aef1480384292b042c98ffe623a59ab0af049Charles Davis         ExceptionsType == ExceptionHandling::Win64);
5603965b5e974d57f3e56a2c7f37d76d73e572dfb20Anton Korobeynikov    }
561b83e2bbfbc107a71632bd42f2be8186554b16e1fEric Christopher    bool doesDwarfUseInlineInfoSection() const {
56282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner      return DwarfUsesInlineInfoSection;
56382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner    }
564ffccd923101ae177c1a2c407618d8f03a312d69bNick Lewycky    bool doesDwarfUseRelocationsAcrossSections() const {
565ffccd923101ae177c1a2c407618d8f03a312d69bNick Lewycky      return DwarfUsesRelocationsAcrossSections;
566b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel    }
5673014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    bool useDwarfRegNumForCFI() const {
5683014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka      return DwarfRegNumForCFI;
5693014b2f3228e1aac1a70598f50d66f1afcc16714Akira Hatanaka    }
5702d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng
5714a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola    void addInitialFrameState(const MCCFIInstruction &Inst) {
5724a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola      InitialFrameState.push_back(Inst);
5732d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    }
5744a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola
5754a971705bc6030dc2e4338b3cd5cffa2e0f88b7bRafael Espindola    const std::vector<MCCFIInstruction> &getInitialFrameState() const {
5762d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng      return InitialFrameState;
5772d28617de2b0b731c08d1af9e830f31e14ac75b4Evan Cheng    }
57882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner  };
57982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner}
58082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner
58182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#endif
582