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 //===--- Data Emission Directives -------------------------------------===//
216
217 /// This should be set to the directive used to get some number of zero (and
218 /// non-zero if supported by the directive) bytes emitted to the current
219 /// section. Common cases are "\t.zero\t" and "\t.space\t". Defaults to
220 /// "\t.zero\t"
221 const char *ZeroDirective = "\t.zero\t";
222
223 /// This directive allows emission of an ascii string with the standard C
224 /// escape characters embedded into it. If a target doesn't support this, it
225 /// can be set to null. Defaults to "\t.ascii\t"
226 const char *AsciiDirective = "\t.ascii\t";
227
228 /// If not null, this allows for special handling of zero terminated strings
229 /// on this target. This is commonly supported as ".asciz". If a target
230 /// doesn't support this, it can be set to null. Defaults to "\t.asciz\t"
231 const char *AscizDirective = "\t.asciz\t";
232
233 /// Form used for character literals in the assembly syntax. Useful for
234 /// producing strings as byte lists. If a target does not use or support
235 /// this, it shall be set to ACLS_Unknown. Defaults to ACLS_Unknown.
237
238 /// These directives are used to output some unit of integer data to the
239 /// current section. If a data directive is set to null, smaller data
240 /// directives will be used to emit the large sizes. Defaults to "\t.byte\t",
241 /// "\t.short\t", "\t.long\t", "\t.quad\t"
242 const char *Data8bitsDirective = "\t.byte\t";
243 const char *Data16bitsDirective = "\t.short\t";
244 const char *Data32bitsDirective = "\t.long\t";
245 const char *Data64bitsDirective = "\t.quad\t";
246
247 /// True if data directives support signed values
249
250 /// This is true if this target uses "Sun Style" syntax for section switching
251 /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
252 /// .section directives. Defaults to false.
254
255 /// This is true if this target uses ELF '.section' directive before the
256 /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
257 /// directive only. Defaults to false.
259
261
262 //===--- Alignment Information ----------------------------------------===//
263
264 /// If this is true (the default) then the asmprinter emits ".align N"
265 /// directives, where N is the number of bytes to align to. Otherwise, it
266 /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary. Defaults
267 /// to true.
269
270 /// If non-zero, this is used to fill the executable space created as the
271 /// result of a alignment directive. Defaults to 0
272 unsigned TextAlignFillValue = 0;
273
274 //===--- Global Variable Emission Directives --------------------------===//
275
276 /// This is the directive used to declare a global entity. Defaults to
277 /// ".globl".
278 const char *GlobalDirective = "\t.globl\t";
279
280 /// True if the expression
281 /// .long f - g
282 /// uses a relocation but it can be suppressed by writing
283 /// a = f - g
284 /// .long a
286
287 /// True is .comm's and .lcomms optional alignment is to be specified in bytes
288 /// instead of log2(n). Defaults to true.
290
291 /// Describes if the .lcomm directive for the target supports an alignment
292 /// argument and how it is interpreted. Defaults to NoAlignment.
294
295 // True if the target allows .align directives on functions. This is true for
296 // most targets, so defaults to true.
298
299 // True if the target respects .prefalign directives.
301
302 /// True if the target has .type and .size directives, this is true for most
303 /// ELF targets. Defaults to true.
305
306 /// True if the target has a single parameter .file directive, this is true
307 /// for ELF targets. Defaults to true.
309
310 /// True if the target has a .ident directive, this is true for ELF targets.
311 /// Defaults to false.
312 bool HasIdentDirective = false;
313
314 /// True if this target supports the MachO .no_dead_strip directive. Defaults
315 /// to false.
316 bool HasNoDeadStrip = false;
317
318 /// Used to declare a global as being a weak symbol. Defaults to ".weak".
319 const char *WeakDirective = "\t.weak\t";
320
321 /// This directive, if non-null, is used to declare a global as being a weak
322 /// undefined symbol. Defaults to nullptr.
323 const char *WeakRefDirective = nullptr;
324
325 /// True if we have a directive to declare a global as being a weak defined
326 /// symbol that can be hidden (unexported). Defaults to false.
328
329 /// True if we should mark symbols as global instead of weak, for
330 /// weak*/linkonce*, if the symbol has a comdat.
331 /// Defaults to false.
332 bool AvoidWeakIfComdat = false;
333
334 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
335 /// hidden visibility. Defaults to MCSA_Hidden.
337
338 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
339 /// exported visibility. Defaults to MCSA_Exported.
341
342 /// This attribute, if not MCSA_Invalid, is used to declare an undefined
343 /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
345
346 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
347 /// protected visibility. Defaults to MCSA_Protected
349
350 //===--- Dwarf Emission Directives -----------------------------------===//
351
352 /// True if target supports emission of debugging information. Defaults to
353 /// false.
355
356 /// True if target uses CFI unwind information for other purposes than EH
357 /// (debugging / sanitizers) when the exception model is
358 /// `ExceptionHandling::None`.
359 bool UsesCFIWithoutEH = false;
360
361 /// Windows exception handling data (.pdata) encoding. Defaults to Invalid.
363
364 /// True if Dwarf2 output generally uses relocations for references to other
365 /// .debug_* sections.
367
368 /// True if DWARF FDE symbol reference relocations should be replaced by an
369 /// absolute difference.
371
372 /// The optional specifier to use for the relative FDE symbol references.
374
375 /// True if DWARF `.file directory' directive syntax is used by
376 /// default.
378
379 /// True if dwarf register numbers are printed instead of symbolic register
380 /// names in .cfi_* directives. Defaults to false.
381 bool DwarfRegNumForCFI = false;
382
383 /// True if target uses @ (expr@specifier) for relocation specifiers.
384 bool UseAtForSpecifier = false;
385
386 /// (ARM-specific) Uses parens for relocation specifier in data
387 /// directives, e.g. .word foo(got).
389
390 /// True if the target supports flags in ".loc" directive, false if only
391 /// location is allowed.
393
394 //===--- Prologue State ----------------------------------------------===//
395
396 std::vector<MCCFIInstruction> InitialFrameState;
397
398 //===--- Integrated Assembler Information ----------------------------===//
399
400 // Generated object files can use all ELF features supported by GNU ld of
401 // this binutils version and later. INT_MAX means all features can be used,
402 // regardless of GNU ld support. The default value is referenced by
403 // clang/Options/Options.td.
404 std::pair<int, int> BinutilsVersion = {2, 26};
405
406 /// Should we use the integrated assembler?
407 /// The integrated assembler should be enabled by default (by the
408 /// constructors) when failing to parse a valid piece of assembly (inline
409 /// or otherwise) is considered a bug. It may then be overridden after
410 /// construction (see CodeGenTargetMachineImpl::initAsmInfo()).
412
413 /// Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
415
416 /// Preserve Comments in assembly
418
419 /// The column (zero-based) at which asm comments should be printed.
420 unsigned CommentColumn = 40;
421
422 /// True if the integrated assembler should interpret 'a >> b' constant
423 /// expressions as logical rather than arithmetic.
424 bool UseLogicalShr = true;
425
426 // If true, use Motorola-style integers in Assembly (ex. $0ac).
428
429 // This describes a @ style relocation specifier (expr@specifier) supported by
430 // AsmParser::parsePrimaryExpr.
434
435 // Lowercase identifiers (e.g. register names, dialect keywords) that must be
436 // quoted when used as a symbol name.
438
440
441public:
442 explicit MCAsmInfo(const MCTargetOptions &Options);
443 virtual ~MCAsmInfo();
444
445 // Explicitly non-copyable.
446 MCAsmInfo(MCAsmInfo const &) = delete;
447 MCAsmInfo &operator=(MCAsmInfo const &) = delete;
448
450
451 /// Get the code pointer size in bytes.
452 unsigned getCodePointerSize() const { return CodePointerSize; }
453
454 /// Get the callee-saved register stack slot
455 /// size in bytes.
456 unsigned getCalleeSaveStackSlotSize() const {
458 }
459
460 /// True if the target is little endian.
461 bool isLittleEndian() const { return IsLittleEndian; }
462
463 /// True if target stack grow up.
464 bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
465
467
468 // Data directive accessors.
469
470 const char *getData8bitsDirective() const { return Data8bitsDirective; }
471 const char *getData16bitsDirective() const { return Data16bitsDirective; }
472 const char *getData32bitsDirective() const { return Data32bitsDirective; }
473 const char *getData64bitsDirective() const { return Data64bitsDirective; }
474 bool supportsSignedData() const { return SupportsSignedData; }
475
476 /// Targets can implement this method to specify a section to switch to
477 /// depending on whether the translation unit has any trampolines that require
478 /// an executable stack.
479 virtual MCSection *getStackSection(MCContext &Ctx, bool Exec) const {
480 return nullptr;
481 }
482
483 virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
484 unsigned Encoding,
485 MCStreamer &Streamer) const;
486
487 const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding,
488 MCStreamer &Streamer) const;
489
490 /// Return true if C is an acceptable character inside a symbol name.
491 bool isAcceptableChar(char C) const;
492
493 /// Return true if the identifier \p Name does not need quotes to be
494 /// syntactically correct.
495 bool isValidUnquotedName(StringRef Name) const;
496
502 return ReservedIdentifiers;
503 }
504
505 virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
506 const Triple &, raw_ostream &) const {}
507
508 /// Return true if the .section directive should be omitted when
509 /// emitting \p SectionName. For example:
510 ///
511 /// shouldOmitSectionDirective(".text")
512 ///
513 /// returns false => .section .text,#alloc,#execinstr
514 /// returns true => .text
515 virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
516
517 // Return true if a .align directive should use "optimized nops" to fill
518 // instead of 0s.
519 virtual bool useCodeAlign(const MCSection &Sec) const { return false; }
520
524
528
532
533 // Accessors.
534
535 bool isAIX() const { return IsAIX; }
536 bool isHLASM() const { return IsHLASM; }
537 bool isMachO() const { return HasSubsectionsViaSymbols; }
540
541 /// Returns the maximum possible encoded instruction size in bytes. If \p STI
542 /// is null, this should be the maximum size for any subtarget.
543 virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
544 return MaxInstLength;
545 }
546
547 unsigned getMinInstAlignment() const { return MinInstAlignment; }
548 bool getDollarIsPC() const { return DollarIsPC; }
549 const char *getSeparatorString() const { return SeparatorString; }
550
551 unsigned getCommentColumn() const { return CommentColumn; }
552 void setCommentColumn(unsigned Col) { CommentColumn = Col; }
553
556 const char *getLabelSuffix() const { return LabelSuffix; }
557
560 bool needsLocalForSize() const { return NeedsLocalForSize; }
562
564 return !LinkerPrivateGlobalPrefix.empty();
565 }
566
572
573 const char *getInlineAsmStart() const { return InlineAsmStart; }
574 const char *getInlineAsmEnd() const { return InlineAsmEnd; }
575 unsigned getAssemblerDialect() const { return AssemblerDialect; }
576 // Return the assembler dialect that output printing should use. Used by
577 // createMCInstPrinter.
578 unsigned getOutputAssemblerDialect() const {
579 return TargetOptions.OutputAsmVariant.value_or(AssemblerDialect);
580 }
581 bool doesAllowAtInName() const { return AllowAtInName; }
582 void setAllowAtInName(bool V) { AllowAtInName = V; }
593
597
599
602
603 const char *getZeroDirective() const { return ZeroDirective; }
604 const char *getAsciiDirective() const { return AsciiDirective; }
605 const char *getAscizDirective() const { return AscizDirective; }
610 unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
611 const char *getGlobalDirective() const { return GlobalDirective; }
612
616
620
624
629 bool hasIdentDirective() const { return HasIdentDirective; }
630 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
631 const char *getWeakDirective() const { return WeakDirective; }
632 const char *getWeakRefDirective() const { return WeakRefDirective; }
633
637
638 bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
639
641
643
647
651
653
655
659
660 /// Returns true if the exception handling method \p EH uses call frame
661 /// information to unwind.
667
668 /// Returns true if the object format describes unwind information with
669 /// Windows SEH unwind opcodes (.seh_* directives, .pdata and .xdata).
670 /// Whether a function uses that encoding also depends on the exception
671 /// model; see MachineFunction::usesWindowsUnwindInfo().
676
677 /// Returns true if the exception tables reference the per-invoke EH labels
678 /// emitted around invokes. 32-bit x86 SEH and Wasm do not.
680 switch (EH) {
682 // 32-bit x86 SEH uses a state table, not per-invoke IP-to-state ranges.
686 return false;
687 default:
688 return true;
689 }
690 }
691
695
698 bool useAtForSpecifier() const { return UseAtForSpecifier; }
703
707
708 void addInitialFrameState(const MCCFIInstruction &Inst);
709
710 const std::vector<MCCFIInstruction> &getInitialFrameState() const {
711 return InitialFrameState;
712 }
713
714 void setBinutilsVersion(std::pair<int, int> Value) {
716 }
717
718 /// Return true if assembly (inline or otherwise) should be parsed.
720
721 /// Return true if target want to use AsmParser to parse inlineasm.
725
726 bool binutilsIsAtLeast(int Major, int Minor) const {
727 return BinutilsVersion >= std::make_pair(Major, Minor);
728 }
729
730 /// Set whether assembly (inline or otherwise) should be parsed.
734
735 /// Set whether target want to use AsmParser to parse inlineasm.
739
740 /// Return true if assembly (inline or otherwise) should be parsed.
742
743 /// Set whether assembly (inline or otherwise) should be parsed.
745
746 bool shouldUseLogicalShr() const { return UseLogicalShr; }
747
749
750 StringRef getSpecifierName(uint32_t S) const;
751 std::optional<uint32_t> getSpecifierForName(StringRef Name) const;
752
753 void printExpr(raw_ostream &, const MCExpr &) const;
755 const MCSpecifierExpr &) const {
756 llvm_unreachable("Need to implement hook if target uses MCSpecifierExpr");
757 }
758 virtual bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &Res,
759 const MCAssembler *Asm) const;
760};
761
762} // end namespace llvm
763
764#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:243
bool hasCOFFAssociativeComdats() const
Definition MCAsmInfo.h:538
bool NeedsDwarfSectionOffsetDirective
Definition MCAsmInfo.h:260
const char * getLabelSuffix() const
Definition MCAsmInfo.h:556
void setAllowAtInName(bool V)
Definition MCAsmInfo.h:582
MCSymbolAttr ExportedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having exported visibility.
Definition MCAsmInfo.h:340
bool preserveAsmComments() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:741
bool supportsSignedData() const
Definition MCAsmInfo.h:474
const char * getInlineAsmStart() const
Definition MCAsmInfo.h:573
bool isHLASM() const
Definition MCAsmInfo.h:536
bool hasDotTypeDotSizeDirective() const
Definition MCAsmInfo.h:627
bool isLittleEndian() const
True if the target is little endian.
Definition MCAsmInfo.h:461
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:316
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:698
unsigned TextAlignFillValue
If non-zero, this is used to fill the executable space created as the result of a alignment directive...
Definition MCAsmInfo.h:272
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:719
bool UseAtForSpecifier
True if target uses @ (expr@specifier) for relocation specifiers.
Definition MCAsmInfo.h:384
MCSymbolAttr ProtectedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having protected visibility.
Definition MCAsmInfo.h:348
virtual void printSpecifierExpr(raw_ostream &, const MCSpecifierExpr &) const
Definition MCAsmInfo.h:754
bool HasFunctionAlignment
Definition MCAsmInfo.h:297
const char * AsciiDirective
This directive allows emission of an ascii string with the standard C escape characters embedded into...
Definition MCAsmInfo.h:226
std::vector< MCCFIInstruction > InitialFrameState
Definition MCAsmInfo.h:396
MCAsmInfo & operator=(MCAsmInfo const &)=delete
MCSymbolAttr getProtectedVisibilityAttr() const
Definition MCAsmInfo.h:648
bool usesSunStyleELFSectionSwitchSyntax() const
Definition MCAsmInfo.h:521
bool doesAllowDollarAtStartOfIdentifier() const
Definition MCAsmInfo.h:589
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
Definition MCAsmInfo.h:543
unsigned getMinInstAlignment() const
Definition MCAsmInfo.h:547
bool hasLEB128Directives() const
Definition MCAsmInfo.h:598
bool doesSupportDataRegionDirectives() const
Definition MCAsmInfo.h:594
MCSymbolAttr getExportedVisibilityAttr() const
Definition MCAsmInfo.h:642
bool usesSetToEquateSymbol() const
Definition MCAsmInfo.h:558
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition MCAsmInfo.h:100
const char * getData32bitsDirective() const
Definition MCAsmInfo.h:472
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition MCAsmInfo.h:242
const char * Data64bitsDirective
Definition MCAsmInfo.h:245
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition MCAsmInfo.h:710
bool useFullRegisterNames() const
Definition MCAsmInfo.h:600
unsigned getAssemblerDialect() const
Definition MCAsmInfo.h:575
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:731
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:497
virtual ~MCAsmInfo()
const char * getInlineAsmEnd() const
Definition MCAsmInfo.h:574
unsigned getTextAlignFillValue() const
Definition MCAsmInfo.h:610
StringRef getLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:567
bool doesAllowAtInName() const
Definition MCAsmInfo.h:581
bool useDwarfRegNumForCFI() const
Definition MCAsmInfo.h:697
bool useAssignmentForEHBegin() const
Definition MCAsmInfo.h:559
bool supportsExtendedDwarfLocDirective() const
Definition MCAsmInfo.h:700
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:332
bool NeedsLocalForSize
Definition MCAsmInfo.h:154
const MCTargetOptions & TargetOptions
Definition MCAsmInfo.h:439
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:417
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:370
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:470
MCAsmInfo(const MCTargetOptions &Options)
Definition MCAsmInfo.cpp:27
const char * getData64bitsDirective() const
Definition MCAsmInfo.h:473
AsmCharLiteralSyntax characterLiteralSyntax() const
Definition MCAsmInfo.h:606
bool avoidWeakIfComdat() const
Definition MCAsmInfo.h:638
bool isAIX() const
Definition MCAsmInfo.h:535
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:285
const char * Data32bitsDirective
Definition MCAsmInfo.h:244
bool UseIntegratedAssembler
Should we use the integrated assembler?
Definition MCAsmInfo.h:411
bool shouldUseMotorolaIntegers() const
Definition MCAsmInfo.h:748
bool supportsNameQuoting() const
Definition MCAsmInfo.h:592
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:424
bool UseMotorolaIntegers
Definition MCAsmInfo.h:427
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
Definition MCAsmInfo.h:644
const char * GlobalDirective
This is the directive used to declare a global entity.
Definition MCAsmInfo.h:278
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition MCAsmInfo.h:293
bool hasWeakDefCanBeHiddenDirective() const
Definition MCAsmInfo.h:634
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition MCAsmInfo.h:362
bool HasCOFFComdatConstants
True if this is a non-GNU COFF target.
Definition MCAsmInfo.h:109
bool hasLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:563
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol.
Definition MCAsmInfo.h:323
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
Definition MCAsmInfo.h:621
bool needsDwarfSectionOffsetDirective() const
Definition MCAsmInfo.h:529
bool shouldUseLogicalShr() const
Definition MCAsmInfo.h:746
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition MCAsmInfo.h:304
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:420
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection, const Triple &, raw_ostream &) const
Definition MCAsmInfo.h:505
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:656
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:327
StringRef getCommentString() const
Definition MCAsmInfo.h:554
bool UseParensForSpecifier
(ARM-specific) Uses parens for relocation specifier in data directives, e.g.
Definition MCAsmInfo.h:388
const MCTargetOptions & getTargetOptions() const
Definition MCAsmInfo.h:449
const char * getAscizDirective() const
Definition MCAsmInfo.h:605
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition MCAsmInfo.h:253
uint16_t DwarfFDERelSymbolSpec
The optional specifier to use for the relative FDE symbol references.
Definition MCAsmInfo.h:373
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:300
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:652
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:613
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
Definition MCAsmInfo.h:414
llvm::DenseSet< llvm::CachedHashStringRef > ReservedIdentifiers
Definition MCAsmInfo.h:437
WinEH::EncodingType getWinEHEncodingType() const
Definition MCAsmInfo.h:654
bool doesDwarfUseRelocationsAcrossSections() const
Definition MCAsmInfo.h:692
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:258
bool usesPerInvokeEHLabels(ExceptionHandling EH) const
Returns true if the exception tables reference the per-invoke EH labels emitted around invokes.
Definition MCAsmInfo.h:679
const char * getZeroDirective() const
Definition MCAsmInfo.h:603
bool EnableDwarfFileDirectoryDefault
True if DWARF ‘.file directory’ directive syntax is used by default.
Definition MCAsmInfo.h:377
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:561
llvm::DenseMap< AtSpecifierKind, StringRef > AtSpecifierToName
Definition MCAsmInfo.h:431
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:354
void setFullRegisterNames(bool V)
Definition MCAsmInfo.h:601
void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:736
const char * getWeakDirective() const
Definition MCAsmInfo.h:631
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:96
bool hasSubsectionsViaSymbols() const
Definition MCAsmInfo.h:466
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:471
const char * getSeparatorString() const
Definition MCAsmInfo.h:549
bool usesCFIForEH(ExceptionHandling EH) const
Returns true if the exception handling method EH uses call frame information to unwind.
Definition MCAsmInfo.h:662
bool SupportsSignedData
True if data directives support signed values.
Definition MCAsmInfo.h:248
bool doesAllowAtAtStartOfIdentifier() const
Definition MCAsmInfo.h:586
bool getCOMMDirectiveAlignmentIsInBytes() const
Definition MCAsmInfo.h:617
bool isStackGrowthDirectionUp() const
True if target stack grow up.
Definition MCAsmInfo.h:464
virtual bool useCodeAlign(const MCSection &Sec) const
Definition MCAsmInfo.h:519
bool useParensForSpecifier() const
Definition MCAsmInfo.h:699
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:626
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:479
MCSymbolAttr HiddenDeclarationVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare an undefined symbol as having hidden visibili...
Definition MCAsmInfo.h:344
void setPreserveAsmComments(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:744
bool shouldAllowAdditionalComments() const
Definition MCAsmInfo.h:555
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
Definition MCAsmInfo.h:456
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when t...
Definition MCAsmInfo.h:359
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition MCAsmInfo.h:312
bool isMachO() const
Definition MCAsmInfo.h:537
llvm::StringMap< AtSpecifierKind > NameToAtSpecifier
Definition MCAsmInfo.h:432
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections.
Definition MCAsmInfo.h:366
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:722
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition MCAsmInfo.h:308
void setBinutilsVersion(std::pair< int, int > Value)
Definition MCAsmInfo.h:714
bool doDwarfFDESymbolsUseAbsDiff() const
Definition MCAsmInfo.h:696
const char * getGlobalDirective() const
Definition MCAsmInfo.h:611
bool doesAllowQuestionAtStartOfIdentifier() const
Definition MCAsmInfo.h:583
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition MCAsmInfo.h:289
bool getAlignmentIsInBytes() const
Definition MCAsmInfo.h:609
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:268
bool usesWindowsCFI() const
Returns true if the object format describes unwind information with Windows SEH unwind opcodes (....
Definition MCAsmInfo.h:672
bool usesELFSectionDirectiveForBSS() const
Definition MCAsmInfo.h:525
AsmCharLiteralSyntax CharacterLiteralSyntax
Form used for character literals in the assembly syntax.
Definition MCAsmInfo.h:236
bool getDollarIsPC() const
Definition MCAsmInfo.h:548
bool SupportsExtendedDwarfLocDirective
True if the target supports flags in ".loc" directive, false if only location is allowed.
Definition MCAsmInfo.h:392
bool binutilsIsAtLeast(int Major, int Minor) const
Definition MCAsmInfo.h:726
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:221
unsigned getCommentColumn() const
Definition MCAsmInfo.h:551
MCSymbolAttr getHiddenVisibilityAttr() const
Definition MCAsmInfo.h:640
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:628
const char * AscizDirective
If not null, this allows for special handling of zero terminated strings on this target.
Definition MCAsmInfo.h:231
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:578
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition MCAsmInfo.h:381
const char * getAsciiDirective() const
Definition MCAsmInfo.h:604
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:404
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:632
bool hasCOFFComdatConstants() const
Definition MCAsmInfo.h:539
MCSymbolAttr HiddenVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having hidden visibility.
Definition MCAsmInfo.h:336
bool hasNoDeadStrip() const
Definition MCAsmInfo.h:630
const llvm::DenseSet< llvm::CachedHashStringRef > & getReservedIdentifiers() const
Definition MCAsmInfo.h:501
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:134
bool needsLocalForSize() const
Definition MCAsmInfo.h:560
const char * WeakDirective
Used to declare a global as being a weak symbol. Defaults to ".weak".
Definition MCAsmInfo.h:319
uint16_t AtSpecifierKind
Type for at specifiers. Currently, 16 bits is enough.
Definition MCAsmInfo.h:78
void setCommentColumn(unsigned Col)
Definition MCAsmInfo.h:552
bool hasFunctionAlignment() const
Definition MCAsmInfo.h:625
bool enableDwarfFileDirectoryDefault() const
Definition MCAsmInfo.h:704
bool hasIdentDirective() const
Definition MCAsmInfo.h:629
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition MCAsmInfo.h:452
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)