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 /// Exception handling format for the target. Defaults to None.
358
359 /// True if target uses CFI unwind information for other purposes than EH
360 /// (debugging / sanitizers) when `ExceptionsType == ExceptionHandling::None`.
361 bool UsesCFIWithoutEH = false;
362
363 /// Windows exception handling data (.pdata) encoding. Defaults to Invalid.
365
366 /// True if Dwarf2 output generally uses relocations for references to other
367 /// .debug_* sections.
369
370 /// True if DWARF FDE symbol reference relocations should be replaced by an
371 /// absolute difference.
373
374 /// The optional specifier to use for the relative FDE symbol references.
376
377 /// True if DWARF `.file directory' directive syntax is used by
378 /// default.
380
381 /// True if dwarf register numbers are printed instead of symbolic register
382 /// names in .cfi_* directives. Defaults to false.
383 bool DwarfRegNumForCFI = false;
384
385 /// True if target uses @ (expr@specifier) for relocation specifiers.
386 bool UseAtForSpecifier = false;
387
388 /// (ARM-specific) Uses parens for relocation specifier in data
389 /// directives, e.g. .word foo(got).
391
392 /// True if the target supports flags in ".loc" directive, false if only
393 /// location is allowed.
395
396 //===--- Prologue State ----------------------------------------------===//
397
398 std::vector<MCCFIInstruction> InitialFrameState;
399
400 //===--- Integrated Assembler Information ----------------------------===//
401
402 // Generated object files can use all ELF features supported by GNU ld of
403 // this binutils version and later. INT_MAX means all features can be used,
404 // regardless of GNU ld support. The default value is referenced by
405 // clang/Options/Options.td.
406 std::pair<int, int> BinutilsVersion = {2, 26};
407
408 /// Should we use the integrated assembler?
409 /// The integrated assembler should be enabled by default (by the
410 /// constructors) when failing to parse a valid piece of assembly (inline
411 /// or otherwise) is considered a bug. It may then be overridden after
412 /// construction (see CodeGenTargetMachineImpl::initAsmInfo()).
414
415 /// Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
417
418 /// Preserve Comments in assembly
420
421 /// The column (zero-based) at which asm comments should be printed.
422 unsigned CommentColumn = 40;
423
424 /// True if the integrated assembler should interpret 'a >> b' constant
425 /// expressions as logical rather than arithmetic.
426 bool UseLogicalShr = true;
427
428 // If true, use Motorola-style integers in Assembly (ex. $0ac).
430
431 // This describes a @ style relocation specifier (expr@specifier) supported by
432 // AsmParser::parsePrimaryExpr.
436
437 // Lowercase identifiers (e.g. register names, dialect keywords) that must be
438 // quoted when used as a symbol name.
440
442
443public:
444 explicit MCAsmInfo(const MCTargetOptions &Options);
445 virtual ~MCAsmInfo();
446
447 // Explicitly non-copyable.
448 MCAsmInfo(MCAsmInfo const &) = delete;
449 MCAsmInfo &operator=(MCAsmInfo const &) = delete;
450
452
453 /// Get the code pointer size in bytes.
454 unsigned getCodePointerSize() const { return CodePointerSize; }
455
456 /// Get the callee-saved register stack slot
457 /// size in bytes.
458 unsigned getCalleeSaveStackSlotSize() const {
460 }
461
462 /// True if the target is little endian.
463 bool isLittleEndian() const { return IsLittleEndian; }
464
465 /// True if target stack grow up.
466 bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
467
469
470 // Data directive accessors.
471
472 const char *getData8bitsDirective() const { return Data8bitsDirective; }
473 const char *getData16bitsDirective() const { return Data16bitsDirective; }
474 const char *getData32bitsDirective() const { return Data32bitsDirective; }
475 const char *getData64bitsDirective() const { return Data64bitsDirective; }
476 bool supportsSignedData() const { return SupportsSignedData; }
477
478 /// Targets can implement this method to specify a section to switch to
479 /// depending on whether the translation unit has any trampolines that require
480 /// an executable stack.
481 virtual MCSection *getStackSection(MCContext &Ctx, bool Exec) const {
482 return nullptr;
483 }
484
485 virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
486 unsigned Encoding,
487 MCStreamer &Streamer) const;
488
489 const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding,
490 MCStreamer &Streamer) const;
491
492 /// Return true if C is an acceptable character inside a symbol name.
493 bool isAcceptableChar(char C) const;
494
495 /// Return true if the identifier \p Name does not need quotes to be
496 /// syntactically correct.
497 bool isValidUnquotedName(StringRef Name) const;
498
504 return ReservedIdentifiers;
505 }
506
507 virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
508 const Triple &, raw_ostream &) const {}
509
510 /// Return true if the .section directive should be omitted when
511 /// emitting \p SectionName. For example:
512 ///
513 /// shouldOmitSectionDirective(".text")
514 ///
515 /// returns false => .section .text,#alloc,#execinstr
516 /// returns true => .text
517 virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
518
519 // Return true if a .align directive should use "optimized nops" to fill
520 // instead of 0s.
521 virtual bool useCodeAlign(const MCSection &Sec) const { return false; }
522
526
530
534
535 // Accessors.
536
537 bool isAIX() const { return IsAIX; }
538 bool isHLASM() const { return IsHLASM; }
539 bool isMachO() const { return HasSubsectionsViaSymbols; }
542
543 /// Returns the maximum possible encoded instruction size in bytes. If \p STI
544 /// is null, this should be the maximum size for any subtarget.
545 virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
546 return MaxInstLength;
547 }
548
549 unsigned getMinInstAlignment() const { return MinInstAlignment; }
550 bool getDollarIsPC() const { return DollarIsPC; }
551 const char *getSeparatorString() const { return SeparatorString; }
552
553 unsigned getCommentColumn() const { return CommentColumn; }
554 void setCommentColumn(unsigned Col) { CommentColumn = Col; }
555
558 const char *getLabelSuffix() const { return LabelSuffix; }
559
562 bool needsLocalForSize() const { return NeedsLocalForSize; }
564
566 return !LinkerPrivateGlobalPrefix.empty();
567 }
568
574
575 const char *getInlineAsmStart() const { return InlineAsmStart; }
576 const char *getInlineAsmEnd() const { return InlineAsmEnd; }
577 unsigned getAssemblerDialect() const { return AssemblerDialect; }
578 // Return the assembler dialect that output printing should use. Used by
579 // createMCInstPrinter.
580 unsigned getOutputAssemblerDialect() const {
581 return TargetOptions.OutputAsmVariant.value_or(AssemblerDialect);
582 }
583 bool doesAllowAtInName() const { return AllowAtInName; }
584 void setAllowAtInName(bool V) { AllowAtInName = V; }
595
599
601
604
605 const char *getZeroDirective() const { return ZeroDirective; }
606 const char *getAsciiDirective() const { return AsciiDirective; }
607 const char *getAscizDirective() const { return AscizDirective; }
612 unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
613 const char *getGlobalDirective() const { return GlobalDirective; }
614
618
622
626
631 bool hasIdentDirective() const { return HasIdentDirective; }
632 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
633 const char *getWeakDirective() const { return WeakDirective; }
634 const char *getWeakRefDirective() const { return WeakRefDirective; }
635
639
640 bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
641
643
645
649
653
655
658
662
666
667 /// Returns true if the exception handling method for the platform uses call
668 /// frame information to unwind.
674
680
684
687 bool useAtForSpecifier() const { return UseAtForSpecifier; }
692
696
697 void addInitialFrameState(const MCCFIInstruction &Inst);
698
699 const std::vector<MCCFIInstruction> &getInitialFrameState() const {
700 return InitialFrameState;
701 }
702
703 void setBinutilsVersion(std::pair<int, int> Value) {
705 }
706
707 /// Return true if assembly (inline or otherwise) should be parsed.
709
710 /// Return true if target want to use AsmParser to parse inlineasm.
714
715 bool binutilsIsAtLeast(int Major, int Minor) const {
716 return BinutilsVersion >= std::make_pair(Major, Minor);
717 }
718
719 /// Set whether assembly (inline or otherwise) should be parsed.
723
724 /// Set whether target want to use AsmParser to parse inlineasm.
728
729 /// Return true if assembly (inline or otherwise) should be parsed.
731
732 /// Set whether assembly (inline or otherwise) should be parsed.
734
735 bool shouldUseLogicalShr() const { return UseLogicalShr; }
736
738
739 StringRef getSpecifierName(uint32_t S) const;
740 std::optional<uint32_t> getSpecifierForName(StringRef Name) const;
741
742 void printExpr(raw_ostream &, const MCExpr &) const;
744 const MCSpecifierExpr &) const {
745 llvm_unreachable("Need to implement hook if target uses MCSpecifierExpr");
746 }
747 virtual bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &Res,
748 const MCAssembler *Asm) const;
749};
750
751} // end namespace llvm
752
753#endif // LLVM_MC_MCASMINFO_H
This file defines the StringMap class.
static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, raw_ostream &OS)
This file defines CachedHashString and CachedHashStringRef.
#define LLVM_ABI
Definition Compiler.h:215
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
static LVOptions Options
Definition LVOptions.cpp:25
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:540
bool NeedsDwarfSectionOffsetDirective
Definition MCAsmInfo.h:260
const char * getLabelSuffix() const
Definition MCAsmInfo.h:558
void setAllowAtInName(bool V)
Definition MCAsmInfo.h:584
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:730
bool supportsSignedData() const
Definition MCAsmInfo.h:476
const char * getInlineAsmStart() const
Definition MCAsmInfo.h:575
bool isHLASM() const
Definition MCAsmInfo.h:538
bool hasDotTypeDotSizeDirective() const
Definition MCAsmInfo.h:629
bool isLittleEndian() const
True if the target is little endian.
Definition MCAsmInfo.h:463
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:687
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:708
bool UseAtForSpecifier
True if target uses @ (expr@specifier) for relocation specifiers.
Definition MCAsmInfo.h:386
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:743
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:398
MCAsmInfo & operator=(MCAsmInfo const &)=delete
MCSymbolAttr getProtectedVisibilityAttr() const
Definition MCAsmInfo.h:650
bool usesSunStyleELFSectionSwitchSyntax() const
Definition MCAsmInfo.h:523
bool doesAllowDollarAtStartOfIdentifier() const
Definition MCAsmInfo.h:591
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
Definition MCAsmInfo.h:545
unsigned getMinInstAlignment() const
Definition MCAsmInfo.h:549
bool hasLEB128Directives() const
Definition MCAsmInfo.h:600
bool doesSupportDataRegionDirectives() const
Definition MCAsmInfo.h:596
MCSymbolAttr getExportedVisibilityAttr() const
Definition MCAsmInfo.h:644
bool usesSetToEquateSymbol() const
Definition MCAsmInfo.h:560
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition MCAsmInfo.h:100
const char * getData32bitsDirective() const
Definition MCAsmInfo.h:474
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:699
bool useFullRegisterNames() const
Definition MCAsmInfo.h:602
unsigned getAssemblerDialect() const
Definition MCAsmInfo.h:577
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:720
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:499
virtual ~MCAsmInfo()
const char * getInlineAsmEnd() const
Definition MCAsmInfo.h:576
unsigned getTextAlignFillValue() const
Definition MCAsmInfo.h:612
StringRef getLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:569
bool doesAllowAtInName() const
Definition MCAsmInfo.h:583
bool useDwarfRegNumForCFI() const
Definition MCAsmInfo.h:686
bool useAssignmentForEHBegin() const
Definition MCAsmInfo.h:561
bool usesCFIWithoutEH() const
Definition MCAsmInfo.h:663
bool supportsExtendedDwarfLocDirective() const
Definition MCAsmInfo.h:689
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:441
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition MCAsmInfo.h:357
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:419
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:372
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:472
MCAsmInfo(const MCTargetOptions &Options)
Definition MCAsmInfo.cpp:45
const char * getData64bitsDirective() const
Definition MCAsmInfo.h:475
AsmCharLiteralSyntax characterLiteralSyntax() const
Definition MCAsmInfo.h:608
bool avoidWeakIfComdat() const
Definition MCAsmInfo.h:640
bool isAIX() const
Definition MCAsmInfo.h:537
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:413
bool shouldUseMotorolaIntegers() const
Definition MCAsmInfo.h:737
bool supportsNameQuoting() const
Definition MCAsmInfo.h:594
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:426
bool UseMotorolaIntegers
Definition MCAsmInfo.h:429
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
Definition MCAsmInfo.h:646
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:636
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition MCAsmInfo.h:364
bool HasCOFFComdatConstants
True if this is a non-GNU COFF target.
Definition MCAsmInfo.h:109
bool hasLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:565
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:623
bool needsDwarfSectionOffsetDirective() const
Definition MCAsmInfo.h:531
bool shouldUseLogicalShr() const
Definition MCAsmInfo.h:735
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition MCAsmInfo.h:304
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
Definition MCAsmInfo.h:669
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:422
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection, const Triple &, raw_ostream &) const
Definition MCAsmInfo.h:507
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 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:556
bool UseParensForSpecifier
(ARM-specific) Uses parens for relocation specifier in data directives, e.g.
Definition MCAsmInfo.h:390
const MCTargetOptions & getTargetOptions() const
Definition MCAsmInfo.h:451
const char * getAscizDirective() const
Definition MCAsmInfo.h:607
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:375
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:654
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:615
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
Definition MCAsmInfo.h:416
llvm::DenseSet< llvm::CachedHashStringRef > ReservedIdentifiers
Definition MCAsmInfo.h:439
WinEH::EncodingType getWinEHEncodingType() const
Definition MCAsmInfo.h:657
bool doesDwarfUseRelocationsAcrossSections() const
Definition MCAsmInfo.h:681
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:258
const char * getZeroDirective() const
Definition MCAsmInfo.h:605
bool EnableDwarfFileDirectoryDefault
True if DWARF ‘.file directory’ directive syntax is used by default.
Definition MCAsmInfo.h:379
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:563
llvm::DenseMap< AtSpecifierKind, StringRef > AtSpecifierToName
Definition MCAsmInfo.h:433
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:354
void setFullRegisterNames(bool V)
Definition MCAsmInfo.h:603
void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:725
const char * getWeakDirective() const
Definition MCAsmInfo.h:633
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:96
bool hasSubsectionsViaSymbols() const
Definition MCAsmInfo.h:468
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:473
const char * getSeparatorString() const
Definition MCAsmInfo.h:551
bool SupportsSignedData
True if data directives support signed values.
Definition MCAsmInfo.h:248
bool doesAllowAtAtStartOfIdentifier() const
Definition MCAsmInfo.h:588
bool getCOMMDirectiveAlignmentIsInBytes() const
Definition MCAsmInfo.h:619
bool isStackGrowthDirectionUp() const
True if target stack grow up.
Definition MCAsmInfo.h:466
virtual bool useCodeAlign(const MCSection &Sec) const
Definition MCAsmInfo.h:521
bool useParensForSpecifier() const
Definition MCAsmInfo.h:688
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:628
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:481
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:733
bool shouldAllowAdditionalComments() const
Definition MCAsmInfo.h:557
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
Definition MCAsmInfo.h:458
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when E...
Definition MCAsmInfo.h:361
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:539
llvm::StringMap< AtSpecifierKind > NameToAtSpecifier
Definition MCAsmInfo.h:434
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections.
Definition MCAsmInfo.h:368
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:711
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:703
bool doDwarfFDESymbolsUseAbsDiff() const
Definition MCAsmInfo.h:685
const char * getGlobalDirective() const
Definition MCAsmInfo.h:613
void setExceptionsType(ExceptionHandling EH)
Definition MCAsmInfo.h:659
bool doesAllowQuestionAtStartOfIdentifier() const
Definition MCAsmInfo.h:585
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:611
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
Definition MCAsmInfo.h:675
bool usesELFSectionDirectiveForBSS() const
Definition MCAsmInfo.h:527
AsmCharLiteralSyntax CharacterLiteralSyntax
Form used for character literals in the assembly syntax.
Definition MCAsmInfo.h:236
bool getDollarIsPC() const
Definition MCAsmInfo.h:550
bool SupportsExtendedDwarfLocDirective
True if the target supports flags in ".loc" directive, false if only location is allowed.
Definition MCAsmInfo.h:394
bool binutilsIsAtLeast(int Major, int Minor) const
Definition MCAsmInfo.h:715
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:553
MCSymbolAttr getHiddenVisibilityAttr() const
Definition MCAsmInfo.h:642
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:630
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:580
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition MCAsmInfo.h:383
const char * getAsciiDirective() const
Definition MCAsmInfo.h:606
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:406
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:634
bool hasCOFFComdatConstants() const
Definition MCAsmInfo.h:541
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:632
ExceptionHandling getExceptionHandlingType() const
Definition MCAsmInfo.h:656
const llvm::DenseSet< llvm::CachedHashStringRef > & getReservedIdentifiers() const
Definition MCAsmInfo.h:503
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:134
bool needsLocalForSize() const
Definition MCAsmInfo.h:562
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:554
bool hasFunctionAlignment() const
Definition MCAsmInfo.h:627
bool enableDwarfFileDirectoryDefault() const
Definition MCAsmInfo.h:693
bool hasIdentDirective() const
Definition MCAsmInfo.h:631
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition MCAsmInfo.h:454
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:573
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:128
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.
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
@ 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:53
@ ZOS
z/OS MVS Exception Handling.
Definition CodeGen.h:61
@ None
No exception support.
Definition CodeGen.h:54
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:55
@ WinEH
Windows Exception Handling.
Definition CodeGen.h:58
@ MCSA_Protected
.protected (ELF)
@ MCSA_Exported
.globl _foo, exported (XCOFF)
@ MCSA_Hidden
.hidden (ELF)