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