1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===//
2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//                     The LLVM Compiler Infrastructure
4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source
6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details.
7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file contains a class to be used as the basis for target specific
11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// asm writers.  This class primarily takes care of global printing constants,
12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// which are used in very similar ways across all targets.
13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#ifndef LLVM_TARGET_ASM_INFO_H
17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#define LLVM_TARGET_ASM_INFO_H
18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
1919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/MC/MachineLocation.h"
20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/MC/MCDirectives.h"
21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include <cassert>
2219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include <vector>
23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
24894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumannamespace llvm {
2519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  class MCExpr;
26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class MCSection;
2719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  class MCStreamer;
2819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  class MCSymbol;
29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class MCContext;
3019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
3119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  namespace ExceptionHandling {
3219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
3319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  }
3419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
3519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  namespace LCOMM {
3619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    enum LCOMMType { None, NoAlignment, ByteAlignment };
3719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  }
3819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
3919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  namespace Structors {
4019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    enum OutputOrder { None, PriorityOrder, ReversePriorityOrder };
4119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  }
4219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// MCAsmInfo - This class is intended to be used as a base class for asm
44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// properties and features specific to the target.
45894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class MCAsmInfo {
46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  protected:
47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===------------------------------------------------------------------===//
48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // Properties to be set by the target writer, used to configure asm printer.
49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //
5019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
5119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// PointerSize - Pointer size in bytes.
5219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    ///               Default is 4.
5319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    unsigned PointerSize;
5419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
5519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// IsLittleEndian - True if target is little endian.
5619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    ///                  Default is true.
5719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool IsLittleEndian;
5819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
5919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// StackGrowsUp - True if target stack grow up.
6019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    ///                Default is false.
6119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool StackGrowsUp;
62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasSubsectionsViaSymbols - True if this target has the MachO
64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// .subsections_via_symbols directive.
65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasSubsectionsViaSymbols;           // Default is false.
6619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasMachoZeroFillDirective - True if this is a MachO target that supports
68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the macho-specific .zerofill directive for emitting BSS Symbols.
69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasMachoZeroFillDirective;               // Default is false.
7019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasMachoTBSSDirective - True if this is a MachO target that supports
72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the macho-specific .tbss directive for emitting thread local BSS Symbols
73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasMachoTBSSDirective;                 // Default is false.
7419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
7519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// StructorOutputOrder - Whether the static ctor/dtor list should be output
7619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// in no particular order, in order of increasing priority or the reverse:
7719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// in order of decreasing priority (the default).
7819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    Structors::OutputOrder StructorOutputOrder; // Default is reverse order.
7919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
80894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should
81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// emit a ".reference .constructors_used" or ".reference .destructors_used"
82894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// directive after the a static ctor/dtor list.  This directive is only
83894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// emitted in Static relocation model.
84894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasStaticCtorDtorReferenceInStaticMode;  // Default is false.
8519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
8619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// LinkerRequiresNonEmptyDwarfLines - True if the linker has a bug and
8719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// requires that the debug_line section be of a minimum size. In practice
8819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// such a linker requires a non empty line sequence if a file is present.
8919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool LinkerRequiresNonEmptyDwarfLines; // Default to false.
9019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
91894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// MaxInstLength - This is the maximum possible length of an instruction,
92894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// which is needed to compute the size of an inline asm.
93894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned MaxInstLength;                  // Defaults to 4.
9419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
95894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// PCSymbol - The symbol used to represent the current PC.  Used in PC
96894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// relative expressions.
97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *PCSymbol;                    // Defaults to "$".
98894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
9919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// SeparatorString - This string, if specified, is used to separate
10019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// instructions from each other when on the same line.
10119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *SeparatorString;             // Defaults to ';'
102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// CommentColumn - This indicates the comment num (zero-based) at
104894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// which asm comments should be printed.
105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned CommentColumn;                  // Defaults to 40
106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// CommentString - This indicates the comment character used by the
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// assembler.
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *CommentString;               // Defaults to "#"
110894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
11119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// LabelSuffix - This is appended to emitted labels.
11219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *LabelSuffix;                 // Defaults to ":"
11319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// GlobalPrefix - If this is set to a non-empty string, it is prepended
115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// onto all global symbols.  This is often used for "_" or ".".
116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *GlobalPrefix;                // Defaults to ""
117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// PrivateGlobalPrefix - This prefix is used for globals like constant
119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// pool entries that are completely private to the .s file and should not
120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// have names in the .o file.  This is often "." or "L".
121894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *PrivateGlobalPrefix;         // Defaults to "."
12219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
123894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should
124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// be passed through the assembler but be removed by the linker.  This
125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// is "l" on Darwin, currently used for some ObjC metadata.
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *LinkerPrivateGlobalPrefix;   // Defaults to ""
12719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// InlineAsmStart/End - If these are nonempty, they contain a directive to
129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// emit before and after an inline assembly statement.
130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *InlineAsmStart;              // Defaults to "#APP\n"
131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *InlineAsmEnd;                // Defaults to "#NO_APP\n"
132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
13319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// Code16Directive, Code32Directive, Code64Directive - These are assembly
13419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// directives that tells the assembler to interpret the following
13519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// instructions differently.
13619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *Code16Directive;             // Defaults to ".code16"
13719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *Code32Directive;             // Defaults to ".code32"
13819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *Code64Directive;             // Defaults to ".code64"
13919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AssemblerDialect - Which dialect of an assembler variant to use.
141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned AssemblerDialect;               // Defaults to 0
142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AllowQuotesInName - This is true if the assembler allows for complex
144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// symbol names to be surrounded in quotes.  This defaults to false.
145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool AllowQuotesInName;
146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AllowNameToStartWithDigit - This is true if the assembler allows symbol
148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// names to start with a digit (e.g., "0x0021").  This defaults to false.
149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool AllowNameToStartWithDigit;
150894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AllowPeriodsInName - This is true if the assembler allows periods in
152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// symbol names.  This defaults to true.
153894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool AllowPeriodsInName;
154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===--- Data Emission Directives -------------------------------------===//
156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ZeroDirective - this should be set to the directive used to get some
158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// number of zero bytes emitted to the current section.  Common cases are
159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// "\t.zero\t" and "\t.space\t".  If this is set to null, the
160894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// Data*bitsDirective's will be used to emit zero bytes.
161894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *ZeroDirective;               // Defaults to "\t.zero\t"
162894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
163894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AsciiDirective - This directive allows emission of an ascii string with
164894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the standard C escape characters embedded into it.
165894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *AsciiDirective;              // Defaults to "\t.ascii\t"
16619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AscizDirective - If not null, this allows for special handling of
168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// zero terminated strings on this target.  This is commonly supported as
169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ".asciz".  If a target doesn't support this, it can be set to null.
170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *AscizDirective;              // Defaults to "\t.asciz\t"
171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// DataDirectives - These directives are used to output some unit of
173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// integer data to the current section.  If a data directive is set to
174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// null, smaller data directives will be used to emit the large sizes.
175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *Data8bitsDirective;          // Defaults to "\t.byte\t"
176894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *Data16bitsDirective;         // Defaults to "\t.short\t"
177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *Data32bitsDirective;         // Defaults to "\t.long\t"
178894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *Data64bitsDirective;         // Defaults to "\t.quad\t"
179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
18019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// [Data|Code]Begin - These magic labels are used to marked a region as
18119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// data or code, and are used to provide additional information for
18219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// correct disassembly on targets that like to mix data and code within
18319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// a segment.  These labels will be implicitly suffixed by the streamer
18419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// to give them unique names.
18519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *DataBegin;                   // Defaults to "$d."
18619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *CodeBegin;                   // Defaults to "$a."
18719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *JT8Begin;                    // Defaults to "$a."
18819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *JT16Begin;                   // Defaults to "$a."
18919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *JT32Begin;                   // Defaults to "$a."
19019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool SupportsDataRegions;
19119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
192894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// GPRel32Directive - if non-null, a directive that is used to emit a word
193894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword
194894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// on Mips or .gprel32 on Alpha.
195894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *GPRel32Directive;            // Defaults to NULL.
19619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
197894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getDataASDirective - Return the directive that should be used to emit
198894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// data of the specified size to the specified numeric address space.
199894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
200894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      assert(AS != 0 && "Don't know the directives for default addr space");
201894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return 0;
202894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
203894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
204894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun
205894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// Style" syntax for section switching ("#alloc,#write" etc) instead of the
206894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// normal ELF syntax (,"a,w") in .section directives.
207894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SunStyleELFSectionSwitchSyntax;     // Defaults to false.
208894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
209894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF
21019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// '.section' directive before the '.bss' one. It's used for PPC/Linux
211894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// which doesn't support the '.bss' directive only.
212894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool UsesELFSectionDirectiveForBSS;      // Defaults to false.
21319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
214894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft
215894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// style mangling for functions with X86_StdCall/X86_FastCall calling
216894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// convention.
217894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasMicrosoftFastStdCallMangling;    // Defaults to false.
21819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
219894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===--- Alignment Information ----------------------------------------===//
220894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
221894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AlignDirective - The directive used to emit round up to an alignment
222894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// boundary.
223894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
224894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *AlignDirective;              // Defaults to "\t.align\t"
225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// AlignmentIsInBytes - If this is true (the default) then the asmprinter
227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// emits ".align N" directives, where N is the number of bytes to align to.
228894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
229894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// boundary.
230894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool AlignmentIsInBytes;                 // Defaults to true
231894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
232894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// TextAlignFillValue - If non-zero, this is used to fill the executable
233894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// space created as the result of a alignment directive.
234894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned TextAlignFillValue;             // Defaults to 0
235894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===--- Global Variable Emission Directives --------------------------===//
23719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
238894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// GlobalDirective - This is the directive used to declare a global entity.
239894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
240894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *GlobalDirective;             // Defaults to NULL.
241894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
24219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// ExternDirective - This is the directive used to declare external
243894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// globals.
244894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
245894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *ExternDirective;             // Defaults to NULL.
24619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
247894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasSetDirective - True if the assembler supports the .set directive.
248894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasSetDirective;                    // Defaults to true.
24919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
25019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// HasAggressiveSymbolFolding - False if the assembler requires that we use
25119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// Lc = a - b
25219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// .long Lc
25319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// instead of
25419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// .long a - b
25519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool HasAggressiveSymbolFolding;           // Defaults to true.
25619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
25719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// LCOMMDirectiveType - Describes if the target supports the .lcomm
25819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// directive and whether it has an alignment parameter.
25919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    LCOMM::LCOMMType LCOMMDirectiveType;     // Defaults to LCOMM::None.
26019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
261894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
262894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// alignment is to be specified in bytes instead of log2(n).
263894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool COMMDirectiveAlignmentIsInBytes;    // Defaults to true;
26419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
265894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasDotTypeDotSizeDirective - True if the target has .type and .size
266894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// directives, this is true for most ELF targets.
267894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasDotTypeDotSizeDirective;         // Defaults to true.
268894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
269894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasSingleParameterDotFile - True if the target has a single parameter
270894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// .file directive, this is true for ELF targets.
271894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasSingleParameterDotFile;          // Defaults to true.
272894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
273894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip
274894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// directive.
275894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasNoDeadStrip;                     // Defaults to false.
276894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
27719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// HasSymbolResolver - True if this target supports the MachO
27819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// .symbol_resolver directive.
27919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool HasSymbolResolver;                     // Defaults to false.
28019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
281894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// WeakRefDirective - This directive, if non-null, is used to declare a
282894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// global as being a weak undefined symbol.
283894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *WeakRefDirective;            // Defaults to NULL.
28419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
285894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// WeakDefDirective - This directive, if non-null, is used to declare a
286894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// global as being a weak defined symbol.
287894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *WeakDefDirective;            // Defaults to NULL.
288894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
289894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LinkOnceDirective - This directive, if non-null is used to declare a
290894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// global as being a weak defined symbol.  This is used on cygwin/mingw.
291894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *LinkOnceDirective;           // Defaults to NULL.
29219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
293894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to
294894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// declare a symbol as having hidden visibility.
295894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MCSymbolAttr HiddenVisibilityAttr;       // Defaults to MCSA_Hidden.
296894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
29719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// HiddenDeclarationVisibilityAttr - This attribute, if not MCSA_Invalid,
29819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// is used to declare an undefined symbol as having hidden visibility.
29919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MCSymbolAttr HiddenDeclarationVisibilityAttr;   // Defaults to MCSA_Hidden.
30019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
30119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
302894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used
303894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// to declare a symbol as having protected visibility.
304894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MCSymbolAttr ProtectedVisibilityAttr;    // Defaults to MCSA_Protected
305894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
306894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===--- Dwarf Emission Directives -----------------------------------===//
307894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
308894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// HasLEB128 - True if target asm supports leb128 directives.
309894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool HasLEB128;                          // Defaults to false.
310894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
311894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SupportsDebugInformation - True if target supports emission of debugging
312894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// information.
313894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SupportsDebugInformation;           // Defaults to false.
314894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
315894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SupportsExceptionHandling - True if target supports exception handling.
316894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None
317894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
318894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to
319894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// encode inline subroutine information.
320894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool DwarfUsesInlineInfoSection;         // Defaults to false.
321894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
322894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// DwarfSectionOffsetDirective - Special section offset directive.
323894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char* DwarfSectionOffsetDirective; // Defaults to NULL
32419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
32519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// DwarfRequiresRelocationForSectionOffset - True if we need to produce a
32619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    // relocation when we want a section offset in dwarf.
32719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool DwarfRequiresRelocationForSectionOffset;  // Defaults to true;
32819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
32919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    // DwarfUsesLabelOffsetDifference - True if Dwarf2 output can
33019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    // use EmitLabelOffsetDifference.
33119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool DwarfUsesLabelOffsetForRanges;
33219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
33319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// DwarfRegNumForCFI - True if dwarf register numbers are printed
33419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// instead of symbolic register names in .cfi_* directives.
33519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool DwarfRegNumForCFI;  // Defaults to false;
33619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
337894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //===--- CBE Asm Translation Table -----------------------------------===//
338894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
339894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *const *AsmTransCBE;          // Defaults to empty
340894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
34119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    //===--- Prologue State ----------------------------------------------===//
34219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
34319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    std::vector<MachineMove> InitialFrameState;
34419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
345894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  public:
346894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    explicit MCAsmInfo();
347894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual ~MCAsmInfo();
348894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
349894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // FIXME: move these methods to DwarfPrinter when the JIT stops using them.
350894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    static unsigned getSLEB128Size(int Value);
351894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    static unsigned getULEB128Size(unsigned Value);
352894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
35319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// getPointerSize - Get the pointer size in bytes.
35419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    unsigned getPointerSize() const {
35519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return PointerSize;
35619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
35719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
35819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// islittleendian - True if the target is little endian.
35919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool isLittleEndian() const {
36019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return IsLittleEndian;
36119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
36219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
36319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// isStackGrowthDirectionUp - True if target stack grow up.
36419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool isStackGrowthDirectionUp() const {
36519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return StackGrowsUp;
36619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
36719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
368894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
36919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
370894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // Data directive accessors.
371894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //
372894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getData8bitsDirective(unsigned AS = 0) const {
373894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS);
374894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
375894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getData16bitsDirective(unsigned AS = 0) const {
376894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS);
377894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
378894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getData32bitsDirective(unsigned AS = 0) const {
379894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS);
380894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
381894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getData64bitsDirective(unsigned AS = 0) const {
382894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
383894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
384894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getGPRel32Directive() const { return GPRel32Directive; }
385894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
38619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// [Code|Data]Begin label name accessors.
38719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getCodeBeginLabelName() const { return CodeBegin; }
38819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getDataBeginLabelName() const { return DataBegin; }
38919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getJumpTable8BeginLabelName() const { return JT8Begin; }
39019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getJumpTable16BeginLabelName() const { return JT16Begin; }
39119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getJumpTable32BeginLabelName() const { return JT32Begin; }
39219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool getSupportsDataRegions() const { return SupportsDataRegions; }
39319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
394894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getNonexecutableStackSection - Targets can implement this method to
395894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// specify a section to switch to if the translation unit doesn't have any
396894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// trampolines that require an executable stack.
397894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
398894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return 0;
399894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
40019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
40119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual const MCExpr *
40219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    getExprForPersonalitySymbol(const MCSymbol *Sym,
40319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                unsigned Encoding,
40419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                MCStreamer &Streamer) const;
40519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
40619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const MCExpr *
40719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    getExprForFDESymbol(const MCSymbol *Sym,
40819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                        unsigned Encoding,
40919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                        MCStreamer &Streamer) const;
41019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
411894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool usesSunStyleELFSectionSwitchSyntax() const {
412894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return SunStyleELFSectionSwitchSyntax;
413894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
41419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
415894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool usesELFSectionDirectiveForBSS() const {
416894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return UsesELFSectionDirectiveForBSS;
417894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
418894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
419894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasMicrosoftFastStdCallMangling() const {
420894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return HasMicrosoftFastStdCallMangling;
421894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
42219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
423894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // Accessors.
424894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    //
425894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
426894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
42719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    Structors::OutputOrder getStructorOutputOrder() const {
42819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return StructorOutputOrder;
42919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
430894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasStaticCtorDtorReferenceInStaticMode() const {
431894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return HasStaticCtorDtorReferenceInStaticMode;
432894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
43319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool getLinkerRequiresNonEmptyDwarfLines() const {
43419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return LinkerRequiresNonEmptyDwarfLines;
43519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
436894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getMaxInstLength() const {
437894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return MaxInstLength;
438894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
439894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getPCSymbol() const {
440894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return PCSymbol;
441894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
44219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getSeparatorString() const {
44319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return SeparatorString;
444894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
445894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getCommentColumn() const {
446894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return CommentColumn;
447894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
448894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getCommentString() const {
449894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return CommentString;
450894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
45119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getLabelSuffix() const {
45219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return LabelSuffix;
45319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
454894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getGlobalPrefix() const {
455894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return GlobalPrefix;
456894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
457894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getPrivateGlobalPrefix() const {
458894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return PrivateGlobalPrefix;
459894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
460894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getLinkerPrivateGlobalPrefix() const {
461894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return LinkerPrivateGlobalPrefix;
462894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
463894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getInlineAsmStart() const {
464894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return InlineAsmStart;
465894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
466894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getInlineAsmEnd() const {
467894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return InlineAsmEnd;
468894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
46919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getCode16Directive() const {
47019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return Code16Directive;
47119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
47219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getCode32Directive() const {
47319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return Code32Directive;
47419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
47519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const char *getCode64Directive() const {
47619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return Code64Directive;
47719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
478894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getAssemblerDialect() const {
479894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AssemblerDialect;
480894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
481894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesAllowQuotesInName() const {
482894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AllowQuotesInName;
483894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
484894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesAllowNameToStartWithDigit() const {
485894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AllowNameToStartWithDigit;
486894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
487894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesAllowPeriodsInName() const {
488894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AllowPeriodsInName;
489894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
490894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getZeroDirective() const {
491894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return ZeroDirective;
492894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
493894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getAsciiDirective() const {
494894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AsciiDirective;
495894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
496894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getAscizDirective() const {
497894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AscizDirective;
498894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
499894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getAlignDirective() const {
500894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AlignDirective;
501894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
502894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool getAlignmentIsInBytes() const {
503894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AlignmentIsInBytes;
504894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
505894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getTextAlignFillValue() const {
506894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return TextAlignFillValue;
507894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
508894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getGlobalDirective() const {
509894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return GlobalDirective;
510894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
511894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getExternDirective() const {
512894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return ExternDirective;
513894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
514894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasSetDirective() const { return HasSetDirective; }
51519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool hasAggressiveSymbolFolding() const {
51619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return HasAggressiveSymbolFolding;
51719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
51819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    LCOMM::LCOMMType getLCOMMDirectiveType() const {
51919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return LCOMMDirectiveType;
52019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
521894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
522894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool getCOMMDirectiveAlignmentIsInBytes() const {
523894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return COMMDirectiveAlignmentIsInBytes;
524894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
525894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
526894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasNoDeadStrip() const { return HasNoDeadStrip; }
52719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool hasSymbolResolver() const { return HasSymbolResolver; }
528894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getWeakRefDirective() const { return WeakRefDirective; }
529894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getWeakDefDirective() const { return WeakDefDirective; }
530894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getLinkOnceDirective() const { return LinkOnceDirective; }
53119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
532894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
53319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
53419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return HiddenDeclarationVisibilityAttr;
53519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
536894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MCSymbolAttr getProtectedVisibilityAttr() const {
537894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return ProtectedVisibilityAttr;
538894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
539894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool hasLEB128() const {
540894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return HasLEB128;
541894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
542894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesSupportDebugInformation() const {
543894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return SupportsDebugInformation;
544894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
545894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesSupportExceptionHandling() const {
546894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return ExceptionsType != ExceptionHandling::None;
547894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
548894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ExceptionHandling::ExceptionsType getExceptionHandlingType() const {
549894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return ExceptionsType;
550894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
55119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool isExceptionHandlingDwarf() const {
55219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return
55319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman        (ExceptionsType == ExceptionHandling::DwarfCFI ||
55419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman         ExceptionsType == ExceptionHandling::ARM ||
55519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman         ExceptionsType == ExceptionHandling::Win64);
556894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
557894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool doesDwarfUsesInlineInfoSection() const {
558894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return DwarfUsesInlineInfoSection;
559894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
560894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *getDwarfSectionOffsetDirective() const {
561894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return DwarfSectionOffsetDirective;
562894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
56319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool doesDwarfRequireRelocationForSectionOffset() const {
56419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return DwarfRequiresRelocationForSectionOffset;
56519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
56619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool doesDwarfUsesLabelOffsetForRanges() const {
56719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return DwarfUsesLabelOffsetForRanges;
56819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
56919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool useDwarfRegNumForCFI() const {
57019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return DwarfRegNumForCFI;
57119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
572894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const char *const *getAsmCBE() const {
573894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return AsmTransCBE;
574894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
57519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
57619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    void addInitialFrameState(MCSymbol *label, const MachineLocation &D,
57719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                              const MachineLocation &S) {
57819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      InitialFrameState.push_back(MachineMove(label, D, S));
57919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
58019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const std::vector<MachineMove> &getInitialFrameState() const {
58119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      return InitialFrameState;
58219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    }
583894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  };
584894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
585894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
586894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif
587