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 the same as
163 /// PrivateGlobalPrefix.
165
166 /// This prefix is used for symbols that should be passed through the
167 /// assembler but be removed by the linker. This is 'l' on Darwin, currently
168 /// used for some ObjC metadata. The default of "" meast that for this system
169 /// a plain private symbol should be used. Defaults to "".
171
172 /// If these are nonempty, they contain a directive to emit before and after
173 /// an inline assembly statement. Defaults to "#APP\n", "#NO_APP\n"
174 const char *InlineAsmStart;
175 const char *InlineAsmEnd;
176
177 /// Which dialect of an assembler variant to use. Defaults to 0
178 unsigned AssemblerDialect = 0;
179
180 /// This is true if the assembler allows @ characters in symbol names.
181 /// Defaults to false.
182 bool AllowAtInName = false;
183
184 /// This is true if the assembler allows the "?" character at the start of
185 /// of a string to be lexed as an AsmToken::Identifier.
186 /// If the AsmLexer determines that the string can be lexed as a possible
187 /// comment, setting this option will have no effect, and the string will
188 /// still be lexed as a comment.
190
191 /// This is true if the assembler allows the "$" character at the start of
192 /// of a string to be lexed as an AsmToken::Identifier.
193 /// If the AsmLexer determines that the string can be lexed as a possible
194 /// comment, setting this option will have no effect, and the string will
195 /// still be lexed as a comment.
197
198 /// This is true if the assembler allows the "@" character at the start of
199 /// a string to be lexed as an AsmToken::Identifier.
200 /// If the AsmLexer determines that the string can be lexed as a possible
201 /// comment, setting this option will have no effect, and the string will
202 /// still be lexed as a comment.
204
205 /// If this is true, symbol names with invalid characters will be printed in
206 /// quotes.
208
209 /// This is true if data region markers should be printed as
210 /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels
211 /// instead.
213
214 /// True if the target supports LEB128 directives.
216
217 /// True if full register names are printed.
219
220 //===--- Data Emission Directives -------------------------------------===//
221
222 /// This should be set to the directive used to get some number of zero (and
223 /// non-zero if supported by the directive) bytes emitted to the current
224 /// section. Common cases are "\t.zero\t" and "\t.space\t". Defaults to
225 /// "\t.zero\t"
226 const char *ZeroDirective;
227
228 /// This directive allows emission of an ascii string with the standard C
229 /// escape characters embedded into it. If a target doesn't support this, it
230 /// can be set to null. Defaults to "\t.ascii\t"
231 const char *AsciiDirective;
232
233 /// If not null, this allows for special handling of zero terminated strings
234 /// on this target. This is commonly supported as ".asciz". If a target
235 /// doesn't support this, it can be set to null. Defaults to "\t.asciz\t"
236 const char *AscizDirective;
237
238 /// Form used for character literals in the assembly syntax. Useful for
239 /// producing strings as byte lists. If a target does not use or support
240 /// this, it shall be set to ACLS_Unknown. Defaults to ACLS_Unknown.
242
243 /// These directives are used to output some unit of integer data to the
244 /// current section. If a data directive is set to null, smaller data
245 /// directives will be used to emit the large sizes. Defaults to "\t.byte\t",
246 /// "\t.short\t", "\t.long\t", "\t.quad\t"
251
252 /// True if data directives support signed values
254
255 /// This is true if this target uses "Sun Style" syntax for section switching
256 /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
257 /// .section directives. Defaults to false.
259
260 /// This is true if this target uses ELF '.section' directive before the
261 /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
262 /// directive only. Defaults to false.
264
266
267 //===--- Alignment Information ----------------------------------------===//
268
269 /// If this is true (the default) then the asmprinter emits ".align N"
270 /// directives, where N is the number of bytes to align to. Otherwise, it
271 /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary. Defaults
272 /// to true.
274
275 /// If non-zero, this is used to fill the executable space created as the
276 /// result of a alignment directive. Defaults to 0
277 unsigned TextAlignFillValue = 0;
278
279 //===--- Global Variable Emission Directives --------------------------===//
280
281 /// This is the directive used to declare a global entity. Defaults to
282 /// ".globl".
283 const char *GlobalDirective;
284
285 /// True if the expression
286 /// .long f - g
287 /// uses a relocation but it can be suppressed by writing
288 /// a = f - g
289 /// .long a
291
292 /// True is .comm's and .lcomms optional alignment is to be specified in bytes
293 /// instead of log2(n). Defaults to true.
295
296 /// Describes if the .lcomm directive for the target supports an alignment
297 /// argument and how it is interpreted. Defaults to NoAlignment.
299
300 // True if the target allows .align directives on functions. This is true for
301 // most targets, so defaults to true.
303
304 // True if the target respects .prefalign directives.
306
307 /// True if the target has .type and .size directives, this is true for most
308 /// ELF targets. Defaults to true.
310
311 /// True if the target has a single parameter .file directive, this is true
312 /// for ELF targets. Defaults to true.
314
315 /// True if the target has a .ident directive, this is true for ELF targets.
316 /// Defaults to false.
317 bool HasIdentDirective = false;
318
319 /// True if this target supports the MachO .no_dead_strip directive. Defaults
320 /// to false.
321 bool HasNoDeadStrip = false;
322
323 /// Used to declare a global as being a weak symbol. Defaults to ".weak".
324 const char *WeakDirective;
325
326 /// This directive, if non-null, is used to declare a global as being a weak
327 /// undefined symbol. Defaults to nullptr.
328 const char *WeakRefDirective = nullptr;
329
330 /// True if we have a directive to declare a global as being a weak defined
331 /// symbol that can be hidden (unexported). Defaults to false.
333
334 /// True if we should mark symbols as global instead of weak, for
335 /// weak*/linkonce*, if the symbol has a comdat.
336 /// Defaults to false.
337 bool AvoidWeakIfComdat = false;
338
339 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
340 /// hidden visibility. Defaults to MCSA_Hidden.
342
343 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
344 /// exported visibility. Defaults to MCSA_Exported.
346
347 /// This attribute, if not MCSA_Invalid, is used to declare an undefined
348 /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
350
351 /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
352 /// protected visibility. Defaults to MCSA_Protected
354
355 //===--- Dwarf Emission Directives -----------------------------------===//
356
357 /// True if target supports emission of debugging information. Defaults to
358 /// false.
360
361 /// Exception handling format for the target. Defaults to None.
363
364 /// True if target uses CFI unwind information for other purposes than EH
365 /// (debugging / sanitizers) when `ExceptionsType == ExceptionHandling::None`.
366 bool UsesCFIWithoutEH = false;
367
368 /// Windows exception handling data (.pdata) encoding. Defaults to Invalid.
370
371 /// True if Dwarf2 output generally uses relocations for references to other
372 /// .debug_* sections.
374
375 /// True if DWARF FDE symbol reference relocations should be replaced by an
376 /// absolute difference.
378
379 /// True if DWARF `.file directory' directive syntax is used by
380 /// default.
382
383 /// True if dwarf register numbers are printed instead of symbolic register
384 /// names in .cfi_* directives. Defaults to false.
385 bool DwarfRegNumForCFI = false;
386
387 /// True if target uses @ (expr@specifier) for relocation specifiers.
388 bool UseAtForSpecifier = true;
389
390 /// (ARM-specific) Uses parens for relocation specifier in data
391 /// directives, e.g. .word foo(got).
393
394 /// True if the target supports flags in ".loc" directive, false if only
395 /// location is allowed.
397
398 //===--- Prologue State ----------------------------------------------===//
399
400 std::vector<MCCFIInstruction> InitialFrameState;
401
402 //===--- Integrated Assembler Information ----------------------------===//
403
404 // Generated object files can use all ELF features supported by GNU ld of
405 // this binutils version and later. INT_MAX means all features can be used,
406 // regardless of GNU ld support. The default value is referenced by
407 // clang/Options/Options.td.
408 std::pair<int, int> BinutilsVersion = {2, 26};
409
410 /// Should we use the integrated assembler?
411 /// The integrated assembler should be enabled by default (by the
412 /// constructors) when failing to parse a valid piece of assembly (inline
413 /// or otherwise) is considered a bug. It may then be overridden after
414 /// construction (see CodeGenTargetMachineImpl::initAsmInfo()).
416
417 /// Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
419
420 /// Preserve Comments in assembly
422
423 /// The column (zero-based) at which asm comments should be printed.
424 unsigned CommentColumn = 40;
425
426 /// True if the integrated assembler should interpret 'a >> b' constant
427 /// expressions as logical rather than arithmetic.
428 bool UseLogicalShr = true;
429
430 // If true, use Motorola-style integers in Assembly (ex. $0ac).
432
436
437public:
438 explicit MCAsmInfo();
439 virtual ~MCAsmInfo();
440
441 // Explicitly non-copyable.
442 MCAsmInfo(MCAsmInfo const &) = delete;
443 MCAsmInfo &operator=(MCAsmInfo const &) = delete;
444
445 /// Get the code pointer size in bytes.
446 unsigned getCodePointerSize() const { return CodePointerSize; }
447
448 /// Get the callee-saved register stack slot
449 /// size in bytes.
450 unsigned getCalleeSaveStackSlotSize() const {
452 }
453
454 /// True if the target is little endian.
455 bool isLittleEndian() const { return IsLittleEndian; }
456
457 /// True if target stack grow up.
458 bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
459
461
462 // Data directive accessors.
463
464 const char *getData8bitsDirective() const { return Data8bitsDirective; }
465 const char *getData16bitsDirective() const { return Data16bitsDirective; }
466 const char *getData32bitsDirective() const { return Data32bitsDirective; }
467 const char *getData64bitsDirective() const { return Data64bitsDirective; }
468 bool supportsSignedData() const { return SupportsSignedData; }
469
470 /// Targets can implement this method to specify a section to switch to
471 /// depending on whether the translation unit has any trampolines that require
472 /// an executable stack.
473 virtual MCSection *getStackSection(MCContext &Ctx, bool Exec) const {
474 return nullptr;
475 }
476
477 virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
478 unsigned Encoding,
479 MCStreamer &Streamer) const;
480
481 virtual const MCExpr *getExprForFDESymbol(const MCSymbol *Sym,
482 unsigned Encoding,
483 MCStreamer &Streamer) const;
484
485 /// Return true if C is an acceptable character inside a symbol name.
486 virtual bool isAcceptableChar(char C) const;
487
488 /// Return true if the identifier \p Name does not need quotes to be
489 /// syntactically correct.
490 virtual bool isValidUnquotedName(StringRef Name) const;
491
492 virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
493 const Triple &, raw_ostream &) const {}
494
495 /// Return true if the .section directive should be omitted when
496 /// emitting \p SectionName. For example:
497 ///
498 /// shouldOmitSectionDirective(".text")
499 ///
500 /// returns false => .section .text,#alloc,#execinstr
501 /// returns true => .text
502 virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
503
504 // Return true if a .align directive should use "optimized nops" to fill
505 // instead of 0s.
506 virtual bool useCodeAlign(const MCSection &Sec) const { return false; }
507
511
515
519
520 // Accessors.
521
522 bool isAIX() const { return IsAIX; }
523 bool isHLASM() const { return IsHLASM; }
524 bool isMachO() const { return HasSubsectionsViaSymbols; }
527
528 /// Returns the maximum possible encoded instruction size in bytes. If \p STI
529 /// is null, this should be the maximum size for any subtarget.
530 virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
531 return MaxInstLength;
532 }
533
534 unsigned getMinInstAlignment() const { return MinInstAlignment; }
535 bool getDollarIsPC() const { return DollarIsPC; }
536 const char *getSeparatorString() const { return SeparatorString; }
537
538 unsigned getCommentColumn() const { return CommentColumn; }
539 void setCommentColumn(unsigned Col) { CommentColumn = Col; }
540
543 const char *getLabelSuffix() const { return LabelSuffix; }
544
547 bool needsLocalForSize() const { return NeedsLocalForSize; }
550
552 return !LinkerPrivateGlobalPrefix.empty();
553 }
554
560
561 const char *getInlineAsmStart() const { return InlineAsmStart; }
562 const char *getInlineAsmEnd() const { return InlineAsmEnd; }
563 unsigned getAssemblerDialect() const { return AssemblerDialect; }
564 bool doesAllowAtInName() const { return AllowAtInName; }
565 void setAllowAtInName(bool V) { AllowAtInName = V; }
576
580
582
585
586 const char *getZeroDirective() const { return ZeroDirective; }
587 const char *getAsciiDirective() const { return AsciiDirective; }
588 const char *getAscizDirective() const { return AscizDirective; }
593 unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
594 const char *getGlobalDirective() const { return GlobalDirective; }
595
599
603
607
612 bool hasIdentDirective() const { return HasIdentDirective; }
613 bool hasNoDeadStrip() const { return HasNoDeadStrip; }
614 const char *getWeakDirective() const { return WeakDirective; }
615 const char *getWeakRefDirective() const { return WeakRefDirective; }
616
620
621 bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
622
624
626
630
634
636
639
643
647
648 /// Returns true if the exception handling method for the platform uses call
649 /// frame information to unwind.
655
661
665
668 bool useAtForSpecifier() const { return UseAtForSpecifier; }
673
674 bool usesDwarfFileAndLocDirectives() const { return !IsAIX; }
675
679
680 void addInitialFrameState(const MCCFIInstruction &Inst);
681
682 const std::vector<MCCFIInstruction> &getInitialFrameState() const {
683 return InitialFrameState;
684 }
685
686 void setBinutilsVersion(std::pair<int, int> Value) {
688 }
689
690 /// Return true if assembly (inline or otherwise) should be parsed.
692
693 /// Return true if target want to use AsmParser to parse inlineasm.
697
698 bool binutilsIsAtLeast(int Major, int Minor) const {
699 return BinutilsVersion >= std::make_pair(Major, Minor);
700 }
701
702 /// Set whether assembly (inline or otherwise) should be parsed.
706
707 /// Set whether target want to use AsmParser to parse inlineasm.
711
712 /// Return true if assembly (inline or otherwise) should be parsed.
714
715 /// Set whether assembly (inline or otherwise) should be parsed.
716 virtual void setPreserveAsmComments(bool Value) {
718 }
719
720
721 bool shouldUseLogicalShr() const { return UseLogicalShr; }
722
724
725 StringRef getSpecifierName(uint32_t S) const;
726 std::optional<uint32_t> getSpecifierForName(StringRef Name) const;
727
728 void printExpr(raw_ostream &, const MCExpr &) const;
730 const MCSpecifierExpr &) const {
731 llvm_unreachable("Need to implement hook if target uses MCSpecifierExpr");
732 }
733 virtual bool evaluateAsRelocatableImpl(const MCSpecifierExpr &, MCValue &Res,
734 const MCAssembler *Asm) const;
735};
736
737} // end namespace llvm
738
739#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:548
MCAsmInfo(MCAsmInfo const &)=delete
const char * Data16bitsDirective
Definition MCAsmInfo.h:248
bool hasCOFFAssociativeComdats() const
Definition MCAsmInfo.h:525
bool NeedsDwarfSectionOffsetDirective
Definition MCAsmInfo.h:265
const char * getLabelSuffix() const
Definition MCAsmInfo.h:543
void setAllowAtInName(bool V)
Definition MCAsmInfo.h:565
MCSymbolAttr ExportedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having exported visibility.
Definition MCAsmInfo.h:345
bool preserveAsmComments() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:713
bool supportsSignedData() const
Definition MCAsmInfo.h:468
const char * getInlineAsmStart() const
Definition MCAsmInfo.h:561
bool isHLASM() const
Definition MCAsmInfo.h:523
bool hasDotTypeDotSizeDirective() const
Definition MCAsmInfo.h:610
bool isLittleEndian() const
True if the target is little endian.
Definition MCAsmInfo.h:455
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:321
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:668
unsigned TextAlignFillValue
If non-zero, this is used to fill the executable space created as the result of a alignment directive...
Definition MCAsmInfo.h:277
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:189
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:691
bool UseAtForSpecifier
True if target uses @ (expr@specifier) for relocation specifiers.
Definition MCAsmInfo.h:388
MCSymbolAttr ProtectedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having protected visibility.
Definition MCAsmInfo.h:353
virtual void printSpecifierExpr(raw_ostream &, const MCSpecifierExpr &) const
Definition MCAsmInfo.h:729
bool HasFunctionAlignment
Definition MCAsmInfo.h:302
const char * AsciiDirective
This directive allows emission of an ascii string with the standard C escape characters embedded into...
Definition MCAsmInfo.h:231
std::vector< MCCFIInstruction > InitialFrameState
Definition MCAsmInfo.h:400
llvm::StringMap< uint32_t > NameToAtSpecifier
Definition MCAsmInfo.h:434
MCAsmInfo & operator=(MCAsmInfo const &)=delete
void initializeAtSpecifiers(ArrayRef< AtSpecifier >)
MCSymbolAttr getProtectedVisibilityAttr() const
Definition MCAsmInfo.h:631
bool usesSunStyleELFSectionSwitchSyntax() const
Definition MCAsmInfo.h:508
bool doesAllowDollarAtStartOfIdentifier() const
Definition MCAsmInfo.h:572
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
Definition MCAsmInfo.h:530
unsigned getMinInstAlignment() const
Definition MCAsmInfo.h:534
bool hasLEB128Directives() const
Definition MCAsmInfo.h:581
bool doesSupportDataRegionDirectives() const
Definition MCAsmInfo.h:577
MCSymbolAttr getExportedVisibilityAttr() const
Definition MCAsmInfo.h:625
bool usesSetToEquateSymbol() const
Definition MCAsmInfo.h:545
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition MCAsmInfo.h:101
const char * getData32bitsDirective() const
Definition MCAsmInfo.h:466
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition MCAsmInfo.h:247
const char * Data64bitsDirective
Definition MCAsmInfo.h:250
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition MCAsmInfo.h:682
bool useFullRegisterNames() const
Definition MCAsmInfo.h:583
llvm::DenseMap< uint32_t, StringRef > AtSpecifierToName
Definition MCAsmInfo.h:433
unsigned getAssemblerDialect() const
Definition MCAsmInfo.h:563
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
Definition MCAsmInfo.h:703
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:562
unsigned getTextAlignFillValue() const
Definition MCAsmInfo.h:593
StringRef getLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:555
bool doesAllowAtInName() const
Definition MCAsmInfo.h:564
bool useDwarfRegNumForCFI() const
Definition MCAsmInfo.h:667
bool useAssignmentForEHBegin() const
Definition MCAsmInfo.h:546
bool usesCFIWithoutEH() const
Definition MCAsmInfo.h:644
bool supportsExtendedDwarfLocDirective() const
Definition MCAsmInfo.h:670
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:337
bool NeedsLocalForSize
Definition MCAsmInfo.h:155
StringRef getPrivateLabelPrefix() const
Definition MCAsmInfo.h:549
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition MCAsmInfo.h:362
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:196
bool PreserveAsmComments
Preserve Comments in assembly.
Definition MCAsmInfo.h:421
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:377
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:464
const char * getData64bitsDirective() const
Definition MCAsmInfo.h:467
AsmCharLiteralSyntax characterLiteralSyntax() const
Definition MCAsmInfo.h:589
bool avoidWeakIfComdat() const
Definition MCAsmInfo.h:621
bool isAIX() const
Definition MCAsmInfo.h:522
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:290
const char * Data32bitsDirective
Definition MCAsmInfo.h:249
bool UseIntegratedAssembler
Should we use the integrated assembler?
Definition MCAsmInfo.h:415
bool shouldUseMotorolaIntegers() const
Definition MCAsmInfo.h:723
bool supportsNameQuoting() const
Definition MCAsmInfo.h:575
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:203
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:428
bool UseMotorolaIntegers
Definition MCAsmInfo.h:431
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
Definition MCAsmInfo.h:627
const char * GlobalDirective
This is the directive used to declare a global entity.
Definition MCAsmInfo.h:283
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition MCAsmInfo.h:298
bool hasWeakDefCanBeHiddenDirective() const
Definition MCAsmInfo.h:617
WinEH::EncodingType WinEHEncodingType
Windows exception handling data (.pdata) encoding. Defaults to Invalid.
Definition MCAsmInfo.h:369
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:716
bool hasLinkerPrivateGlobalPrefix() const
Definition MCAsmInfo.h:551
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol.
Definition MCAsmInfo.h:328
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
Definition MCAsmInfo.h:164
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
Definition MCAsmInfo.h:604
bool needsDwarfSectionOffsetDirective() const
Definition MCAsmInfo.h:516
bool shouldUseLogicalShr() const
Definition MCAsmInfo.h:721
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition MCAsmInfo.h:309
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
Definition MCAsmInfo.h:650
bool AllowAtInName
This is true if the assembler allows @ characters in symbol names.
Definition MCAsmInfo.h:182
unsigned CommentColumn
The column (zero-based) at which asm comments should be printed.
Definition MCAsmInfo.h:424
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection, const Triple &, raw_ostream &) const
Definition MCAsmInfo.h:492
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:332
StringRef getCommentString() const
Definition MCAsmInfo.h:541
bool UseParensForSpecifier
(ARM-specific) Uses parens for relocation specifier in data directives, e.g.
Definition MCAsmInfo.h:392
const char * getAscizDirective() const
Definition MCAsmInfo.h:588
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition MCAsmInfo.h:258
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition MCAsmInfo.h:174
bool HasPreferredAlignment
Definition MCAsmInfo.h:305
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:635
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:596
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
Definition MCAsmInfo.h:418
WinEH::EncodingType getWinEHEncodingType() const
Definition MCAsmInfo.h:638
bool doesDwarfUseRelocationsAcrossSections() const
Definition MCAsmInfo.h:662
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:263
virtual void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:708
const char * getZeroDirective() const
Definition MCAsmInfo.h:586
bool EnableDwarfFileDirectoryDefault
True if DWARF ‘.file directory’ directive syntax is used by default.
Definition MCAsmInfo.h:381
StringRef LinkerPrivateGlobalPrefix
This prefix is used for symbols that should be passed through the assembler but be removed by the lin...
Definition MCAsmInfo.h:170
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:359
void setFullRegisterNames(bool V)
Definition MCAsmInfo.h:584
const char * getWeakDirective() const
Definition MCAsmInfo.h:614
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:97
bool hasSubsectionsViaSymbols() const
Definition MCAsmInfo.h:460
bool PPCUseFullRegisterNames
True if full register names are printed.
Definition MCAsmInfo.h:218
const char * InlineAsmEnd
Definition MCAsmInfo.h:175
const char * getData16bitsDirective() const
Definition MCAsmInfo.h:465
const char * getSeparatorString() const
Definition MCAsmInfo.h:536
bool SupportsSignedData
True if data directives support signed values.
Definition MCAsmInfo.h:253
bool doesAllowAtAtStartOfIdentifier() const
Definition MCAsmInfo.h:569
bool getCOMMDirectiveAlignmentIsInBytes() const
Definition MCAsmInfo.h:600
bool isStackGrowthDirectionUp() const
True if target stack grow up.
Definition MCAsmInfo.h:458
virtual bool useCodeAlign(const MCSection &Sec) const
Definition MCAsmInfo.h:506
bool useParensForSpecifier() const
Definition MCAsmInfo.h:669
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition MCAsmInfo.h:178
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:609
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:473
MCSymbolAttr HiddenDeclarationVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare an undefined symbol as having hidden visibili...
Definition MCAsmInfo.h:349
bool shouldAllowAdditionalComments() const
Definition MCAsmInfo.h:542
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
Definition MCAsmInfo.h:450
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when E...
Definition MCAsmInfo.h:366
bool HasIdentDirective
True if the target has a .ident directive, this is true for ELF targets.
Definition MCAsmInfo.h:317
bool isMachO() const
Definition MCAsmInfo.h:524
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections.
Definition MCAsmInfo.h:373
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
Definition MCAsmInfo.h:694
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition MCAsmInfo.h:313
void setBinutilsVersion(std::pair< int, int > Value)
Definition MCAsmInfo.h:686
bool doDwarfFDESymbolsUseAbsDiff() const
Definition MCAsmInfo.h:666
const char * getGlobalDirective() const
Definition MCAsmInfo.h:594
void setExceptionsType(ExceptionHandling EH)
Definition MCAsmInfo.h:640
bool doesAllowQuestionAtStartOfIdentifier() const
Definition MCAsmInfo.h:566
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition MCAsmInfo.h:294
bool getAlignmentIsInBytes() const
Definition MCAsmInfo.h:592
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:273
bool usesWindowsCFI() const
Definition MCAsmInfo.h:656
bool usesELFSectionDirectiveForBSS() const
Definition MCAsmInfo.h:512
AsmCharLiteralSyntax CharacterLiteralSyntax
Form used for character literals in the assembly syntax.
Definition MCAsmInfo.h:241
bool getDollarIsPC() const
Definition MCAsmInfo.h:535
bool SupportsExtendedDwarfLocDirective
True if the target supports flags in ".loc" directive, false if only location is allowed.
Definition MCAsmInfo.h:396
bool binutilsIsAtLeast(int Major, int Minor) const
Definition MCAsmInfo.h:698
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:226
unsigned getCommentColumn() const
Definition MCAsmInfo.h:538
MCSymbolAttr getHiddenVisibilityAttr() const
Definition MCAsmInfo.h:623
bool SupportsQuotedNames
If this is true, symbol names with invalid characters will be printed in quotes.
Definition MCAsmInfo.h:207
bool hasSingleParameterDotFile() const
Definition MCAsmInfo.h:611
const char * AscizDirective
If not null, this allows for special handling of zero terminated strings on this target.
Definition MCAsmInfo.h:236
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives.
Definition MCAsmInfo.h:212
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition MCAsmInfo.h:385
const char * getAsciiDirective() const
Definition MCAsmInfo.h:587
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:408
bool HasLEB128Directives
True if the target supports LEB128 directives.
Definition MCAsmInfo.h:215
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:615
bool hasCOFFComdatConstants() const
Definition MCAsmInfo.h:526
MCSymbolAttr HiddenVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having hidden visibility.
Definition MCAsmInfo.h:341
bool hasNoDeadStrip() const
Definition MCAsmInfo.h:613
ExceptionHandling getExceptionHandlingType() const
Definition MCAsmInfo.h:637
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:135
bool needsLocalForSize() const
Definition MCAsmInfo.h:547
const char * WeakDirective
Used to declare a global as being a weak symbol. Defaults to ".weak".
Definition MCAsmInfo.h:324
void setCommentColumn(unsigned Col)
Definition MCAsmInfo.h:539
bool hasFunctionAlignment() const
Definition MCAsmInfo.h:608
bool enableDwarfFileDirectoryDefault() const
Definition MCAsmInfo.h:676
bool usesDwarfFileAndLocDirectives() const
Definition MCAsmInfo.h:674
bool hasIdentDirective() const
Definition MCAsmInfo.h:612
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition MCAsmInfo.h:446
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:517
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:495
Streaming machine code generation interface.
Definition MCStreamer.h:220
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)