xref: /aosp_15_r20/external/llvm/include/llvm/MC/MCAsmInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file contains a class to be used as the basis for target specific
11*9880d681SAndroid Build Coastguard Worker // asm writers.  This class primarily takes care of global printing constants,
12*9880d681SAndroid Build Coastguard Worker // which are used in very similar ways across all targets.
13*9880d681SAndroid Build Coastguard Worker //
14*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_MC_MCASMINFO_H
17*9880d681SAndroid Build Coastguard Worker #define LLVM_MC_MCASMINFO_H
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCDirectives.h"
20*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCDwarf.h"
21*9880d681SAndroid Build Coastguard Worker #include <cassert>
22*9880d681SAndroid Build Coastguard Worker #include <vector>
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker namespace llvm {
25*9880d681SAndroid Build Coastguard Worker class MCExpr;
26*9880d681SAndroid Build Coastguard Worker class MCSection;
27*9880d681SAndroid Build Coastguard Worker class MCStreamer;
28*9880d681SAndroid Build Coastguard Worker class MCSymbol;
29*9880d681SAndroid Build Coastguard Worker class MCContext;
30*9880d681SAndroid Build Coastguard Worker 
31*9880d681SAndroid Build Coastguard Worker namespace WinEH {
32*9880d681SAndroid Build Coastguard Worker enum class EncodingType {
33*9880d681SAndroid Build Coastguard Worker   Invalid, /// Invalid
34*9880d681SAndroid Build Coastguard Worker   Alpha,   /// Windows Alpha
35*9880d681SAndroid Build Coastguard Worker   Alpha64, /// Windows AXP64
36*9880d681SAndroid Build Coastguard Worker   ARM,     /// Windows NT (Windows on ARM)
37*9880d681SAndroid Build Coastguard Worker   CE,      /// Windows CE ARM, PowerPC, SH3, SH4
38*9880d681SAndroid Build Coastguard Worker   Itanium, /// Windows x64, Windows Itanium (IA-64)
39*9880d681SAndroid Build Coastguard Worker   X86,     /// Windows x86, uses no CFI, just EH tables
40*9880d681SAndroid Build Coastguard Worker   MIPS = Alpha,
41*9880d681SAndroid Build Coastguard Worker };
42*9880d681SAndroid Build Coastguard Worker }
43*9880d681SAndroid Build Coastguard Worker 
44*9880d681SAndroid Build Coastguard Worker enum class ExceptionHandling {
45*9880d681SAndroid Build Coastguard Worker   None,     /// No exception support
46*9880d681SAndroid Build Coastguard Worker   DwarfCFI, /// DWARF-like instruction based exceptions
47*9880d681SAndroid Build Coastguard Worker   SjLj,     /// setjmp/longjmp based exceptions
48*9880d681SAndroid Build Coastguard Worker   ARM,      /// ARM EHABI
49*9880d681SAndroid Build Coastguard Worker   WinEH,    /// Windows Exception Handling
50*9880d681SAndroid Build Coastguard Worker };
51*9880d681SAndroid Build Coastguard Worker 
52*9880d681SAndroid Build Coastguard Worker namespace LCOMM {
53*9880d681SAndroid Build Coastguard Worker enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
54*9880d681SAndroid Build Coastguard Worker }
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker enum class DebugCompressionType {
57*9880d681SAndroid Build Coastguard Worker   DCT_None,    // no compression
58*9880d681SAndroid Build Coastguard Worker   DCT_Zlib,    // zlib style complession
59*9880d681SAndroid Build Coastguard Worker   DCT_ZlibGnu  // zlib-gnu style compression
60*9880d681SAndroid Build Coastguard Worker };
61*9880d681SAndroid Build Coastguard Worker 
62*9880d681SAndroid Build Coastguard Worker /// This class is intended to be used as a base class for asm
63*9880d681SAndroid Build Coastguard Worker /// properties and features specific to the target.
64*9880d681SAndroid Build Coastguard Worker class MCAsmInfo {
65*9880d681SAndroid Build Coastguard Worker protected:
66*9880d681SAndroid Build Coastguard Worker   //===------------------------------------------------------------------===//
67*9880d681SAndroid Build Coastguard Worker   // Properties to be set by the target writer, used to configure asm printer.
68*9880d681SAndroid Build Coastguard Worker   //
69*9880d681SAndroid Build Coastguard Worker 
70*9880d681SAndroid Build Coastguard Worker   /// Pointer size in bytes.  Default is 4.
71*9880d681SAndroid Build Coastguard Worker   unsigned PointerSize;
72*9880d681SAndroid Build Coastguard Worker 
73*9880d681SAndroid Build Coastguard Worker   /// Size of the stack slot reserved for callee-saved registers, in bytes.
74*9880d681SAndroid Build Coastguard Worker   /// Default is same as pointer size.
75*9880d681SAndroid Build Coastguard Worker   unsigned CalleeSaveStackSlotSize;
76*9880d681SAndroid Build Coastguard Worker 
77*9880d681SAndroid Build Coastguard Worker   /// True if target is little endian.  Default is true.
78*9880d681SAndroid Build Coastguard Worker   bool IsLittleEndian;
79*9880d681SAndroid Build Coastguard Worker 
80*9880d681SAndroid Build Coastguard Worker   /// True if target stack grow up.  Default is false.
81*9880d681SAndroid Build Coastguard Worker   bool StackGrowsUp;
82*9880d681SAndroid Build Coastguard Worker 
83*9880d681SAndroid Build Coastguard Worker   /// True if this target has the MachO .subsections_via_symbols directive.
84*9880d681SAndroid Build Coastguard Worker   /// Default is false.
85*9880d681SAndroid Build Coastguard Worker   bool HasSubsectionsViaSymbols;
86*9880d681SAndroid Build Coastguard Worker 
87*9880d681SAndroid Build Coastguard Worker   /// True if this is a MachO target that supports the macho-specific .zerofill
88*9880d681SAndroid Build Coastguard Worker   /// directive for emitting BSS Symbols.  Default is false.
89*9880d681SAndroid Build Coastguard Worker   bool HasMachoZeroFillDirective;
90*9880d681SAndroid Build Coastguard Worker 
91*9880d681SAndroid Build Coastguard Worker   /// True if this is a MachO target that supports the macho-specific .tbss
92*9880d681SAndroid Build Coastguard Worker   /// directive for emitting thread local BSS Symbols.  Default is false.
93*9880d681SAndroid Build Coastguard Worker   bool HasMachoTBSSDirective;
94*9880d681SAndroid Build Coastguard Worker 
95*9880d681SAndroid Build Coastguard Worker   /// True if the compiler should emit a ".reference .constructors_used" or
96*9880d681SAndroid Build Coastguard Worker   /// ".reference .destructors_used" directive after the static ctor/dtor
97*9880d681SAndroid Build Coastguard Worker   /// list.  This directive is only emitted in Static relocation model.  Default
98*9880d681SAndroid Build Coastguard Worker   /// is false.
99*9880d681SAndroid Build Coastguard Worker   bool HasStaticCtorDtorReferenceInStaticMode;
100*9880d681SAndroid Build Coastguard Worker 
101*9880d681SAndroid Build Coastguard Worker   /// This is the maximum possible length of an instruction, which is needed to
102*9880d681SAndroid Build Coastguard Worker   /// compute the size of an inline asm.  Defaults to 4.
103*9880d681SAndroid Build Coastguard Worker   unsigned MaxInstLength;
104*9880d681SAndroid Build Coastguard Worker 
105*9880d681SAndroid Build Coastguard Worker   /// Every possible instruction length is a multiple of this value.  Factored
106*9880d681SAndroid Build Coastguard Worker   /// out in .debug_frame and .debug_line.  Defaults to 1.
107*9880d681SAndroid Build Coastguard Worker   unsigned MinInstAlignment;
108*9880d681SAndroid Build Coastguard Worker 
109*9880d681SAndroid Build Coastguard Worker   /// The '$' token, when not referencing an identifier or constant, refers to
110*9880d681SAndroid Build Coastguard Worker   /// the current PC.  Defaults to false.
111*9880d681SAndroid Build Coastguard Worker   bool DollarIsPC;
112*9880d681SAndroid Build Coastguard Worker 
113*9880d681SAndroid Build Coastguard Worker   /// This string, if specified, is used to separate instructions from each
114*9880d681SAndroid Build Coastguard Worker   /// other when on the same line.  Defaults to ';'
115*9880d681SAndroid Build Coastguard Worker   const char *SeparatorString;
116*9880d681SAndroid Build Coastguard Worker 
117*9880d681SAndroid Build Coastguard Worker   /// This indicates the comment character used by the assembler.  Defaults to
118*9880d681SAndroid Build Coastguard Worker   /// "#"
119*9880d681SAndroid Build Coastguard Worker   const char *CommentString;
120*9880d681SAndroid Build Coastguard Worker 
121*9880d681SAndroid Build Coastguard Worker   /// This is appended to emitted labels.  Defaults to ":"
122*9880d681SAndroid Build Coastguard Worker   const char *LabelSuffix;
123*9880d681SAndroid Build Coastguard Worker 
124*9880d681SAndroid Build Coastguard Worker   // Print the EH begin symbol with an assignment. Defaults to false.
125*9880d681SAndroid Build Coastguard Worker   bool UseAssignmentForEHBegin;
126*9880d681SAndroid Build Coastguard Worker 
127*9880d681SAndroid Build Coastguard Worker   // Do we need to create a local symbol for .size?
128*9880d681SAndroid Build Coastguard Worker   bool NeedsLocalForSize;
129*9880d681SAndroid Build Coastguard Worker 
130*9880d681SAndroid Build Coastguard Worker   /// This prefix is used for globals like constant pool entries that are
131*9880d681SAndroid Build Coastguard Worker   /// completely private to the .s file and should not have names in the .o
132*9880d681SAndroid Build Coastguard Worker   /// file.  Defaults to "L"
133*9880d681SAndroid Build Coastguard Worker   const char *PrivateGlobalPrefix;
134*9880d681SAndroid Build Coastguard Worker 
135*9880d681SAndroid Build Coastguard Worker   /// This prefix is used for labels for basic blocks. Defaults to the same as
136*9880d681SAndroid Build Coastguard Worker   /// PrivateGlobalPrefix.
137*9880d681SAndroid Build Coastguard Worker   const char *PrivateLabelPrefix;
138*9880d681SAndroid Build Coastguard Worker 
139*9880d681SAndroid Build Coastguard Worker   /// This prefix is used for symbols that should be passed through the
140*9880d681SAndroid Build Coastguard Worker   /// assembler but be removed by the linker.  This is 'l' on Darwin, currently
141*9880d681SAndroid Build Coastguard Worker   /// used for some ObjC metadata.  The default of "" meast that for this system
142*9880d681SAndroid Build Coastguard Worker   /// a plain private symbol should be used.  Defaults to "".
143*9880d681SAndroid Build Coastguard Worker   const char *LinkerPrivateGlobalPrefix;
144*9880d681SAndroid Build Coastguard Worker 
145*9880d681SAndroid Build Coastguard Worker   /// If these are nonempty, they contain a directive to emit before and after
146*9880d681SAndroid Build Coastguard Worker   /// an inline assembly statement.  Defaults to "#APP\n", "#NO_APP\n"
147*9880d681SAndroid Build Coastguard Worker   const char *InlineAsmStart;
148*9880d681SAndroid Build Coastguard Worker   const char *InlineAsmEnd;
149*9880d681SAndroid Build Coastguard Worker 
150*9880d681SAndroid Build Coastguard Worker   /// These are assembly directives that tells the assembler to interpret the
151*9880d681SAndroid Build Coastguard Worker   /// following instructions differently.  Defaults to ".code16", ".code32",
152*9880d681SAndroid Build Coastguard Worker   /// ".code64".
153*9880d681SAndroid Build Coastguard Worker   const char *Code16Directive;
154*9880d681SAndroid Build Coastguard Worker   const char *Code32Directive;
155*9880d681SAndroid Build Coastguard Worker   const char *Code64Directive;
156*9880d681SAndroid Build Coastguard Worker 
157*9880d681SAndroid Build Coastguard Worker   /// Which dialect of an assembler variant to use.  Defaults to 0
158*9880d681SAndroid Build Coastguard Worker   unsigned AssemblerDialect;
159*9880d681SAndroid Build Coastguard Worker 
160*9880d681SAndroid Build Coastguard Worker   /// This is true if the assembler allows @ characters in symbol names.
161*9880d681SAndroid Build Coastguard Worker   /// Defaults to false.
162*9880d681SAndroid Build Coastguard Worker   bool AllowAtInName;
163*9880d681SAndroid Build Coastguard Worker 
164*9880d681SAndroid Build Coastguard Worker   /// If this is true, symbol names with invalid characters will be printed in
165*9880d681SAndroid Build Coastguard Worker   /// quotes.
166*9880d681SAndroid Build Coastguard Worker   bool SupportsQuotedNames;
167*9880d681SAndroid Build Coastguard Worker 
168*9880d681SAndroid Build Coastguard Worker   /// This is true if data region markers should be printed as
169*9880d681SAndroid Build Coastguard Worker   /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels
170*9880d681SAndroid Build Coastguard Worker   /// instead.
171*9880d681SAndroid Build Coastguard Worker   bool UseDataRegionDirectives;
172*9880d681SAndroid Build Coastguard Worker 
173*9880d681SAndroid Build Coastguard Worker   //===--- Data Emission Directives -------------------------------------===//
174*9880d681SAndroid Build Coastguard Worker 
175*9880d681SAndroid Build Coastguard Worker   /// This should be set to the directive used to get some number of zero bytes
176*9880d681SAndroid Build Coastguard Worker   /// emitted to the current section.  Common cases are "\t.zero\t" and
177*9880d681SAndroid Build Coastguard Worker   /// "\t.space\t".  If this is set to null, the Data*bitsDirective's will be
178*9880d681SAndroid Build Coastguard Worker   /// used to emit zero bytes.  Defaults to "\t.zero\t"
179*9880d681SAndroid Build Coastguard Worker   const char *ZeroDirective;
180*9880d681SAndroid Build Coastguard Worker 
181*9880d681SAndroid Build Coastguard Worker   /// This directive allows emission of an ascii string with the standard C
182*9880d681SAndroid Build Coastguard Worker   /// escape characters embedded into it.  Defaults to "\t.ascii\t"
183*9880d681SAndroid Build Coastguard Worker   const char *AsciiDirective;
184*9880d681SAndroid Build Coastguard Worker 
185*9880d681SAndroid Build Coastguard Worker   /// If not null, this allows for special handling of zero terminated strings
186*9880d681SAndroid Build Coastguard Worker   /// on this target.  This is commonly supported as ".asciz".  If a target
187*9880d681SAndroid Build Coastguard Worker   /// doesn't support this, it can be set to null.  Defaults to "\t.asciz\t"
188*9880d681SAndroid Build Coastguard Worker   const char *AscizDirective;
189*9880d681SAndroid Build Coastguard Worker 
190*9880d681SAndroid Build Coastguard Worker   /// These directives are used to output some unit of integer data to the
191*9880d681SAndroid Build Coastguard Worker   /// current section.  If a data directive is set to null, smaller data
192*9880d681SAndroid Build Coastguard Worker   /// directives will be used to emit the large sizes.  Defaults to "\t.byte\t",
193*9880d681SAndroid Build Coastguard Worker   /// "\t.short\t", "\t.long\t", "\t.quad\t"
194*9880d681SAndroid Build Coastguard Worker   const char *Data8bitsDirective;
195*9880d681SAndroid Build Coastguard Worker   const char *Data16bitsDirective;
196*9880d681SAndroid Build Coastguard Worker   const char *Data32bitsDirective;
197*9880d681SAndroid Build Coastguard Worker   const char *Data64bitsDirective;
198*9880d681SAndroid Build Coastguard Worker 
199*9880d681SAndroid Build Coastguard Worker   /// If non-null, a directive that is used to emit a word which should be
200*9880d681SAndroid Build Coastguard Worker   /// relocated as a 64-bit GP-relative offset, e.g. .gpdword on Mips.  Defaults
201*9880d681SAndroid Build Coastguard Worker   /// to NULL.
202*9880d681SAndroid Build Coastguard Worker   const char *GPRel64Directive;
203*9880d681SAndroid Build Coastguard Worker 
204*9880d681SAndroid Build Coastguard Worker   /// If non-null, a directive that is used to emit a word which should be
205*9880d681SAndroid Build Coastguard Worker   /// relocated as a 32-bit GP-relative offset, e.g. .gpword on Mips or .gprel32
206*9880d681SAndroid Build Coastguard Worker   /// on Alpha.  Defaults to NULL.
207*9880d681SAndroid Build Coastguard Worker   const char *GPRel32Directive;
208*9880d681SAndroid Build Coastguard Worker 
209*9880d681SAndroid Build Coastguard Worker   /// This is true if this target uses "Sun Style" syntax for section switching
210*9880d681SAndroid Build Coastguard Worker   /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
211*9880d681SAndroid Build Coastguard Worker   /// .section directives.  Defaults to false.
212*9880d681SAndroid Build Coastguard Worker   bool SunStyleELFSectionSwitchSyntax;
213*9880d681SAndroid Build Coastguard Worker 
214*9880d681SAndroid Build Coastguard Worker   /// This is true if this target uses ELF '.section' directive before the
215*9880d681SAndroid Build Coastguard Worker   /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
216*9880d681SAndroid Build Coastguard Worker   /// directive only.  Defaults to false.
217*9880d681SAndroid Build Coastguard Worker   bool UsesELFSectionDirectiveForBSS;
218*9880d681SAndroid Build Coastguard Worker 
219*9880d681SAndroid Build Coastguard Worker   bool NeedsDwarfSectionOffsetDirective;
220*9880d681SAndroid Build Coastguard Worker 
221*9880d681SAndroid Build Coastguard Worker   //===--- Alignment Information ----------------------------------------===//
222*9880d681SAndroid Build Coastguard Worker 
223*9880d681SAndroid Build Coastguard Worker   /// If this is true (the default) then the asmprinter emits ".align N"
224*9880d681SAndroid Build Coastguard Worker   /// directives, where N is the number of bytes to align to.  Otherwise, it
225*9880d681SAndroid Build Coastguard Worker   /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary.  Defaults
226*9880d681SAndroid Build Coastguard Worker   /// to true.
227*9880d681SAndroid Build Coastguard Worker   bool AlignmentIsInBytes;
228*9880d681SAndroid Build Coastguard Worker 
229*9880d681SAndroid Build Coastguard Worker   /// If non-zero, this is used to fill the executable space created as the
230*9880d681SAndroid Build Coastguard Worker   /// result of a alignment directive.  Defaults to 0
231*9880d681SAndroid Build Coastguard Worker   unsigned TextAlignFillValue;
232*9880d681SAndroid Build Coastguard Worker 
233*9880d681SAndroid Build Coastguard Worker   //===--- Global Variable Emission Directives --------------------------===//
234*9880d681SAndroid Build Coastguard Worker 
235*9880d681SAndroid Build Coastguard Worker   /// This is the directive used to declare a global entity. Defaults to
236*9880d681SAndroid Build Coastguard Worker   /// ".globl".
237*9880d681SAndroid Build Coastguard Worker   const char *GlobalDirective;
238*9880d681SAndroid Build Coastguard Worker 
239*9880d681SAndroid Build Coastguard Worker   /// True if the expression
240*9880d681SAndroid Build Coastguard Worker   ///   .long f - g
241*9880d681SAndroid Build Coastguard Worker   /// uses a relocation but it can be suppressed by writing
242*9880d681SAndroid Build Coastguard Worker   ///   a = f - g
243*9880d681SAndroid Build Coastguard Worker   ///   .long a
244*9880d681SAndroid Build Coastguard Worker   bool SetDirectiveSuppressesReloc;
245*9880d681SAndroid Build Coastguard Worker 
246*9880d681SAndroid Build Coastguard Worker   /// False if the assembler requires that we use
247*9880d681SAndroid Build Coastguard Worker   /// \code
248*9880d681SAndroid Build Coastguard Worker   ///   Lc = a - b
249*9880d681SAndroid Build Coastguard Worker   ///   .long Lc
250*9880d681SAndroid Build Coastguard Worker   /// \endcode
251*9880d681SAndroid Build Coastguard Worker   //
252*9880d681SAndroid Build Coastguard Worker   /// instead of
253*9880d681SAndroid Build Coastguard Worker   //
254*9880d681SAndroid Build Coastguard Worker   /// \code
255*9880d681SAndroid Build Coastguard Worker   ///   .long a - b
256*9880d681SAndroid Build Coastguard Worker   /// \endcode
257*9880d681SAndroid Build Coastguard Worker   ///
258*9880d681SAndroid Build Coastguard Worker   ///  Defaults to true.
259*9880d681SAndroid Build Coastguard Worker   bool HasAggressiveSymbolFolding;
260*9880d681SAndroid Build Coastguard Worker 
261*9880d681SAndroid Build Coastguard Worker   /// True is .comm's and .lcomms optional alignment is to be specified in bytes
262*9880d681SAndroid Build Coastguard Worker   /// instead of log2(n).  Defaults to true.
263*9880d681SAndroid Build Coastguard Worker   bool COMMDirectiveAlignmentIsInBytes;
264*9880d681SAndroid Build Coastguard Worker 
265*9880d681SAndroid Build Coastguard Worker   /// Describes if the .lcomm directive for the target supports an alignment
266*9880d681SAndroid Build Coastguard Worker   /// argument and how it is interpreted.  Defaults to NoAlignment.
267*9880d681SAndroid Build Coastguard Worker   LCOMM::LCOMMType LCOMMDirectiveAlignmentType;
268*9880d681SAndroid Build Coastguard Worker 
269*9880d681SAndroid Build Coastguard Worker   // True if the target allows .align directives on functions. This is true for
270*9880d681SAndroid Build Coastguard Worker   // most targets, so defaults to true.
271*9880d681SAndroid Build Coastguard Worker   bool HasFunctionAlignment;
272*9880d681SAndroid Build Coastguard Worker 
273*9880d681SAndroid Build Coastguard Worker   /// True if the target has .type and .size directives, this is true for most
274*9880d681SAndroid Build Coastguard Worker   /// ELF targets.  Defaults to true.
275*9880d681SAndroid Build Coastguard Worker   bool HasDotTypeDotSizeDirective;
276*9880d681SAndroid Build Coastguard Worker 
277*9880d681SAndroid Build Coastguard Worker   /// True if the target has a single parameter .file directive, this is true
278*9880d681SAndroid Build Coastguard Worker   /// for ELF targets.  Defaults to true.
279*9880d681SAndroid Build Coastguard Worker   bool HasSingleParameterDotFile;
280*9880d681SAndroid Build Coastguard Worker 
281*9880d681SAndroid Build Coastguard Worker   /// True if the target has a .ident directive, this is true for ELF targets.
282*9880d681SAndroid Build Coastguard Worker   /// Defaults to false.
283*9880d681SAndroid Build Coastguard Worker   bool HasIdentDirective;
284*9880d681SAndroid Build Coastguard Worker 
285*9880d681SAndroid Build Coastguard Worker   /// True if this target supports the MachO .no_dead_strip directive.  Defaults
286*9880d681SAndroid Build Coastguard Worker   /// to false.
287*9880d681SAndroid Build Coastguard Worker   bool HasNoDeadStrip;
288*9880d681SAndroid Build Coastguard Worker 
289*9880d681SAndroid Build Coastguard Worker   /// True if this target supports the MachO .alt_entry directive.  Defaults to
290*9880d681SAndroid Build Coastguard Worker   /// false.
291*9880d681SAndroid Build Coastguard Worker   bool HasAltEntry;
292*9880d681SAndroid Build Coastguard Worker 
293*9880d681SAndroid Build Coastguard Worker   /// Used to declare a global as being a weak symbol. Defaults to ".weak".
294*9880d681SAndroid Build Coastguard Worker   const char *WeakDirective;
295*9880d681SAndroid Build Coastguard Worker 
296*9880d681SAndroid Build Coastguard Worker   /// This directive, if non-null, is used to declare a global as being a weak
297*9880d681SAndroid Build Coastguard Worker   /// undefined symbol.  Defaults to NULL.
298*9880d681SAndroid Build Coastguard Worker   const char *WeakRefDirective;
299*9880d681SAndroid Build Coastguard Worker 
300*9880d681SAndroid Build Coastguard Worker   /// True if we have a directive to declare a global as being a weak defined
301*9880d681SAndroid Build Coastguard Worker   /// symbol.  Defaults to false.
302*9880d681SAndroid Build Coastguard Worker   bool HasWeakDefDirective;
303*9880d681SAndroid Build Coastguard Worker 
304*9880d681SAndroid Build Coastguard Worker   /// True if we have a directive to declare a global as being a weak defined
305*9880d681SAndroid Build Coastguard Worker   /// symbol that can be hidden (unexported).  Defaults to false.
306*9880d681SAndroid Build Coastguard Worker   bool HasWeakDefCanBeHiddenDirective;
307*9880d681SAndroid Build Coastguard Worker 
308*9880d681SAndroid Build Coastguard Worker   /// True if we have a .linkonce directive.  This is used on cygwin/mingw.
309*9880d681SAndroid Build Coastguard Worker   /// Defaults to false.
310*9880d681SAndroid Build Coastguard Worker   bool HasLinkOnceDirective;
311*9880d681SAndroid Build Coastguard Worker 
312*9880d681SAndroid Build Coastguard Worker   /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
313*9880d681SAndroid Build Coastguard Worker   /// hidden visibility.  Defaults to MCSA_Hidden.
314*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr HiddenVisibilityAttr;
315*9880d681SAndroid Build Coastguard Worker 
316*9880d681SAndroid Build Coastguard Worker   /// This attribute, if not MCSA_Invalid, is used to declare an undefined
317*9880d681SAndroid Build Coastguard Worker   /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
318*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr HiddenDeclarationVisibilityAttr;
319*9880d681SAndroid Build Coastguard Worker 
320*9880d681SAndroid Build Coastguard Worker   /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
321*9880d681SAndroid Build Coastguard Worker   /// protected visibility.  Defaults to MCSA_Protected
322*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr ProtectedVisibilityAttr;
323*9880d681SAndroid Build Coastguard Worker 
324*9880d681SAndroid Build Coastguard Worker   //===--- Dwarf Emission Directives -----------------------------------===//
325*9880d681SAndroid Build Coastguard Worker 
326*9880d681SAndroid Build Coastguard Worker   /// True if target supports emission of debugging information.  Defaults to
327*9880d681SAndroid Build Coastguard Worker   /// false.
328*9880d681SAndroid Build Coastguard Worker   bool SupportsDebugInformation;
329*9880d681SAndroid Build Coastguard Worker 
330*9880d681SAndroid Build Coastguard Worker   /// Exception handling format for the target.  Defaults to None.
331*9880d681SAndroid Build Coastguard Worker   ExceptionHandling ExceptionsType;
332*9880d681SAndroid Build Coastguard Worker 
333*9880d681SAndroid Build Coastguard Worker   /// Windows exception handling data (.pdata) encoding.  Defaults to Invalid.
334*9880d681SAndroid Build Coastguard Worker   WinEH::EncodingType WinEHEncodingType;
335*9880d681SAndroid Build Coastguard Worker 
336*9880d681SAndroid Build Coastguard Worker   /// True if Dwarf2 output generally uses relocations for references to other
337*9880d681SAndroid Build Coastguard Worker   /// .debug_* sections.
338*9880d681SAndroid Build Coastguard Worker   bool DwarfUsesRelocationsAcrossSections;
339*9880d681SAndroid Build Coastguard Worker 
340*9880d681SAndroid Build Coastguard Worker   /// True if DWARF FDE symbol reference relocations should be replaced by an
341*9880d681SAndroid Build Coastguard Worker   /// absolute difference.
342*9880d681SAndroid Build Coastguard Worker   bool DwarfFDESymbolsUseAbsDiff;
343*9880d681SAndroid Build Coastguard Worker 
344*9880d681SAndroid Build Coastguard Worker   /// True if dwarf register numbers are printed instead of symbolic register
345*9880d681SAndroid Build Coastguard Worker   /// names in .cfi_* directives.  Defaults to false.
346*9880d681SAndroid Build Coastguard Worker   bool DwarfRegNumForCFI;
347*9880d681SAndroid Build Coastguard Worker 
348*9880d681SAndroid Build Coastguard Worker   /// True if target uses parens to indicate the symbol variant instead of @.
349*9880d681SAndroid Build Coastguard Worker   /// For example, foo(plt) instead of foo@plt.  Defaults to false.
350*9880d681SAndroid Build Coastguard Worker   bool UseParensForSymbolVariant;
351*9880d681SAndroid Build Coastguard Worker 
352*9880d681SAndroid Build Coastguard Worker   //===--- Prologue State ----------------------------------------------===//
353*9880d681SAndroid Build Coastguard Worker 
354*9880d681SAndroid Build Coastguard Worker   std::vector<MCCFIInstruction> InitialFrameState;
355*9880d681SAndroid Build Coastguard Worker 
356*9880d681SAndroid Build Coastguard Worker   //===--- Integrated Assembler Information ----------------------------===//
357*9880d681SAndroid Build Coastguard Worker 
358*9880d681SAndroid Build Coastguard Worker   /// Should we use the integrated assembler?
359*9880d681SAndroid Build Coastguard Worker   /// The integrated assembler should be enabled by default (by the
360*9880d681SAndroid Build Coastguard Worker   /// constructors) when failing to parse a valid piece of assembly (inline
361*9880d681SAndroid Build Coastguard Worker   /// or otherwise) is considered a bug. It may then be overridden after
362*9880d681SAndroid Build Coastguard Worker   /// construction (see LLVMTargetMachine::initAsmInfo()).
363*9880d681SAndroid Build Coastguard Worker   bool UseIntegratedAssembler;
364*9880d681SAndroid Build Coastguard Worker 
365*9880d681SAndroid Build Coastguard Worker   /// Preserve Comments in assembly
366*9880d681SAndroid Build Coastguard Worker   bool PreserveAsmComments;
367*9880d681SAndroid Build Coastguard Worker 
368*9880d681SAndroid Build Coastguard Worker   /// Compress DWARF debug sections. Defaults to no compression.
369*9880d681SAndroid Build Coastguard Worker   DebugCompressionType CompressDebugSections;
370*9880d681SAndroid Build Coastguard Worker 
371*9880d681SAndroid Build Coastguard Worker   /// True if the integrated assembler should interpret 'a >> b' constant
372*9880d681SAndroid Build Coastguard Worker   /// expressions as logical rather than arithmetic.
373*9880d681SAndroid Build Coastguard Worker   bool UseLogicalShr;
374*9880d681SAndroid Build Coastguard Worker 
375*9880d681SAndroid Build Coastguard Worker   // If true, emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL, on
376*9880d681SAndroid Build Coastguard Worker   // X86_64 ELF.
377*9880d681SAndroid Build Coastguard Worker   bool RelaxELFRelocations = true;
378*9880d681SAndroid Build Coastguard Worker 
379*9880d681SAndroid Build Coastguard Worker public:
380*9880d681SAndroid Build Coastguard Worker   explicit MCAsmInfo();
381*9880d681SAndroid Build Coastguard Worker   virtual ~MCAsmInfo();
382*9880d681SAndroid Build Coastguard Worker 
383*9880d681SAndroid Build Coastguard Worker   /// Get the pointer size in bytes.
getPointerSize()384*9880d681SAndroid Build Coastguard Worker   unsigned getPointerSize() const { return PointerSize; }
385*9880d681SAndroid Build Coastguard Worker 
386*9880d681SAndroid Build Coastguard Worker   /// Get the callee-saved register stack slot
387*9880d681SAndroid Build Coastguard Worker   /// size in bytes.
getCalleeSaveStackSlotSize()388*9880d681SAndroid Build Coastguard Worker   unsigned getCalleeSaveStackSlotSize() const {
389*9880d681SAndroid Build Coastguard Worker     return CalleeSaveStackSlotSize;
390*9880d681SAndroid Build Coastguard Worker   }
391*9880d681SAndroid Build Coastguard Worker 
392*9880d681SAndroid Build Coastguard Worker   /// True if the target is little endian.
isLittleEndian()393*9880d681SAndroid Build Coastguard Worker   bool isLittleEndian() const { return IsLittleEndian; }
394*9880d681SAndroid Build Coastguard Worker 
395*9880d681SAndroid Build Coastguard Worker   /// True if target stack grow up.
isStackGrowthDirectionUp()396*9880d681SAndroid Build Coastguard Worker   bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
397*9880d681SAndroid Build Coastguard Worker 
hasSubsectionsViaSymbols()398*9880d681SAndroid Build Coastguard Worker   bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
399*9880d681SAndroid Build Coastguard Worker 
400*9880d681SAndroid Build Coastguard Worker   // Data directive accessors.
401*9880d681SAndroid Build Coastguard Worker 
getData8bitsDirective()402*9880d681SAndroid Build Coastguard Worker   const char *getData8bitsDirective() const { return Data8bitsDirective; }
getData16bitsDirective()403*9880d681SAndroid Build Coastguard Worker   const char *getData16bitsDirective() const { return Data16bitsDirective; }
getData32bitsDirective()404*9880d681SAndroid Build Coastguard Worker   const char *getData32bitsDirective() const { return Data32bitsDirective; }
getData64bitsDirective()405*9880d681SAndroid Build Coastguard Worker   const char *getData64bitsDirective() const { return Data64bitsDirective; }
getGPRel64Directive()406*9880d681SAndroid Build Coastguard Worker   const char *getGPRel64Directive() const { return GPRel64Directive; }
getGPRel32Directive()407*9880d681SAndroid Build Coastguard Worker   const char *getGPRel32Directive() const { return GPRel32Directive; }
408*9880d681SAndroid Build Coastguard Worker 
409*9880d681SAndroid Build Coastguard Worker   /// Targets can implement this method to specify a section to switch to if the
410*9880d681SAndroid Build Coastguard Worker   /// translation unit doesn't have any trampolines that require an executable
411*9880d681SAndroid Build Coastguard Worker   /// stack.
getNonexecutableStackSection(MCContext & Ctx)412*9880d681SAndroid Build Coastguard Worker   virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
413*9880d681SAndroid Build Coastguard Worker     return nullptr;
414*9880d681SAndroid Build Coastguard Worker   }
415*9880d681SAndroid Build Coastguard Worker 
416*9880d681SAndroid Build Coastguard Worker   /// \brief True if the section is atomized using the symbols in it.
417*9880d681SAndroid Build Coastguard Worker   /// This is false if the section is not atomized at all (most ELF sections) or
418*9880d681SAndroid Build Coastguard Worker   /// if it is atomized based on its contents (MachO' __TEXT,__cstring for
419*9880d681SAndroid Build Coastguard Worker   /// example).
420*9880d681SAndroid Build Coastguard Worker   virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const;
421*9880d681SAndroid Build Coastguard Worker 
422*9880d681SAndroid Build Coastguard Worker   virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
423*9880d681SAndroid Build Coastguard Worker                                                     unsigned Encoding,
424*9880d681SAndroid Build Coastguard Worker                                                     MCStreamer &Streamer) const;
425*9880d681SAndroid Build Coastguard Worker 
426*9880d681SAndroid Build Coastguard Worker   virtual const MCExpr *getExprForFDESymbol(const MCSymbol *Sym,
427*9880d681SAndroid Build Coastguard Worker                                             unsigned Encoding,
428*9880d681SAndroid Build Coastguard Worker                                             MCStreamer &Streamer) const;
429*9880d681SAndroid Build Coastguard Worker 
430*9880d681SAndroid Build Coastguard Worker   /// Return true if the identifier \p Name does not need quotes to be
431*9880d681SAndroid Build Coastguard Worker   /// syntactically correct.
432*9880d681SAndroid Build Coastguard Worker   virtual bool isValidUnquotedName(StringRef Name) const;
433*9880d681SAndroid Build Coastguard Worker 
434*9880d681SAndroid Build Coastguard Worker   /// Return true if the .section directive should be omitted when
435*9880d681SAndroid Build Coastguard Worker   /// emitting \p SectionName.  For example:
436*9880d681SAndroid Build Coastguard Worker   ///
437*9880d681SAndroid Build Coastguard Worker   /// shouldOmitSectionDirective(".text")
438*9880d681SAndroid Build Coastguard Worker   ///
439*9880d681SAndroid Build Coastguard Worker   /// returns false => .section .text,#alloc,#execinstr
440*9880d681SAndroid Build Coastguard Worker   /// returns true  => .text
441*9880d681SAndroid Build Coastguard Worker   virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
442*9880d681SAndroid Build Coastguard Worker 
usesSunStyleELFSectionSwitchSyntax()443*9880d681SAndroid Build Coastguard Worker   bool usesSunStyleELFSectionSwitchSyntax() const {
444*9880d681SAndroid Build Coastguard Worker     return SunStyleELFSectionSwitchSyntax;
445*9880d681SAndroid Build Coastguard Worker   }
446*9880d681SAndroid Build Coastguard Worker 
usesELFSectionDirectiveForBSS()447*9880d681SAndroid Build Coastguard Worker   bool usesELFSectionDirectiveForBSS() const {
448*9880d681SAndroid Build Coastguard Worker     return UsesELFSectionDirectiveForBSS;
449*9880d681SAndroid Build Coastguard Worker   }
450*9880d681SAndroid Build Coastguard Worker 
needsDwarfSectionOffsetDirective()451*9880d681SAndroid Build Coastguard Worker   bool needsDwarfSectionOffsetDirective() const {
452*9880d681SAndroid Build Coastguard Worker     return NeedsDwarfSectionOffsetDirective;
453*9880d681SAndroid Build Coastguard Worker   }
454*9880d681SAndroid Build Coastguard Worker 
455*9880d681SAndroid Build Coastguard Worker   // Accessors.
456*9880d681SAndroid Build Coastguard Worker 
hasMachoZeroFillDirective()457*9880d681SAndroid Build Coastguard Worker   bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
hasMachoTBSSDirective()458*9880d681SAndroid Build Coastguard Worker   bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
hasStaticCtorDtorReferenceInStaticMode()459*9880d681SAndroid Build Coastguard Worker   bool hasStaticCtorDtorReferenceInStaticMode() const {
460*9880d681SAndroid Build Coastguard Worker     return HasStaticCtorDtorReferenceInStaticMode;
461*9880d681SAndroid Build Coastguard Worker   }
getMaxInstLength()462*9880d681SAndroid Build Coastguard Worker   unsigned getMaxInstLength() const { return MaxInstLength; }
getMinInstAlignment()463*9880d681SAndroid Build Coastguard Worker   unsigned getMinInstAlignment() const { return MinInstAlignment; }
getDollarIsPC()464*9880d681SAndroid Build Coastguard Worker   bool getDollarIsPC() const { return DollarIsPC; }
getSeparatorString()465*9880d681SAndroid Build Coastguard Worker   const char *getSeparatorString() const { return SeparatorString; }
466*9880d681SAndroid Build Coastguard Worker 
467*9880d681SAndroid Build Coastguard Worker   /// This indicates the column (zero-based) at which asm comments should be
468*9880d681SAndroid Build Coastguard Worker   /// printed.
getCommentColumn()469*9880d681SAndroid Build Coastguard Worker   unsigned getCommentColumn() const { return 40; }
470*9880d681SAndroid Build Coastguard Worker 
getCommentString()471*9880d681SAndroid Build Coastguard Worker   const char *getCommentString() const { return CommentString; }
getLabelSuffix()472*9880d681SAndroid Build Coastguard Worker   const char *getLabelSuffix() const { return LabelSuffix; }
473*9880d681SAndroid Build Coastguard Worker 
useAssignmentForEHBegin()474*9880d681SAndroid Build Coastguard Worker   bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
needsLocalForSize()475*9880d681SAndroid Build Coastguard Worker   bool needsLocalForSize() const { return NeedsLocalForSize; }
getPrivateGlobalPrefix()476*9880d681SAndroid Build Coastguard Worker   const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
getPrivateLabelPrefix()477*9880d681SAndroid Build Coastguard Worker   const char *getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
hasLinkerPrivateGlobalPrefix()478*9880d681SAndroid Build Coastguard Worker   bool hasLinkerPrivateGlobalPrefix() const {
479*9880d681SAndroid Build Coastguard Worker     return LinkerPrivateGlobalPrefix[0] != '\0';
480*9880d681SAndroid Build Coastguard Worker   }
getLinkerPrivateGlobalPrefix()481*9880d681SAndroid Build Coastguard Worker   const char *getLinkerPrivateGlobalPrefix() const {
482*9880d681SAndroid Build Coastguard Worker     if (hasLinkerPrivateGlobalPrefix())
483*9880d681SAndroid Build Coastguard Worker       return LinkerPrivateGlobalPrefix;
484*9880d681SAndroid Build Coastguard Worker     return getPrivateGlobalPrefix();
485*9880d681SAndroid Build Coastguard Worker   }
getInlineAsmStart()486*9880d681SAndroid Build Coastguard Worker   const char *getInlineAsmStart() const { return InlineAsmStart; }
getInlineAsmEnd()487*9880d681SAndroid Build Coastguard Worker   const char *getInlineAsmEnd() const { return InlineAsmEnd; }
getCode16Directive()488*9880d681SAndroid Build Coastguard Worker   const char *getCode16Directive() const { return Code16Directive; }
getCode32Directive()489*9880d681SAndroid Build Coastguard Worker   const char *getCode32Directive() const { return Code32Directive; }
getCode64Directive()490*9880d681SAndroid Build Coastguard Worker   const char *getCode64Directive() const { return Code64Directive; }
getAssemblerDialect()491*9880d681SAndroid Build Coastguard Worker   unsigned getAssemblerDialect() const { return AssemblerDialect; }
doesAllowAtInName()492*9880d681SAndroid Build Coastguard Worker   bool doesAllowAtInName() const { return AllowAtInName; }
supportsNameQuoting()493*9880d681SAndroid Build Coastguard Worker   bool supportsNameQuoting() const { return SupportsQuotedNames; }
doesSupportDataRegionDirectives()494*9880d681SAndroid Build Coastguard Worker   bool doesSupportDataRegionDirectives() const {
495*9880d681SAndroid Build Coastguard Worker     return UseDataRegionDirectives;
496*9880d681SAndroid Build Coastguard Worker   }
getZeroDirective()497*9880d681SAndroid Build Coastguard Worker   const char *getZeroDirective() const { return ZeroDirective; }
getAsciiDirective()498*9880d681SAndroid Build Coastguard Worker   const char *getAsciiDirective() const { return AsciiDirective; }
getAscizDirective()499*9880d681SAndroid Build Coastguard Worker   const char *getAscizDirective() const { return AscizDirective; }
getAlignmentIsInBytes()500*9880d681SAndroid Build Coastguard Worker   bool getAlignmentIsInBytes() const { return AlignmentIsInBytes; }
getTextAlignFillValue()501*9880d681SAndroid Build Coastguard Worker   unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
getGlobalDirective()502*9880d681SAndroid Build Coastguard Worker   const char *getGlobalDirective() const { return GlobalDirective; }
doesSetDirectiveSuppressReloc()503*9880d681SAndroid Build Coastguard Worker   bool doesSetDirectiveSuppressReloc() const {
504*9880d681SAndroid Build Coastguard Worker     return SetDirectiveSuppressesReloc;
505*9880d681SAndroid Build Coastguard Worker   }
hasAggressiveSymbolFolding()506*9880d681SAndroid Build Coastguard Worker   bool hasAggressiveSymbolFolding() const { return HasAggressiveSymbolFolding; }
getCOMMDirectiveAlignmentIsInBytes()507*9880d681SAndroid Build Coastguard Worker   bool getCOMMDirectiveAlignmentIsInBytes() const {
508*9880d681SAndroid Build Coastguard Worker     return COMMDirectiveAlignmentIsInBytes;
509*9880d681SAndroid Build Coastguard Worker   }
getLCOMMDirectiveAlignmentType()510*9880d681SAndroid Build Coastguard Worker   LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const {
511*9880d681SAndroid Build Coastguard Worker     return LCOMMDirectiveAlignmentType;
512*9880d681SAndroid Build Coastguard Worker   }
hasFunctionAlignment()513*9880d681SAndroid Build Coastguard Worker   bool hasFunctionAlignment() const { return HasFunctionAlignment; }
hasDotTypeDotSizeDirective()514*9880d681SAndroid Build Coastguard Worker   bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; }
hasSingleParameterDotFile()515*9880d681SAndroid Build Coastguard Worker   bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
hasIdentDirective()516*9880d681SAndroid Build Coastguard Worker   bool hasIdentDirective() const { return HasIdentDirective; }
hasNoDeadStrip()517*9880d681SAndroid Build Coastguard Worker   bool hasNoDeadStrip() const { return HasNoDeadStrip; }
hasAltEntry()518*9880d681SAndroid Build Coastguard Worker   bool hasAltEntry() const { return HasAltEntry; }
getWeakDirective()519*9880d681SAndroid Build Coastguard Worker   const char *getWeakDirective() const { return WeakDirective; }
getWeakRefDirective()520*9880d681SAndroid Build Coastguard Worker   const char *getWeakRefDirective() const { return WeakRefDirective; }
hasWeakDefDirective()521*9880d681SAndroid Build Coastguard Worker   bool hasWeakDefDirective() const { return HasWeakDefDirective; }
hasWeakDefCanBeHiddenDirective()522*9880d681SAndroid Build Coastguard Worker   bool hasWeakDefCanBeHiddenDirective() const {
523*9880d681SAndroid Build Coastguard Worker     return HasWeakDefCanBeHiddenDirective;
524*9880d681SAndroid Build Coastguard Worker   }
hasLinkOnceDirective()525*9880d681SAndroid Build Coastguard Worker   bool hasLinkOnceDirective() const { return HasLinkOnceDirective; }
526*9880d681SAndroid Build Coastguard Worker 
getHiddenVisibilityAttr()527*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr; }
getHiddenDeclarationVisibilityAttr()528*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
529*9880d681SAndroid Build Coastguard Worker     return HiddenDeclarationVisibilityAttr;
530*9880d681SAndroid Build Coastguard Worker   }
getProtectedVisibilityAttr()531*9880d681SAndroid Build Coastguard Worker   MCSymbolAttr getProtectedVisibilityAttr() const {
532*9880d681SAndroid Build Coastguard Worker     return ProtectedVisibilityAttr;
533*9880d681SAndroid Build Coastguard Worker   }
doesSupportDebugInformation()534*9880d681SAndroid Build Coastguard Worker   bool doesSupportDebugInformation() const { return SupportsDebugInformation; }
doesSupportExceptionHandling()535*9880d681SAndroid Build Coastguard Worker   bool doesSupportExceptionHandling() const {
536*9880d681SAndroid Build Coastguard Worker     return ExceptionsType != ExceptionHandling::None;
537*9880d681SAndroid Build Coastguard Worker   }
getExceptionHandlingType()538*9880d681SAndroid Build Coastguard Worker   ExceptionHandling getExceptionHandlingType() const { return ExceptionsType; }
getWinEHEncodingType()539*9880d681SAndroid Build Coastguard Worker   WinEH::EncodingType getWinEHEncodingType() const { return WinEHEncodingType; }
540*9880d681SAndroid Build Coastguard Worker 
setExceptionsType(ExceptionHandling EH)541*9880d681SAndroid Build Coastguard Worker   void setExceptionsType(ExceptionHandling EH) {
542*9880d681SAndroid Build Coastguard Worker     ExceptionsType = EH;
543*9880d681SAndroid Build Coastguard Worker   }
544*9880d681SAndroid Build Coastguard Worker 
545*9880d681SAndroid Build Coastguard Worker   /// Returns true if the exception handling method for the platform uses call
546*9880d681SAndroid Build Coastguard Worker   /// frame information to unwind.
usesCFIForEH()547*9880d681SAndroid Build Coastguard Worker   bool usesCFIForEH() const {
548*9880d681SAndroid Build Coastguard Worker     return (ExceptionsType == ExceptionHandling::DwarfCFI ||
549*9880d681SAndroid Build Coastguard Worker             ExceptionsType == ExceptionHandling::ARM || usesWindowsCFI());
550*9880d681SAndroid Build Coastguard Worker   }
551*9880d681SAndroid Build Coastguard Worker 
usesWindowsCFI()552*9880d681SAndroid Build Coastguard Worker   bool usesWindowsCFI() const {
553*9880d681SAndroid Build Coastguard Worker     return ExceptionsType == ExceptionHandling::WinEH &&
554*9880d681SAndroid Build Coastguard Worker            (WinEHEncodingType != WinEH::EncodingType::Invalid &&
555*9880d681SAndroid Build Coastguard Worker             WinEHEncodingType != WinEH::EncodingType::X86);
556*9880d681SAndroid Build Coastguard Worker   }
557*9880d681SAndroid Build Coastguard Worker 
doesDwarfUseRelocationsAcrossSections()558*9880d681SAndroid Build Coastguard Worker   bool doesDwarfUseRelocationsAcrossSections() const {
559*9880d681SAndroid Build Coastguard Worker     return DwarfUsesRelocationsAcrossSections;
560*9880d681SAndroid Build Coastguard Worker   }
doDwarfFDESymbolsUseAbsDiff()561*9880d681SAndroid Build Coastguard Worker   bool doDwarfFDESymbolsUseAbsDiff() const { return DwarfFDESymbolsUseAbsDiff; }
useDwarfRegNumForCFI()562*9880d681SAndroid Build Coastguard Worker   bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; }
useParensForSymbolVariant()563*9880d681SAndroid Build Coastguard Worker   bool useParensForSymbolVariant() const { return UseParensForSymbolVariant; }
564*9880d681SAndroid Build Coastguard Worker 
addInitialFrameState(const MCCFIInstruction & Inst)565*9880d681SAndroid Build Coastguard Worker   void addInitialFrameState(const MCCFIInstruction &Inst) {
566*9880d681SAndroid Build Coastguard Worker     InitialFrameState.push_back(Inst);
567*9880d681SAndroid Build Coastguard Worker   }
568*9880d681SAndroid Build Coastguard Worker 
getInitialFrameState()569*9880d681SAndroid Build Coastguard Worker   const std::vector<MCCFIInstruction> &getInitialFrameState() const {
570*9880d681SAndroid Build Coastguard Worker     return InitialFrameState;
571*9880d681SAndroid Build Coastguard Worker   }
572*9880d681SAndroid Build Coastguard Worker 
573*9880d681SAndroid Build Coastguard Worker   /// Return true if assembly (inline or otherwise) should be parsed.
useIntegratedAssembler()574*9880d681SAndroid Build Coastguard Worker   bool useIntegratedAssembler() const { return UseIntegratedAssembler; }
575*9880d681SAndroid Build Coastguard Worker 
576*9880d681SAndroid Build Coastguard Worker   /// Set whether assembly (inline or otherwise) should be parsed.
setUseIntegratedAssembler(bool Value)577*9880d681SAndroid Build Coastguard Worker   virtual void setUseIntegratedAssembler(bool Value) {
578*9880d681SAndroid Build Coastguard Worker     UseIntegratedAssembler = Value;
579*9880d681SAndroid Build Coastguard Worker   }
580*9880d681SAndroid Build Coastguard Worker 
581*9880d681SAndroid Build Coastguard Worker   /// Return true if assembly (inline or otherwise) should be parsed.
preserveAsmComments()582*9880d681SAndroid Build Coastguard Worker   bool preserveAsmComments() const { return PreserveAsmComments; }
583*9880d681SAndroid Build Coastguard Worker 
584*9880d681SAndroid Build Coastguard Worker   /// Set whether assembly (inline or otherwise) should be parsed.
setPreserveAsmComments(bool Value)585*9880d681SAndroid Build Coastguard Worker   virtual void setPreserveAsmComments(bool Value) {
586*9880d681SAndroid Build Coastguard Worker     PreserveAsmComments = Value;
587*9880d681SAndroid Build Coastguard Worker   }
588*9880d681SAndroid Build Coastguard Worker 
compressDebugSections()589*9880d681SAndroid Build Coastguard Worker   DebugCompressionType compressDebugSections() const {
590*9880d681SAndroid Build Coastguard Worker     return CompressDebugSections;
591*9880d681SAndroid Build Coastguard Worker   }
592*9880d681SAndroid Build Coastguard Worker 
setCompressDebugSections(DebugCompressionType CompressDebugSections)593*9880d681SAndroid Build Coastguard Worker   void setCompressDebugSections(DebugCompressionType CompressDebugSections) {
594*9880d681SAndroid Build Coastguard Worker     this->CompressDebugSections = CompressDebugSections;
595*9880d681SAndroid Build Coastguard Worker   }
596*9880d681SAndroid Build Coastguard Worker 
shouldUseLogicalShr()597*9880d681SAndroid Build Coastguard Worker   bool shouldUseLogicalShr() const { return UseLogicalShr; }
598*9880d681SAndroid Build Coastguard Worker 
canRelaxRelocations()599*9880d681SAndroid Build Coastguard Worker   bool canRelaxRelocations() const { return RelaxELFRelocations; }
setRelaxELFRelocations(bool V)600*9880d681SAndroid Build Coastguard Worker   void setRelaxELFRelocations(bool V) { RelaxELFRelocations = V; }
601*9880d681SAndroid Build Coastguard Worker };
602*9880d681SAndroid Build Coastguard Worker }
603*9880d681SAndroid Build Coastguard Worker 
604*9880d681SAndroid Build Coastguard Worker #endif
605