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