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. This is also used for labels for basic blocks.
163
164 /// This prefix is used for symbols that should be passed through the
165 /// assembler but be removed by the linker. This is 'l' on Darwin, currently
166 /// used for some ObjC metadata. The default of "" meast that for this system
167 /// a plain private symbol should be used. Defaults to "".
169
170 /// If these are nonempty, they contain a directive to emit before and after
171 /// an inline assembly statement. Defaults to "APP", "NO_APP"
172 const char *InlineAsmStart = "APP";
173 const char *InlineAsmEnd = "NO_APP";
174
175 /// Which dialect of an assembler variant to use. Defaults to 0
176 unsigned AssemblerDialect = 0;
177
178 /// This is true if the assembler allows @ characters in symbol names.
179 /// Defaults to false.
180 bool AllowAtInName = false;
181
182 /// This is true if the assembler allows the "?" character at the start of
183 /// of a string to be lexed as an AsmToken::Identifier.
184 /// If the AsmLexer determines that the string can be lexed as a possible
185 /// comment, setting this option will have no effect, and the string will
186 /// still be lexed as a comment.
188
189 /// This is true if the assembler allows the "$" character at the start of
190 /// of a string to be lexed as an AsmToken::Identifier.
191 /// If the AsmLexer determines that the string can be lexed as a possible
192 /// comment, setting this option will have no effect, and the string will
193 /// still be lexed as a comment.
195
196 /// This is true if the assembler allows the "@" character at the start of
197 /// a string to be lexed as an AsmToken::Identifier.
198 /// If the AsmLexer determines that the string can be lexed as a possible
199 /// comment, setting this option will have no effect, and the string will
200 /// still be lexed as a comment.
202
203 /// If this is true, symbol names with invalid characters will be printed in
204 /// quotes.
206
207 /// This is true if data region markers should be printed as
208 /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels
209 /// instead.
211
212 /// True if the target supports LEB128 directives.
214
215 /// True if full register names are printed.
217
218 //===--- Data Emission Directives -------------------------------------===//
219
220 /// This should be set to the directive used to get some number of zero (and
221 /// non-zero if supported by the directive) bytes emitted to the current
222 /// section. Common cases are "\t.zero\t" and "\t.space\t". Defaults to
223 /// "\t.zero\t"
224 const char *ZeroDirective = "\t.zero\t";
225
226 /// This directive allows emission of an ascii string with the standard C
227 /// escape characters embedded into it. If a target doesn't support this, it
228 /// can be set to null. Defaults to "\t.ascii\t"
229 const char *AsciiDirective = "\t.ascii\t";
230
231 /// If not null, this allows for special handling of zero terminated strings
232 /// on this target. This is commonly supported as ".asciz". If a target
233 /// doesn't support this, it can be set to null. Defaults to "\t.asciz\t"
234 const char *AscizDirective = "\t.asciz\t";
235
236 /// Form used for character literals in the assembly syntax. Useful for
237 /// producing strings as byte lists. If a target does not use or support
238 /// this, it shall be set to ACLS_Unknown. Defaults to ACLS_Unknown.
240
241 /// These directives are used to output some unit of integer data to the
242 /// current section. If a data directive is set to null, smaller data
243 /// directives will be used to emit the large sizes. Defaults to "\t.byte\t",
244 /// "\t.short\t", "\t.long\t", "\t.quad\t"
245 const char *Data8bitsDirective = "\t.byte\t";
246 const char *Data16bitsDirective = "\t.short\t";
247 const char *Data32bitsDirective = "\t.long\t";
248 const char *Data64bitsDirective = "\t.quad\t";
249
250 /// True if data directives support signed values
252
253 /// This is true if this target uses "Sun Style" syntax for section switching
254 /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
255 /// .section directives. Defaults to false.
257
258 /// This is true if this target uses ELF '.section' directive before the
259 /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
260 /// directive only. Defaults to false.
262
264
265 //===--- Alignment Information ----------------------------------------===//
266
267 /// If this is true (the default) then the asmprinter emits ".align N"
268 /// directives, where N is the number of bytes to align to. Otherwise, it
269 /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary. Defaults
270 /// to true.
272
273 /// If non-zero, this is used to fill the executable space created as the
274 /// result of a alignment directive. Defaults to 0
275 unsigned TextAlignFillValue = 0;
276
277 //===--- Global Variable Emission Directives --------------------------===//
278
279 /// This is the directive used to declare a global entity. Defaults to
280 /// ".globl".
281 const char *GlobalDirective = "\t.globl\t";
282
283 /// True if the expression
284 /// .long f - g
285 /// uses a relocation but it can be suppressed by writing
286 /// a = f - g
287 /// .long a
289
290 /// True is .comm's and .lcomms optional alignment is to be specified in bytes
291 /// instead of log2(n). Defaults to true.
293
294 /// Describes if the .lcomm directive for the target supports an alignment
295 /// argument and how it is interpreted. Defaults to NoAlignment.
297
298 // True if the target allows .align directives on functions. This is true for
299 // most targets, so defaults to true.
301
302 // True if the target respects .prefalign directives.
304
305 /// True if the target has .type and .size directives, this is true for most
306 /// ELF targets. Defaults to true.
308
309 /// True if the target has a single parameter .file directive, this is true
310 /// for ELF targets. Defaults to true.
312
313 /// True if the target has a .ident directive, this is true for ELF targets.
314 /// Defaults to false.
315 bool HasIdentDirective = false;
316
317 /// True if this target supports the MachO .no_dead_strip directive. Defaults
318 /// to false.
319 bool HasNoDeadStrip = false;
320
321 /// Used to declare a global as being a weak symbol. Defaults to ".weak".
322 const char *WeakDirective = "\t.weak\t";
323
324 /// This directive, if non-null, is used to declare a global as being a weak
325 /// undefined symbol. Defaults to nullptr.
326 const char *WeakRefDirective = nullptr;
327
328 /// True if we have a directive to declare a global as being a weak defined
329 /// symbol that can be hidden (unexported). Defaults to false.
331
332 /// True if we should mark symbols as global instead of weak, for
333 /// weak*/linkonce*, if the symbol has a comdat.
334 /// Defaults to false.
335 bool AvoidWeakIfComdat = false;
336
337 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
338 /// hidden visibility. Defaults to MCSA_Hidden.
340
341 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
342 /// exported visibility. Defaults to MCSA_Exported.
344
345 /// This attribute, if not MCSA_Invalid, is used to declare an undefined
346 /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
348
349 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
350 /// protected visibility. Defaults to MCSA_Protected
352
353 //===--- Dwarf Emission Directives -----------------------------------===//
354
355 /// True if target supports emission of debugging information. Defaults to
356 /// false.
358
359 /// Exception handling format for the target. Defaults to None.
361
362 /// True if target uses CFI unwind information for other purposes than EH
363 /// (debugging / sanitizers) when `ExceptionsType == ExceptionHandling::None`.
364 bool UsesCFIWithoutEH = false;
365
366 /// Windows exception handling data (.pdata) encoding. Defaults to Invalid.
368
369 /// True if Dwarf2 output generally uses relocations for references to other
370 /// .debug_* sections.
372
373 /// True if DWARF FDE symbol reference relocations should be replaced by an
374 /// absolute difference.
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
434
435 // Lowercase identifiers (e.g. register names, dialect keywords) that must be
436 // quoted when used as a symbol name.
438
440
441public:
442 explicit MCAsmInfo(const MCTargetOptions &Options);
443 virtual ~MCAsmInfo();
444
445 // Explicitly non-copyable.
446 MCAsmInfo(MCAsmInfo const &) = delete;
447 MCAsmInfo &operator=(MCAsmInfo const &) = delete;
448
450
451 /// Get the code pointer size in bytes.
452 unsigned getCodePointerSize() const { return CodePointerSize; }
453
454 /// Get the callee-saved register stack slot
455 /// size in bytes.
456 unsigned getCalleeSaveStackSlotSize() const {
458 }
459
460 /// True if the target is little endian.
461 bool isLittleEndian() const { return IsLittleEndian; }
462
463 /// True if target stack grow up.
464 bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
465
467
468 // Data directive accessors.
469
470 const char *getData8bitsDirective() const { return Data8bitsDirective; }
471 const char *getData16bitsDirective() const { return Data16bitsDirective; }
472 const char *getData32bitsDirective() const { return Data32bitsDirective; }
473 const char *getData64bitsDirective() const { return Data64bitsDirective; }
474 bool supportsSignedData() const { return SupportsSignedData; }
475
476 /// Targets can implement this method to specify a section to switch to
477 /// depending on whether the translation unit has any trampolines that require
478 /// an executable stack.
479 virtual MCSection *getStackSection(MCContext &Ctx, bool Exec) const {
480 return nullptr;
481 }
482
483 virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
484 unsigned Encoding,
485 MCStreamer &Streamer) const;
486
487 virtual const MCExpr *getExprForFDESymbol(const MCSymbol *Sym,
488 unsigned Encoding,
489 MCStreamer &Streamer) const;
490
491 /// Return true if C is an acceptable character inside a symbol name.
492 virtual bool isAcceptableChar(char C) const;
493
494 /// Return true if the identifier \p Name does not need quotes to be
495 /// syntactically correct.
496 virtual bool isValidUnquotedName(StringRef Name) const;
497
503 return ReservedIdentifiers;
504 }
505
506 virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
507 const Triple &, raw_ostream &) const {}
508
509 /// Return true if the .section directive should be omitted when
510 /// emitting \p SectionName. For example:
511 ///
512 /// shouldOmitSectionDirective(".text")
513 ///
514 /// returns false => .section .text,#alloc,#execinstr
515 /// returns true => .text
516 virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
517
518 // Return true if a .align directive should use "optimized nops" to fill
519 // instead of 0s.
520 virtual bool useCodeAlign(const MCSection &Sec) const { return false; }
521
525
529
533
534 // Accessors.
535
536 bool isAIX() const { return IsAIX; }
537 bool isHLASM() const { return IsHLASM; }
538 bool isMachO() const { return HasSubsectionsViaSymbols; }
541
542 /// Returns the maximum possible encoded instruction size in bytes. If \p STI
543 /// is null, this should be the maximum size for any subtarget.
544 virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
545 return MaxInstLength;
546 }
547
548 unsigned getMinInstAlignment() const { return MinInstAlignment; }
549 bool getDollarIsPC() const { return DollarIsPC; }
550 const char *getSeparatorString() const { return SeparatorString; }
551
552 unsigned getCommentColumn() const { return CommentColumn; }
553 void setCommentColumn(unsigned Col) { CommentColumn = Col; }
554
557 const char *getLabelSuffix() const { return LabelSuffix; }
558
561 bool needsLocalForSize() const { return NeedsLocalForSize; }
563
565 return !LinkerPrivateGlobalPrefix.empty();
566 }
567
573
574 const char *getInlineAsmStart() const { return InlineAsmStart; }
575 const char *getInlineAsmEnd() const { return InlineAsmEnd; }
576 unsigned getAssemblerDialect() const { return AssemblerDialect; }
577 // Return the assembler dialect that output printing should use. Used by
578 // createMCInstPrinter.
579 unsigned getOutputAssemblerDialect() const {
580 return TargetOptions.OutputAsmVariant.value_or(AssemblerDialect);
581 }
582 bool doesAllowAtInName() const { return AllowAtInName; }
583 void setAllowAtInName(bool V) { AllowAtInName = V; }
594
598
600
603
604 const char *getZeroDirective() const { return ZeroDirective; }
605 const char *getAsciiDirective() const { return AsciiDirective; }
606 const char *getAscizDirective() const { return AscizDirective; }
611 unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
612 const char *getGlobalDirective() const { return GlobalDirective; }
613
617
621
625
630 bool hasIdentDirective() const { return HasIdentDirective; }
631 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
632 const char *getWeakDirective() const { return WeakDirective; }
633 const char *getWeakRefDirective() const { return WeakRefDirective; }
634
638
639 bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
640
642
644
648
652
654
657
661
665
666 /// Returns true if the exception handling method for the platform uses call
667 /// frame information to unwind.
673
679
683
686 bool useAtForSpecifier() const { return UseAtForSpecifier; }
691
692 bool usesDwarfFileAndLocDirectives() const { return !IsAIX; }
693
697
698 void addInitialFrameState(const MCCFIInstruction &Inst);
699
700 const std::vector<MCCFIInstruction> &getInitialFrameState() const {
701 return InitialFrameState;
702 }
703
704 void setBinutilsVersion(std::pair<int, int> Value) {
706 }
707
708 /// Return true if assembly (inline or otherwise) should be parsed.
710
711 /// Return true if target want to use AsmParser to parse inlineasm.
715
716 bool binutilsIsAtLeast(int Major, int Minor) const {
717 return BinutilsVersion >= std::make_pair(Major, Minor);
718 }
719
720 /// Set whether assembly (inline or otherwise) should be parsed.
724
725 /// Set whether target want to use AsmParser to parse inlineasm.
729
730 /// Return true if assembly (inline or otherwise) should be parsed.
732
733 /// Set whether assembly (inline or otherwise) should be parsed.
734 virtual void setPreserveAsmComments(bool Value) {
736 }
737
738
739 bool shouldUseLogicalShr() const { return UseLogicalShr; }
740
742
743 StringRef getSpecifierName(uint32_t S) const;
744 std::optional<uint32_t> getSpecifierForName(StringRef Name) const;
745
746 void printExpr(raw_ostream &, const MCExpr &) const;
748 const MCSpecifierExpr &) const {
749 llvm_unreachable("Need to implement hook if target uses MCSpecifierExpr");
750 }
751 virtual bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &Res,
752 const MCAssembler *Asm) const;
753};
754
755} // end namespace llvm
756
757#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:289
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:246
bool hasCOFFAssociativeComdats() const
Definition MCAsmInfo.h:539
bool NeedsDwarfSectionOffsetDirective
Definition MCAsmInfo.h:263
const char * getLabelSuffix() const
Definition MCAsmInfo.h:557
void setAllowAtInName(bool V)
Definition MCAsmInfo.h:583
MCSymbolAttr ExportedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having exported visibility.
Definition MCAsmInfo.h:343
bool preserveAsmComments() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:731
bool supportsSignedData() const
Definition MCAsmInfo.h:474
const char * getInlineAsmStart() const
Definition MCAsmInfo.h:574
bool isHLASM() const
Definition MCAsmInfo.h:537
bool hasDotTypeDotSizeDirective() const
Definition MCAsmInfo.h:628
bool isLittleEndian() const
True if the target is little endian.
Definition MCAsmInfo.h:461
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition MCAsmInfo.h:125
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition MCAsmInfo.h:319
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:686
unsigned TextAlignFillValue
If non-zero, this is used to fill the executable space created as the result of a alignment directive...
Definition MCAsmInfo.h:275
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:187
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:709
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:351
virtual void printSpecifierExpr(raw_ostream &, const MCSpecifierExpr &) const
Definition MCAsmInfo.h:747
bool HasFunctionAlignment
Definition MCAsmInfo.h:300
const char * AsciiDirective
This directive allows emission of an ascii string with the standard C escape characters embedded into...
Definition MCAsmInfo.h:229
std::vector< MCCFIInstruction > InitialFrameState
Definition MCAsmInfo.h:398
llvm::StringMap< uint32_t > NameToAtSpecifier
Definition MCAsmInfo.h:432
MCAsmInfo & operator=(MCAsmInfo const &)=delete
void initializeAtSpecifiers(ArrayRef< AtSpecifier >)
MCSymbolAttr getProtectedVisibilityAttr() const
Definition MCAsmInfo.h:649
bool usesSunStyleELFSectionSwitchSyntax() const
Definition MCAsmInfo.h:522
bool doesAllowDollarAtStartOfIdentifier() const
Definition MCAsmInfo.h:590
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
Definition MCAsmInfo.h:544
unsigned getMinInstAlignment() const
Definition MCAsmInfo.h:548
bool hasLEB128Directives() const
Definition MCAsmInfo.h:599
bool doesSupportDataRegionDirectives() const
Definition MCAsmInfo.h:595
MCSymbolAttr getExportedVisibilityAttr() const
Definition MCAsmInfo.h:643
bool usesSetToEquateSymbol() const
Definition MCAsmInfo.h:559
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition MCAsmInfo.h:103
const char * getData32bitsDirective() const
Definition MCAsmInfo.h:472
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition MCAsmInfo.h:245
const char * Data64bitsDirective
Definition MCAsmInfo.h:248
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition MCAsmInfo.h:700
bool useFullRegisterNames() const
Definition MCAsmInfo.h:601
llvm::DenseMap< uint32_t, StringRef > AtSpecifierToName
Definition MCAsmInfo.h:431
unsigned getAssemblerDialect() const
Definition MCAsmInfo.h:576
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:721
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:498
virtual ~MCAsmInfo()
const char * getInlineAsmEnd() const
Definition MCAsmInfo.h:575
unsigned getTextAlignFillValue() const
Definition MCAsmInfo.h:611
StringRef getLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:568
bool doesAllowAtInName() const
Definition MCAsmInfo.h:582
bool useDwarfRegNumForCFI() const
Definition MCAsmInfo.h:685
bool useAssignmentForEHBegin() const
Definition MCAsmInfo.h:560
bool usesCFIWithoutEH() const
Definition MCAsmInfo.h:662
bool supportsExtendedDwarfLocDirective() const
Definition MCAsmInfo.h:688
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:335
bool NeedsLocalForSize
Definition MCAsmInfo.h:157
const MCTargetOptions & TargetOptions
Definition MCAsmInfo.h:439
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition MCAsmInfo.h:360
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:194
bool PreserveAsmComments
Preserve Comments in assembly.
Definition MCAsmInfo.h:419
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:375
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:470
MCAsmInfo(const MCTargetOptions &Options)
Definition MCAsmInfo.cpp:44
const char * getData64bitsDirective() const
Definition MCAsmInfo.h:473
AsmCharLiteralSyntax characterLiteralSyntax() const
Definition MCAsmInfo.h:607
bool avoidWeakIfComdat() const
Definition MCAsmInfo.h:639
bool isAIX() const
Definition MCAsmInfo.h:536
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:288
const char * Data32bitsDirective
Definition MCAsmInfo.h:247
bool UseIntegratedAssembler
Should we use the integrated assembler?
Definition MCAsmInfo.h:413
bool shouldUseMotorolaIntegers() const
Definition MCAsmInfo.h:741
bool supportsNameQuoting() const
Definition MCAsmInfo.h:593
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:201
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:426
bool UseMotorolaIntegers
Definition MCAsmInfo.h:429
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
Definition MCAsmInfo.h:645
const char * GlobalDirective
This is the directive used to declare a global entity.
Definition MCAsmInfo.h:281
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition MCAsmInfo.h:296
bool hasWeakDefCanBeHiddenDirective() const
Definition MCAsmInfo.h:635
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition MCAsmInfo.h:367
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:734
bool hasLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:564
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol.
Definition MCAsmInfo.h:326
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
Definition MCAsmInfo.h:622
bool needsDwarfSectionOffsetDirective() const
Definition MCAsmInfo.h:530
bool shouldUseLogicalShr() const
Definition MCAsmInfo.h:739
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition MCAsmInfo.h:307
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
Definition MCAsmInfo.h:668
bool AllowAtInName
This is true if the assembler allows @ characters in symbol names.
Definition MCAsmInfo.h:180
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:506
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:330
StringRef getCommentString() const
Definition MCAsmInfo.h:555
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:449
const char * getAscizDirective() const
Definition MCAsmInfo.h:606
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition MCAsmInfo.h:256
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition MCAsmInfo.h:172
bool HasPreferredAlignment
Definition MCAsmInfo.h:303
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:653
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:614
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
Definition MCAsmInfo.h:416
llvm::DenseSet< llvm::CachedHashStringRef > ReservedIdentifiers
Definition MCAsmInfo.h:437
WinEH::EncodingType getWinEHEncodingType() const
Definition MCAsmInfo.h:656
bool doesDwarfUseRelocationsAcrossSections() const
Definition MCAsmInfo.h:680
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:261
virtual void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:726
const char * getZeroDirective() const
Definition MCAsmInfo.h:604
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:168
StringRef getInternalSymbolPrefix() const
Definition MCAsmInfo.h:562
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:357
void setFullRegisterNames(bool V)
Definition MCAsmInfo.h:602
const char * getWeakDirective() const
Definition MCAsmInfo.h:632
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:99
bool hasSubsectionsViaSymbols() const
Definition MCAsmInfo.h:466
bool PPCUseFullRegisterNames
True if full register names are printed.
Definition MCAsmInfo.h:216
const char * InlineAsmEnd
Definition MCAsmInfo.h:173
const char * getData16bitsDirective() const
Definition MCAsmInfo.h:471
const char * getSeparatorString() const
Definition MCAsmInfo.h:550
bool SupportsSignedData
True if data directives support signed values.
Definition MCAsmInfo.h:251
bool doesAllowAtAtStartOfIdentifier() const
Definition MCAsmInfo.h:587
bool getCOMMDirectiveAlignmentIsInBytes() const
Definition MCAsmInfo.h:618
bool isStackGrowthDirectionUp() const
True if target stack grow up.
Definition MCAsmInfo.h:464
virtual bool useCodeAlign(const MCSection &Sec) const
Definition MCAsmInfo.h:520
bool useParensForSpecifier() const
Definition MCAsmInfo.h:687
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition MCAsmInfo.h:176
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:627
virtual MCSection * getStackSection(MCContext &Ctx, bool Exec) const
Targets can implement this method to specify a section to switch to depending on whether the translat...
Definition MCAsmInfo.h:479
MCSymbolAttr HiddenDeclarationVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare an undefined symbol as having hidden visibili...
Definition MCAsmInfo.h:347
bool shouldAllowAdditionalComments() const
Definition MCAsmInfo.h:556
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
Definition MCAsmInfo.h:456
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when E...
Definition MCAsmInfo.h:364
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition MCAsmInfo.h:315
bool isMachO() const
Definition MCAsmInfo.h:538
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections.
Definition MCAsmInfo.h:371
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:712
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition MCAsmInfo.h:311
void setBinutilsVersion(std::pair< int, int > Value)
Definition MCAsmInfo.h:704
bool doDwarfFDESymbolsUseAbsDiff() const
Definition MCAsmInfo.h:684
const char * getGlobalDirective() const
Definition MCAsmInfo.h:612
void setExceptionsType(ExceptionHandling EH)
Definition MCAsmInfo.h:658
bool doesAllowQuestionAtStartOfIdentifier() const
Definition MCAsmInfo.h:584
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition MCAsmInfo.h:292
bool getAlignmentIsInBytes() const
Definition MCAsmInfo.h:610
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:271
bool usesWindowsCFI() const
Definition MCAsmInfo.h:674
bool usesELFSectionDirectiveForBSS() const
Definition MCAsmInfo.h:526
AsmCharLiteralSyntax CharacterLiteralSyntax
Form used for character literals in the assembly syntax.
Definition MCAsmInfo.h:239
bool getDollarIsPC() const
Definition MCAsmInfo.h:549
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:716
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:224
unsigned getCommentColumn() const
Definition MCAsmInfo.h:552
MCSymbolAttr getHiddenVisibilityAttr() const
Definition MCAsmInfo.h:641
bool SupportsQuotedNames
If this is true, symbol names with invalid characters will be printed in quotes.
Definition MCAsmInfo.h:205
bool hasSingleParameterDotFile() const
Definition MCAsmInfo.h:629
const char * AscizDirective
If not null, this allows for special handling of zero terminated strings on this target.
Definition MCAsmInfo.h:234
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives.
Definition MCAsmInfo.h:210
unsigned getOutputAssemblerDialect() const
Definition MCAsmInfo.h:579
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:605
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:406
bool HasLEB128Directives
True if the target supports LEB128 directives.
Definition MCAsmInfo.h:213
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:633
bool hasCOFFComdatConstants() const
Definition MCAsmInfo.h:540
MCSymbolAttr HiddenVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having hidden visibility.
Definition MCAsmInfo.h:339
bool hasNoDeadStrip() const
Definition MCAsmInfo.h:631
ExceptionHandling getExceptionHandlingType() const
Definition MCAsmInfo.h:655
const llvm::DenseSet< llvm::CachedHashStringRef > & getReservedIdentifiers() const
Definition MCAsmInfo.h:502
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:137
bool needsLocalForSize() const
Definition MCAsmInfo.h:561
const char * WeakDirective
Used to declare a global as being a weak symbol. Defaults to ".weak".
Definition MCAsmInfo.h:322
void setCommentColumn(unsigned Col)
Definition MCAsmInfo.h:553
bool hasFunctionAlignment() const
Definition MCAsmInfo.h:626
bool enableDwarfFileDirectoryDefault() const
Definition MCAsmInfo.h:694
bool usesDwarfFileAndLocDirectives() const
Definition MCAsmInfo.h:692
bool hasIdentDirective() const
Definition MCAsmInfo.h:630
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition MCAsmInfo.h:452
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h: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)