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