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