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