LLVM 24.0.0git
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
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/DenseSet.h"
21#include "llvm/ADT/StringMap.h"
22#include "llvm/ADT/StringRef.h"
26#include <vector>
27
28namespace llvm {
29
30template <typename, unsigned> class EnumStrings;
31class MCAssembler;
32class MCContext;
34class MCExpr;
35class MCSpecifierExpr;
36class MCSection;
37class MCStreamer;
38class MCSubtargetInfo;
39class MCSymbol;
40class MCValue;
41class Triple;
42class raw_ostream;
43
44namespace WinEH {
45
46enum class EncodingType {
47 Invalid, /// Invalid
48 Alpha, /// Windows Alpha
49 Alpha64, /// Windows AXP64
50 ARM, /// Windows NT (Windows on ARM)
51 CE, /// Windows CE ARM, PowerPC, SH3, SH4
52 Itanium, /// Windows x64, Windows Itanium (IA-64)
53 X86, /// Windows x86, uses no CFI, just EH tables
55};
56
57} // end namespace WinEH
58
59namespace LCOMM {
60
62
63} // end namespace LCOMM
64
65/// This class is intended to be used as a base class for asm
66/// properties and features specific to the target.
68public:
69 /// Assembly character literal syntax types.
71 ACLS_Unknown, /// Unknown; character literals not used by LLVM for this
72 /// target.
73 ACLS_SingleQuotePrefix, /// The desired character is prefixed by a single
74 /// quote, e.g., `'A`.
75 };
76
77 /// Type for at specifiers. Currently, 16 bits is enough.
79
80protected:
81 //===------------------------------------------------------------------===//
82 // Properties to be set by the target writer, used to configure asm printer.
83 //
84
85 /// Code pointer size in bytes. Default is 4.
86 unsigned CodePointerSize = 4;
87
88 /// Size of the stack slot reserved for callee-saved registers, in bytes.
89 /// Default is same as pointer size.
91
92 /// True if target is little endian. Default is true.
93 bool IsLittleEndian = true;
94
95 /// True if target stack grow up. Default is false.
96 bool StackGrowsUp = false;
97
98 /// True if this target has the MachO .subsections_via_symbols directive.
99 /// Default is false.
101
102 /// True if this is a non-GNU COFF target. The COFF port of the GNU linker
103 /// doesn't handle associative comdats in the way that we would like to use
104 /// them.
106
107 /// True if this is a non-GNU COFF target. For GNU targets, we don't generate
108 /// constants into comdat sections.
110
111 bool IsAIX = false;
112
113 // True if using the HLASM dialect on z/OS.
114 bool IsHLASM = false;
115
116 /// This is the maximum possible length of an instruction, which is needed to
117 /// compute the size of an inline asm. Defaults to 4.
118 unsigned MaxInstLength = 4;
119
120 /// Every possible instruction length is a multiple of this value. Factored
121 /// out in .debug_frame and .debug_line. Defaults to 1.
122 unsigned MinInstAlignment = 1;
123
124 /// The '$' token, when not referencing an identifier or constant, refers to
125 /// the current PC. Defaults to false.
126 bool DollarIsPC = false;
127
128 /// This string, if specified, is used to separate instructions from each
129 /// other when on the same line. Defaults to ';'
130 const char *SeparatorString = ";";
131
132 /// This indicates the comment string used by the assembler. Defaults to
133 /// "#"
135
136 /// This indicates whether to allow additional "comment strings" to be lexed
137 /// as a comment. Setting this attribute to true, will ensure that C-style
138 /// line comments (// ..), C-style block comments (/* .. */), and "#" are
139 /// all treated as comments in addition to the string specified by the
140 /// CommentString attribute.
141 /// Default is true.
143
144 /// This is appended to emitted labels. Defaults to ":"
145 const char *LabelSuffix = ":";
146
147 /// Use .set instead of = to equate a symbol to an expression.
149
150 // Print the EH begin symbol with an assignment. Defaults to false.
152
153 // Do we need to create a local symbol for .size?
154 bool NeedsLocalForSize = false;
155
156 /// For internal use by compiler and assembler, not meant to be visible
157 /// externally. They are usually not emitted to the symbol table in the
158 /// object file. This is also used for labels for basic blocks.
160
161 /// This prefix is used for symbols that should be passed through the
162 /// assembler but be removed by the linker. This is 'l' on Darwin, currently
163 /// used for some ObjC metadata. The default of "" meast that for this system
164 /// a plain private symbol should be used. Defaults to "".
166
167 /// If these are nonempty, they contain a directive to emit before and after
168 /// an inline assembly statement. Defaults to "APP", "NO_APP"
169 const char *InlineAsmStart = "APP";
170 const char *InlineAsmEnd = "NO_APP";
171
172 /// Which dialect of an assembler variant to use. Defaults to 0
173 unsigned AssemblerDialect = 0;
174
175 /// This is true if the assembler allows @ characters in symbol names.
176 /// Defaults to false.
177 bool AllowAtInName = false;
178
179 /// This is true if the assembler allows the "?" character at the start of
180 /// of a string to be lexed as an AsmToken::Identifier.
181 /// If the AsmLexer determines that the string can be lexed as a possible
182 /// comment, setting this option will have no effect, and the string will
183 /// still be lexed as a comment.
185
186 /// This is true if the assembler allows the "$" character at the start of
187 /// of a string to be lexed as an AsmToken::Identifier.
188 /// If the AsmLexer determines that the string can be lexed as a possible
189 /// comment, setting this option will have no effect, and the string will
190 /// still be lexed as a comment.
192
193 /// This is true if the assembler allows the "@" character at the start of
194 /// a string to be lexed as an AsmToken::Identifier.
195 /// If the AsmLexer determines that the string can be lexed as a possible
196 /// comment, setting this option will have no effect, and the string will
197 /// still be lexed as a comment.
199
200 /// If this is true, symbol names with invalid characters will be printed in
201 /// quotes.
203
204 /// This is true if data region markers should be printed as
205 /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels
206 /// instead.
208
209 /// True if the target supports LEB128 directives.
211
212 /// True if full register names are printed.
214
215 /// True if the target supports the .addrsig directive.
217
218 //===--- Data Emission Directives -------------------------------------===//
219
220 /// This should be set to the directive used to get some number of zero (and
221 /// non-zero if supported by the directive) bytes emitted to the current
222 /// section. Common cases are "\t.zero\t" and "\t.space\t". Defaults to
223 /// "\t.zero\t"
224 const char *ZeroDirective = "\t.zero\t";
225
226 /// This directive allows emission of an ascii string with the standard C
227 /// escape characters embedded into it. If a target doesn't support this, it
228 /// can be set to null. Defaults to "\t.ascii\t"
229 const char *AsciiDirective = "\t.ascii\t";
230
231 /// If not null, this allows for special handling of zero terminated strings
232 /// on this target. This is commonly supported as ".asciz". If a target
233 /// doesn't support this, it can be set to null. Defaults to "\t.asciz\t"
234 const char *AscizDirective = "\t.asciz\t";
235
236 /// Form used for character literals in the assembly syntax. Useful for
237 /// producing strings as byte lists. If a target does not use or support
238 /// this, it shall be set to ACLS_Unknown. Defaults to ACLS_Unknown.
240
241 /// These directives are used to output some unit of integer data to the
242 /// current section. If a data directive is set to null, smaller data
243 /// directives will be used to emit the large sizes. Defaults to "\t.byte\t",
244 /// "\t.short\t", "\t.long\t", "\t.quad\t"
245 const char *Data8bitsDirective = "\t.byte\t";
246 const char *Data16bitsDirective = "\t.short\t";
247 const char *Data32bitsDirective = "\t.long\t";
248 const char *Data64bitsDirective = "\t.quad\t";
249
250 /// True if data directives support signed values
252
253 /// This is true if this target uses "Sun Style" syntax for section switching
254 /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
255 /// .section directives. Defaults to false.
257
258 /// This is true if this target uses ELF '.section' directive before the
259 /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
260 /// directive only. Defaults to false.
262
264
265 //===--- Alignment Information ----------------------------------------===//
266
267 /// If this is true (the default) then the asmprinter emits ".align N"
268 /// directives, where N is the number of bytes to align to. Otherwise, it
269 /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary. Defaults
270 /// to true.
272
273 /// If non-zero, this is used to fill the executable space created as the
274 /// result of a alignment directive. Defaults to 0
275 unsigned TextAlignFillValue = 0;
276
277 //===--- Global Variable Emission Directives --------------------------===//
278
279 /// This is the directive used to declare a global entity. Defaults to
280 /// ".globl".
281 const char *GlobalDirective = "\t.globl\t";
282
283 /// True if the expression
284 /// .long f - g
285 /// uses a relocation but it can be suppressed by writing
286 /// a = f - g
287 /// .long a
289
290 /// True is .comm's and .lcomms optional alignment is to be specified in bytes
291 /// instead of log2(n). Defaults to true.
293
294 /// Describes if the .lcomm directive for the target supports an alignment
295 /// argument and how it is interpreted. Defaults to NoAlignment.
297
298 // True if the target allows .align directives on functions. This is true for
299 // most targets, so defaults to true.
301
302 // True if the target respects .prefalign directives.
304
305 /// True if the target has .type and .size directives, this is true for most
306 /// ELF targets. Defaults to true.
308
309 /// True if the target has a single parameter .file directive, this is true
310 /// for ELF targets. Defaults to true.
312
313 /// True if the target has a .ident directive, this is true for ELF targets.
314 /// Defaults to false.
315 bool HasIdentDirective = false;
316
317 /// True if this target supports the MachO .no_dead_strip directive. Defaults
318 /// to false.
319 bool HasNoDeadStrip = false;
320
321 /// Used to declare a global as being a weak symbol. Defaults to ".weak".
322 const char *WeakDirective = "\t.weak\t";
323
324 /// This directive, if non-null, is used to declare a global as being a weak
325 /// undefined symbol. Defaults to nullptr.
326 const char *WeakRefDirective = nullptr;
327
328 /// True if we have a directive to declare a global as being a weak defined
329 /// symbol that can be hidden (unexported). Defaults to false.
331
332 /// True if we should mark symbols as global instead of weak, for
333 /// weak*/linkonce*, if the symbol has a comdat.
334 /// Defaults to false.
335 bool AvoidWeakIfComdat = false;
336
337 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
338 /// hidden visibility. Defaults to MCSA_Hidden.
340
341 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
342 /// exported visibility. Defaults to MCSA_Exported.
344
345 /// This attribute, if not MCSA_Invalid, is used to declare an undefined
346 /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
348
349 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
350 /// protected visibility. Defaults to MCSA_Protected
352
353 //===--- Dwarf Emission Directives -----------------------------------===//
354
355 /// True if target supports emission of debugging information. Defaults to
356 /// false.
358
359 /// True if target uses CFI unwind information for other purposes than EH
360 /// (debugging / sanitizers) when the exception model is
361 /// `ExceptionHandling::None`.
362 bool UsesCFIWithoutEH = false;
363
364 /// Windows exception handling data (.pdata) encoding. Defaults to Invalid.
366
367 /// True if Dwarf2 output generally uses relocations for references to other
368 /// .debug_* sections.
370
371 /// True if DWARF FDE symbol reference relocations should be replaced by an
372 /// absolute difference.
374
375 /// The optional specifier to use for the relative FDE symbol references.
377
378 /// True if DWARF `.file directory' directive syntax is used by
379 /// default.
381
382 /// True if dwarf register numbers are printed instead of symbolic register
383 /// names in .cfi_* directives. Defaults to false.
384 bool DwarfRegNumForCFI = false;
385
386 /// True if target uses @ (expr@specifier) for relocation specifiers.
387 bool UseAtForSpecifier = false;
388
389 /// (ARM-specific) Uses parens for relocation specifier in data
390 /// directives, e.g. .word foo(got).
392
393 /// True if the target supports flags in ".loc" directive, false if only
394 /// location is allowed.
396
397 //===--- Prologue State ----------------------------------------------===//
398
399 std::vector<MCCFIInstruction> InitialFrameState;
400
401 //===--- Integrated Assembler Information ----------------------------===//
402
403 // Generated object files can use all ELF features supported by GNU ld of
404 // this binutils version and later. INT_MAX means all features can be used,
405 // regardless of GNU ld support. The default value is referenced by
406 // clang/Options/Options.td.
407 std::pair<int, int> BinutilsVersion = {2, 26};
408
409 /// Should we use the integrated assembler?
410 /// The integrated assembler should be enabled by default (by the
411 /// constructors) when failing to parse a valid piece of assembly (inline
412 /// or otherwise) is considered a bug. It may then be overridden after
413 /// construction (see CodeGenTargetMachineImpl::initAsmInfo()).
415
416 /// Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
418
419 /// Preserve Comments in assembly
421
422 /// The column (zero-based) at which asm comments should be printed.
423 unsigned CommentColumn = 40;
424
425 /// True if the integrated assembler should interpret 'a >> b' constant
426 /// expressions as logical rather than arithmetic.
427 bool UseLogicalShr = true;
428
429 // If true, use Motorola-style integers in Assembly (ex. $0ac).
431
432 // This describes a @ style relocation specifier (expr@specifier) supported by
433 // AsmParser::parsePrimaryExpr.
437
438 // Lowercase identifiers (e.g. register names, dialect keywords) that must be
439 // quoted when used as a symbol name.
441
443
444public:
445 explicit MCAsmInfo(const MCTargetOptions &Options);
446 virtual ~MCAsmInfo();
447
448 // Explicitly non-copyable.
449 MCAsmInfo(MCAsmInfo const &) = delete;
450 MCAsmInfo &operator=(MCAsmInfo const &) = delete;
451
453
454 /// Get the code pointer size in bytes.
455 unsigned getCodePointerSize() const { return CodePointerSize; }
456
457 /// Get the callee-saved register stack slot
458 /// size in bytes.
459 unsigned getCalleeSaveStackSlotSize() const {
461 }
462
463 /// True if the target is little endian.
464 bool isLittleEndian() const { return IsLittleEndian; }
465
466 /// True if target stack grow up.
467 bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
468
470
471 // Data directive accessors.
472
473 const char *getData8bitsDirective() const { return Data8bitsDirective; }
474 const char *getData16bitsDirective() const { return Data16bitsDirective; }
475 const char *getData32bitsDirective() const { return Data32bitsDirective; }
476 const char *getData64bitsDirective() const { return Data64bitsDirective; }
477 bool supportsSignedData() const { return SupportsSignedData; }
478
479 /// Targets can implement this method to specify a section to switch to
480 /// depending on whether the translation unit has any trampolines that require
481 /// an executable stack.
482 virtual MCSection *getStackSection(MCContext &Ctx, bool Exec) const {
483 return nullptr;
484 }
485
486 virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
487 unsigned Encoding,
488 MCStreamer &Streamer) const;
489
490 const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding,
491 MCStreamer &Streamer) const;
492
493 /// Return true if C is an acceptable character inside a symbol name.
494 bool isAcceptableChar(char C) const;
495
496 /// Return true if the identifier \p Name does not need quotes to be
497 /// syntactically correct.
498 bool isValidUnquotedName(StringRef Name) const;
499
505 return ReservedIdentifiers;
506 }
507
508 virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
509 const Triple &, raw_ostream &) const {}
510
511 /// Return true if the .section directive should be omitted when
512 /// emitting \p SectionName. For example:
513 ///
514 /// shouldOmitSectionDirective(".text")
515 ///
516 /// returns false => .section .text,#alloc,#execinstr
517 /// returns true => .text
518 virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
519
520 // Return true if a .align directive should use "optimized nops" to fill
521 // instead of 0s.
522 virtual bool useCodeAlign(const MCSection &Sec) const { return false; }
523
527
531
535
536 // Accessors.
537
538 bool isAIX() const { return IsAIX; }
539 bool isHLASM() const { return IsHLASM; }
540 bool isMachO() const { return HasSubsectionsViaSymbols; }
543
544 /// Returns the maximum possible encoded instruction size in bytes. If \p STI
545 /// is null, this should be the maximum size for any subtarget.
546 virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
547 return MaxInstLength;
548 }
549
550 unsigned getMinInstAlignment() const { return MinInstAlignment; }
551 bool getDollarIsPC() const { return DollarIsPC; }
552 const char *getSeparatorString() const { return SeparatorString; }
553
554 unsigned getCommentColumn() const { return CommentColumn; }
555 void setCommentColumn(unsigned Col) { CommentColumn = Col; }
556
559 const char *getLabelSuffix() const { return LabelSuffix; }
560
563 bool needsLocalForSize() const { return NeedsLocalForSize; }
565
567 return !LinkerPrivateGlobalPrefix.empty();
568 }
569
575
576 const char *getInlineAsmStart() const { return InlineAsmStart; }
577 const char *getInlineAsmEnd() const { return InlineAsmEnd; }
578 unsigned getAssemblerDialect() const { return AssemblerDialect; }
579 // Return the assembler dialect that output printing should use. Used by
580 // createMCInstPrinter.
581 unsigned getOutputAssemblerDialect() const {
582 return TargetOptions.OutputAsmVariant.value_or(AssemblerDialect);
583 }
584 bool doesAllowAtInName() const { return AllowAtInName; }
585 void setAllowAtInName(bool V) { AllowAtInName = V; }
596
600
602
605
607
608 const char *getZeroDirective() const { return ZeroDirective; }
609 const char *getAsciiDirective() const { return AsciiDirective; }
610 const char *getAscizDirective() const { return AscizDirective; }
615 unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
616 const char *getGlobalDirective() const { return GlobalDirective; }
617
621
625
629
634 bool hasIdentDirective() const { return HasIdentDirective; }
635 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
636 const char *getWeakDirective() const { return WeakDirective; }
637 const char *getWeakRefDirective() const { return WeakRefDirective; }
638
642
643 bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
644
646
648
652
656
658
660
664
665 /// Returns true if the exception handling method \p EH uses call frame
666 /// information to unwind.
672
673 /// Returns true if the object format describes unwind information with
674 /// Windows SEH unwind opcodes (.seh_* directives, .pdata and .xdata).
675 /// Whether a function uses that encoding also depends on the exception
676 /// model; see MachineFunction::usesWindowsUnwindInfo().
681
682 /// Returns true if the exception tables reference the per-invoke EH labels
683 /// emitted around invokes. 32-bit x86 SEH and Wasm do not.
685 switch (EH) {
687 // 32-bit x86 SEH uses a state table, not per-invoke IP-to-state ranges.
691 return false;
692 default:
693 return true;
694 }
695 }
696
700
703 bool useAtForSpecifier() const { return UseAtForSpecifier; }
708
712
713 void addInitialFrameState(const MCCFIInstruction &Inst);
714
715 const std::vector<MCCFIInstruction> &getInitialFrameState() const {
716 return InitialFrameState;
717 }
718
719 void setBinutilsVersion(std::pair<int, int> Value) {
721 }
722
723 /// Return true if assembly (inline or otherwise) should be parsed.
725
726 /// Return true if target want to use AsmParser to parse inlineasm.
730
731 bool binutilsIsAtLeast(int Major, int Minor) const {
732 return BinutilsVersion >= std::make_pair(Major, Minor);
733 }
734
735 /// Set whether assembly (inline or otherwise) should be parsed.
739
740 /// Set whether target want to use AsmParser to parse inlineasm.
744
745 /// Return true if assembly (inline or otherwise) should be parsed.
747
748 /// Set whether assembly (inline or otherwise) should be parsed.
750
751 bool shouldUseLogicalShr() const { return UseLogicalShr; }
752
754
755 StringRef getSpecifierName(uint32_t S) const;
756 std::optional<uint32_t> getSpecifierForName(StringRef Name) const;
757
758 void printExpr(raw_ostream &, const MCExpr &) const;
760 const MCSpecifierExpr &) const {
761 llvm_unreachable("Need to implement hook if target uses MCSpecifierExpr");
762 }
763 virtual bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &Res,
764 const MCAssembler *Asm) const;
765
766 /// True if the instruction is stored in multiple halfwords, with
767 /// the high-order half appearing first in memory regardless of target
768 /// endianness, to distinguish it from instructions occupying only one
769 /// halfword. Examples are the Thumb variant of Arm, microMIPS, and nanoMIPS.
770 virtual bool usesCompInstByteOrder(const MCSubtargetInfo &STI) const {
771 return false;
772 }
773};
774
775} // end namespace llvm
776
777#endif // LLVM_MC_MCASMINFO_H
This file defines the StringMap class.
static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, raw_ostream &OS)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file defines CachedHashString and CachedHashStringRef.
#define LLVM_ABI
Definition Compiler.h:211
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
static LVOptions Options
Definition LVOptions.cpp:25
std::unique_ptr< MCStreamer > && Streamer
Implements a dense probed hash-table based set.
Definition DenseSet.h:281
StringRef InternalSymbolPrefix
For internal use by compiler and assembler, not meant to be visible externally.
Definition MCAsmInfo.h:159
MCAsmInfo(MCAsmInfo const &)=delete
const char * Data16bitsDirective
Definition MCAsmInfo.h:246
bool hasCOFFAssociativeComdats() const
Definition MCAsmInfo.h:541
bool NeedsDwarfSectionOffsetDirective
Definition MCAsmInfo.h:263
const char * getLabelSuffix() const
Definition MCAsmInfo.h:559
void setAllowAtInName(bool V)
Definition MCAsmInfo.h:585
MCSymbolAttr ExportedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having exported visibility.
Definition MCAsmInfo.h:343
bool preserveAsmComments() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:746
bool supportsSignedData() const
Definition MCAsmInfo.h:477
const char * getInlineAsmStart() const
Definition MCAsmInfo.h:576
bool isHLASM() const
Definition MCAsmInfo.h:539
bool hasDotTypeDotSizeDirective() const
Definition MCAsmInfo.h:632
bool isLittleEndian() const
True if the target is little endian.
Definition MCAsmInfo.h:464
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition MCAsmInfo.h:122
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition MCAsmInfo.h:319
bool AllowAdditionalComments
This indicates whether to allow additional "comment strings" to be lexed as a comment.
Definition MCAsmInfo.h:142
bool useAtForSpecifier() const
Definition MCAsmInfo.h:703
unsigned TextAlignFillValue
If non-zero, this is used to fill the executable space created as the result of a alignment directive...
Definition MCAsmInfo.h:275
bool AllowQuestionAtStartOfIdentifier
This is true if the assembler allows the "?" character at the start of of a string to be lexed as an ...
Definition MCAsmInfo.h:184
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:724
bool UseAtForSpecifier
True if target uses @ (expr@specifier) for relocation specifiers.
Definition MCAsmInfo.h:387
MCSymbolAttr ProtectedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having protected visibility.
Definition MCAsmInfo.h:351
virtual void printSpecifierExpr(raw_ostream &, const MCSpecifierExpr &) const
Definition MCAsmInfo.h:759
bool HasFunctionAlignment
Definition MCAsmInfo.h:300
const char * AsciiDirective
This directive allows emission of an ascii string with the standard C escape characters embedded into...
Definition MCAsmInfo.h:229
std::vector< MCCFIInstruction > InitialFrameState
Definition MCAsmInfo.h:399
MCAsmInfo & operator=(MCAsmInfo const &)=delete
MCSymbolAttr getProtectedVisibilityAttr() const
Definition MCAsmInfo.h:653
bool usesSunStyleELFSectionSwitchSyntax() const
Definition MCAsmInfo.h:524
bool doesAllowDollarAtStartOfIdentifier() const
Definition MCAsmInfo.h:592
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
Definition MCAsmInfo.h:546
unsigned getMinInstAlignment() const
Definition MCAsmInfo.h:550
bool hasLEB128Directives() const
Definition MCAsmInfo.h:601
bool doesSupportDataRegionDirectives() const
Definition MCAsmInfo.h:597
MCSymbolAttr getExportedVisibilityAttr() const
Definition MCAsmInfo.h:647
bool usesSetToEquateSymbol() const
Definition MCAsmInfo.h:561
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition MCAsmInfo.h:100
const char * getData32bitsDirective() const
Definition MCAsmInfo.h:475
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition MCAsmInfo.h:245
const char * Data64bitsDirective
Definition MCAsmInfo.h:248
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition MCAsmInfo.h:715
bool useFullRegisterNames() const
Definition MCAsmInfo.h:603
unsigned getAssemblerDialect() const
Definition MCAsmInfo.h:578
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:736
bool DollarIsPC
The '$' token, when not referencing an identifier or constant, refers to the current PC.
Definition MCAsmInfo.h:126
llvm::DenseSet< llvm::CachedHashStringRef > & getReservedIdentifiers()
Definition MCAsmInfo.h:500
virtual ~MCAsmInfo()
const char * getInlineAsmEnd() const
Definition MCAsmInfo.h:577
unsigned getTextAlignFillValue() const
Definition MCAsmInfo.h:615
StringRef getLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:570
bool doesAllowAtInName() const
Definition MCAsmInfo.h:584
bool useDwarfRegNumForCFI() const
Definition MCAsmInfo.h:702
bool useAssignmentForEHBegin() const
Definition MCAsmInfo.h:562
bool supportsExtendedDwarfLocDirective() const
Definition MCAsmInfo.h:705
bool AvoidWeakIfComdat
True if we should mark symbols as global instead of weak, for weak*‍/linkonce*, if the symbol has a c...
Definition MCAsmInfo.h:335
bool NeedsLocalForSize
Definition MCAsmInfo.h:154
const MCTargetOptions & TargetOptions
Definition MCAsmInfo.h:442
bool AllowDollarAtStartOfIdentifier
This is true if the assembler allows the "$" character at the start of of a string to be lexed as an ...
Definition MCAsmInfo.h:191
bool PreserveAsmComments
Preserve Comments in assembly.
Definition MCAsmInfo.h:420
const char * LabelSuffix
This is appended to emitted labels. Defaults to ":".
Definition MCAsmInfo.h:145
bool DwarfFDESymbolsUseAbsDiff
True if DWARF FDE symbol reference relocations should be replaced by an absolute difference.
Definition MCAsmInfo.h:373
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:473
MCAsmInfo(const MCTargetOptions &Options)
Definition MCAsmInfo.cpp:27
const char * getData64bitsDirective() const
Definition MCAsmInfo.h:476
AsmCharLiteralSyntax characterLiteralSyntax() const
Definition MCAsmInfo.h:611
bool avoidWeakIfComdat() const
Definition MCAsmInfo.h:643
bool isAIX() const
Definition MCAsmInfo.h:538
bool SetDirectiveSuppressesReloc
True if the expression .long f - g uses a relocation but it can be suppressed by writing a = f - g ....
Definition MCAsmInfo.h:288
const char * Data32bitsDirective
Definition MCAsmInfo.h:247
bool UseIntegratedAssembler
Should we use the integrated assembler?
Definition MCAsmInfo.h:414
bool shouldUseMotorolaIntegers() const
Definition MCAsmInfo.h:753
bool supportsNameQuoting() const
Definition MCAsmInfo.h:595
bool AllowAtAtStartOfIdentifier
This is true if the assembler allows the "@" character at the start of a string to be lexed as an Asm...
Definition MCAsmInfo.h:198
bool UsesSetToEquateSymbol
Use .set instead of = to equate a symbol to an expression.
Definition MCAsmInfo.h:148
bool UseLogicalShr
True if the integrated assembler should interpret 'a >> b' constant expressions as logical rather tha...
Definition MCAsmInfo.h:427
bool UseMotorolaIntegers
Definition MCAsmInfo.h:430
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
Definition MCAsmInfo.h:649
const char * GlobalDirective
This is the directive used to declare a global entity.
Definition MCAsmInfo.h:281
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition MCAsmInfo.h:296
bool hasWeakDefCanBeHiddenDirective() const
Definition MCAsmInfo.h:639
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition MCAsmInfo.h:365
bool HasCOFFComdatConstants
True if this is a non-GNU COFF target.
Definition MCAsmInfo.h:109
bool hasLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:566
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol.
Definition MCAsmInfo.h:326
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
Definition MCAsmInfo.h:626
bool needsDwarfSectionOffsetDirective() const
Definition MCAsmInfo.h:532
bool shouldUseLogicalShr() const
Definition MCAsmInfo.h:751
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition MCAsmInfo.h:307
bool AllowAtInName
This is true if the assembler allows @ characters in symbol names.
Definition MCAsmInfo.h:177
unsigned CommentColumn
The column (zero-based) at which asm comments should be printed.
Definition MCAsmInfo.h:423
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection, const Triple &, raw_ostream &) const
Definition MCAsmInfo.h:508
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition MCAsmInfo.h:118
bool usesCFIWithoutEH(ExceptionHandling EH) const
Definition MCAsmInfo.h:661
bool HasWeakDefCanBeHiddenDirective
True if we have a directive to declare a global as being a weak defined symbol that can be hidden (un...
Definition MCAsmInfo.h:330
StringRef getCommentString() const
Definition MCAsmInfo.h:557
bool UseParensForSpecifier
(ARM-specific) Uses parens for relocation specifier in data directives, e.g.
Definition MCAsmInfo.h:391
const MCTargetOptions & getTargetOptions() const
Definition MCAsmInfo.h:452
const char * getAscizDirective() const
Definition MCAsmInfo.h:610
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition MCAsmInfo.h:256
uint16_t DwarfFDERelSymbolSpec
The optional specifier to use for the relative FDE symbol references.
Definition MCAsmInfo.h:376
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition MCAsmInfo.h:169
bool HasPreferredAlignment
Definition MCAsmInfo.h:303
bool UseAssignmentForEHBegin
Definition MCAsmInfo.h:151
bool HasCOFFAssociativeComdats
True if this is a non-GNU COFF target.
Definition MCAsmInfo.h:105
bool doesSupportDebugInformation() const
Definition MCAsmInfo.h:657
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:618
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
Definition MCAsmInfo.h:417
llvm::DenseSet< llvm::CachedHashStringRef > ReservedIdentifiers
Definition MCAsmInfo.h:440
WinEH::EncodingType getWinEHEncodingType() const
Definition MCAsmInfo.h:659
bool doesDwarfUseRelocationsAcrossSections() const
Definition MCAsmInfo.h:697
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:261
bool usesPerInvokeEHLabels(ExceptionHandling EH) const
Returns true if the exception tables reference the per-invoke EH labels emitted around invokes.
Definition MCAsmInfo.h:684
const char * getZeroDirective() const
Definition MCAsmInfo.h:608
bool EnableDwarfFileDirectoryDefault
True if DWARF ‘.file directory’ directive syntax is used by default.
Definition MCAsmInfo.h:380
StringRef LinkerPrivateGlobalPrefix
This prefix is used for symbols that should be passed through the assembler but be removed by the lin...
Definition MCAsmInfo.h:165
StringRef getInternalSymbolPrefix() const
Definition MCAsmInfo.h:564
llvm::DenseMap< AtSpecifierKind, StringRef > AtSpecifierToName
Definition MCAsmInfo.h:434
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:357
void setFullRegisterNames(bool V)
Definition MCAsmInfo.h:604
void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:741
const char * getWeakDirective() const
Definition MCAsmInfo.h:636
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:96
bool hasSubsectionsViaSymbols() const
Definition MCAsmInfo.h:469
bool PPCUseFullRegisterNames
True if full register names are printed.
Definition MCAsmInfo.h:213
const char * InlineAsmEnd
Definition MCAsmInfo.h:170
const char * getData16bitsDirective() const
Definition MCAsmInfo.h:474
const char * getSeparatorString() const
Definition MCAsmInfo.h:552
bool usesCFIForEH(ExceptionHandling EH) const
Returns true if the exception handling method EH uses call frame information to unwind.
Definition MCAsmInfo.h:667
bool SupportsSignedData
True if data directives support signed values.
Definition MCAsmInfo.h:251
bool doesAllowAtAtStartOfIdentifier() const
Definition MCAsmInfo.h:589
bool getCOMMDirectiveAlignmentIsInBytes() const
Definition MCAsmInfo.h:622
bool isStackGrowthDirectionUp() const
True if target stack grow up.
Definition MCAsmInfo.h:467
virtual bool useCodeAlign(const MCSection &Sec) const
Definition MCAsmInfo.h:522
bool useParensForSpecifier() const
Definition MCAsmInfo.h:704
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition MCAsmInfo.h:173
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
Definition MCAsmInfo.h:130
bool hasPreferredAlignment() const
Definition MCAsmInfo.h:631
virtual MCSection * getStackSection(MCContext &Ctx, bool Exec) const
Targets can implement this method to specify a section to switch to depending on whether the translat...
Definition MCAsmInfo.h:482
MCSymbolAttr HiddenDeclarationVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare an undefined symbol as having hidden visibili...
Definition MCAsmInfo.h:347
void setPreserveAsmComments(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:749
bool shouldAllowAdditionalComments() const
Definition MCAsmInfo.h:558
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
Definition MCAsmInfo.h:459
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when t...
Definition MCAsmInfo.h:362
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition MCAsmInfo.h:315
bool isMachO() const
Definition MCAsmInfo.h:540
llvm::StringMap< AtSpecifierKind > NameToAtSpecifier
Definition MCAsmInfo.h:435
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections.
Definition MCAsmInfo.h:369
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:727
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition MCAsmInfo.h:311
void setBinutilsVersion(std::pair< int, int > Value)
Definition MCAsmInfo.h:719
bool doDwarfFDESymbolsUseAbsDiff() const
Definition MCAsmInfo.h:701
const char * getGlobalDirective() const
Definition MCAsmInfo.h:616
bool doesAllowQuestionAtStartOfIdentifier() const
Definition MCAsmInfo.h:586
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition MCAsmInfo.h:292
bool getAlignmentIsInBytes() const
Definition MCAsmInfo.h:614
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:271
bool usesWindowsCFI() const
Returns true if the object format describes unwind information with Windows SEH unwind opcodes (....
Definition MCAsmInfo.h:677
bool usesELFSectionDirectiveForBSS() const
Definition MCAsmInfo.h:528
AsmCharLiteralSyntax CharacterLiteralSyntax
Form used for character literals in the assembly syntax.
Definition MCAsmInfo.h:239
bool getDollarIsPC() const
Definition MCAsmInfo.h:551
bool SupportsExtendedDwarfLocDirective
True if the target supports flags in ".loc" directive, false if only location is allowed.
Definition MCAsmInfo.h:395
bool binutilsIsAtLeast(int Major, int Minor) const
Definition MCAsmInfo.h:731
const char * ZeroDirective
This should be set to the directive used to get some number of zero (and non-zero if supported by the...
Definition MCAsmInfo.h:224
unsigned getCommentColumn() const
Definition MCAsmInfo.h:554
MCSymbolAttr getHiddenVisibilityAttr() const
Definition MCAsmInfo.h:645
void initializeAtSpecifiers(EnumStrings< AtSpecifierKind, 1 >)
bool SupportsQuotedNames
If this is true, symbol names with invalid characters will be printed in quotes.
Definition MCAsmInfo.h:202
bool hasSingleParameterDotFile() const
Definition MCAsmInfo.h:633
const char * AscizDirective
If not null, this allows for special handling of zero terminated strings on this target.
Definition MCAsmInfo.h:234
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives.
Definition MCAsmInfo.h:207
unsigned getOutputAssemblerDialect() const
Definition MCAsmInfo.h:581
bool hasAddrsigDirective() const
Definition MCAsmInfo.h:606
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition MCAsmInfo.h:384
bool HasAddrsigDirective
True if the target supports the .addrsig directive.
Definition MCAsmInfo.h:216
const char * getAsciiDirective() const
Definition MCAsmInfo.h:609
bool IsLittleEndian
True if target is little endian. Default is true.
Definition MCAsmInfo.h:93
AsmCharLiteralSyntax
Assembly character literal syntax types.
Definition MCAsmInfo.h:70
@ ACLS_SingleQuotePrefix
Unknown; character literals not used by LLVM for this target.
Definition MCAsmInfo.h:73
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition MCAsmInfo.h:86
std::pair< int, int > BinutilsVersion
Definition MCAsmInfo.h:407
bool HasLEB128Directives
True if the target supports LEB128 directives.
Definition MCAsmInfo.h:210
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition MCAsmInfo.h:90
const char * getWeakRefDirective() const
Definition MCAsmInfo.h:637
bool hasCOFFComdatConstants() const
Definition MCAsmInfo.h:542
MCSymbolAttr HiddenVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having hidden visibility.
Definition MCAsmInfo.h:339
virtual bool usesCompInstByteOrder(const MCSubtargetInfo &STI) const
True if the instruction is stored in multiple halfwords, with the high-order half appearing first in ...
Definition MCAsmInfo.h:770
bool hasNoDeadStrip() const
Definition MCAsmInfo.h:635
const llvm::DenseSet< llvm::CachedHashStringRef > & getReservedIdentifiers() const
Definition MCAsmInfo.h:504
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:134
bool needsLocalForSize() const
Definition MCAsmInfo.h:563
const char * WeakDirective
Used to declare a global as being a weak symbol. Defaults to ".weak".
Definition MCAsmInfo.h:322
uint16_t AtSpecifierKind
Type for at specifiers. Currently, 16 bits is enough.
Definition MCAsmInfo.h:78
void setCommentColumn(unsigned Col)
Definition MCAsmInfo.h:555
bool hasFunctionAlignment() const
Definition MCAsmInfo.h:630
bool enableDwarfFileDirectoryDefault() const
Definition MCAsmInfo.h:709
bool hasIdentDirective() const
Definition MCAsmInfo.h:634
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition MCAsmInfo.h:455
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:580
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:494
Streaming machine code generation interface.
Definition MCStreamer.h:222
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:129
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ MIPS
Windows x86, uses no CFI, just EH tables.
Definition MCAsmInfo.h:54
@ Itanium
Windows CE ARM, PowerPC, SH3, SH4.
Definition MCAsmInfo.h:52
@ ARM
Windows AXP64.
Definition MCAsmInfo.h:50
@ CE
Windows NT (Windows on ARM)
Definition MCAsmInfo.h:51
@ Alpha64
Windows Alpha.
Definition MCAsmInfo.h:49
@ X86
Windows x64, Windows Itanium (IA-64)
Definition MCAsmInfo.h:53
This is an optimization pass for GlobalISel generic memory operations.
ExceptionHandling
Definition CodeGen.h:54
@ ZOS
z/OS MVS Exception Handling.
Definition CodeGen.h:64
@ None
No exception support.
Definition CodeGen.h:56
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:57
@ WinEH
Windows Exception Handling.
Definition CodeGen.h:60
@ Wasm
WebAssembly Exception Handling.
Definition CodeGen.h:61
@ MCSA_Protected
.protected (ELF)
@ MCSA_Exported
.globl _foo, exported (XCOFF)
@ MCSA_Hidden
.hidden (ELF)