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