15#ifndef LLVM_MC_MCASMINFO_H
16#define LLVM_MC_MCASMINFO_H
30class MCCFIInstruction;
87 unsigned CodePointerSize = 4;
91 unsigned CalleeSaveStackSlotSize = 4;
94 bool IsLittleEndian =
true;
97 bool StackGrowsUp =
false;
101 bool HasSubsectionsViaSymbols =
false;
106 bool HasCOFFAssociativeComdats =
false;
110 bool HasCOFFComdatConstants =
false;
115 bool IsHLASM =
false;
119 unsigned MaxInstLength = 4;
123 unsigned MinInstAlignment = 1;
127 bool DollarIsPC =
false;
143 bool AllowAdditionalComments =
true;
149 bool UsesSetToEquateSymbol =
false;
152 bool UseAssignmentForEHBegin =
false;
155 bool NeedsLocalForSize =
false;
178 unsigned AssemblerDialect = 0;
182 bool AllowAtInName =
false;
189 bool AllowQuestionAtStartOfIdentifier =
false;
196 bool AllowDollarAtStartOfIdentifier =
false;
203 bool AllowAtAtStartOfIdentifier =
false;
207 bool SupportsQuotedNames =
true;
212 bool UseDataRegionDirectives =
false;
215 bool HasLEB128Directives =
true;
218 bool PPCUseFullRegisterNames =
false;
253 bool SupportsSignedData =
true;
258 bool SunStyleELFSectionSwitchSyntax =
false;
263 bool UsesELFSectionDirectiveForBSS =
false;
265 bool NeedsDwarfSectionOffsetDirective =
false;
273 bool AlignmentIsInBytes =
true;
277 unsigned TextAlignFillValue = 0;
290 bool SetDirectiveSuppressesReloc =
false;
294 bool COMMDirectiveAlignmentIsInBytes =
true;
302 bool HasFunctionAlignment =
true;
306 bool HasDotTypeDotSizeDirective =
true;
310 bool HasSingleParameterDotFile =
true;
314 bool HasIdentDirective =
false;
318 bool HasNoDeadStrip =
false;
325 const char *WeakRefDirective =
nullptr;
329 bool HasWeakDefCanBeHiddenDirective =
false;
334 bool AvoidWeakIfComdat =
false;
356 bool SupportsDebugInformation =
false;
363 bool UsesCFIWithoutEH =
false;
370 bool DwarfUsesRelocationsAcrossSections =
true;
374 bool DwarfFDESymbolsUseAbsDiff =
false;
378 bool EnableDwarfFileDirectoryDefault =
true;
382 bool DwarfRegNumForCFI =
false;
385 bool UseAtForSpecifier =
true;
389 bool UseParensForSpecifier =
false;
393 bool SupportsExtendedDwarfLocDirective =
true;
405 std::pair<int, int> BinutilsVersion = {2, 26};
421 unsigned CommentColumn = 40;
425 bool UseLogicalShr =
true;
428 bool UseMotorolaIntegers =
false;
448 return CalleeSaveStackSlotSize;
483 virtual bool isAcceptableChar(
char C)
const;
506 return SunStyleELFSectionSwitchSyntax;
510 return UsesELFSectionDirectiveForBSS;
514 return NeedsDwarfSectionOffsetDirective;
519 bool isAIX()
const {
return IsAIX; }
521 bool isMachO()
const {
return HasSubsectionsViaSymbols; }
528 return MaxInstLength;
549 return !LinkerPrivateGlobalPrefix.
empty();
553 if (hasLinkerPrivateGlobalPrefix())
554 return LinkerPrivateGlobalPrefix;
555 return getPrivateGlobalPrefix();
564 return AllowQuestionAtStartOfIdentifier;
567 return AllowAtAtStartOfIdentifier;
570 return AllowDollarAtStartOfIdentifier;
575 return UseDataRegionDirectives;
587 return CharacterLiteralSyntax;
594 return SetDirectiveSuppressesReloc;
598 return COMMDirectiveAlignmentIsInBytes;
602 return LCOMMDirectiveAlignmentType;
614 return HasWeakDefCanBeHiddenDirective;
624 return HiddenDeclarationVisibilityAttr;
628 return ProtectedVisibilityAttr;
641 return ExceptionsType == ExceptionHandling::None && UsesCFIWithoutEH;
647 return (ExceptionsType == ExceptionHandling::DwarfCFI ||
648 ExceptionsType == ExceptionHandling::ARM ||
649 ExceptionsType == ExceptionHandling::ZOS || usesWindowsCFI());
653 return ExceptionsType == ExceptionHandling::WinEH &&
654 (WinEHEncodingType != WinEH::EncodingType::Invalid &&
655 WinEHEncodingType != WinEH::EncodingType::X86);
659 return DwarfUsesRelocationsAcrossSections;
667 return SupportsExtendedDwarfLocDirective;
673 return EnableDwarfFileDirectoryDefault;
679 return InitialFrameState;
683 BinutilsVersion =
Value;
691 return ParseInlineAsmUsingAsmParser;
695 return BinutilsVersion >= std::make_pair(Major, Minor);
700 UseIntegratedAssembler =
Value;
705 ParseInlineAsmUsingAsmParser =
Value;
713 PreserveAsmComments =
Value;
722 std::optional<uint32_t> getSpecifierForName(
StringRef Name)
const;
This file defines the StringMap class.
static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, raw_ostream &OS)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file defines the DenseMap class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class is intended to be used as a base class for asm properties and features specific to the tar...
StringRef getPrivateGlobalPrefix() const
MCAsmInfo(MCAsmInfo const &)=delete
const char * Data16bitsDirective
bool hasCOFFAssociativeComdats() const
const char * getLabelSuffix() const
void setAllowAtInName(bool V)
bool preserveAsmComments() const
Return true if assembly (inline or otherwise) should be parsed.
bool supportsSignedData() const
const char * getInlineAsmStart() const
bool hasDotTypeDotSizeDirective() const
bool isLittleEndian() const
True if the target is little endian.
bool useAtForSpecifier() const
bool useIntegratedAssembler() const
Return true if assembly (inline or otherwise) should be parsed.
virtual void printSpecifierExpr(raw_ostream &, const MCSpecifierExpr &) const
const char * AsciiDirective
This directive allows emission of an ascii string with the standard C escape characters embedded into...
std::vector< MCCFIInstruction > InitialFrameState
llvm::StringMap< uint32_t > NameToAtSpecifier
MCAsmInfo & operator=(MCAsmInfo const &)=delete
MCSymbolAttr getProtectedVisibilityAttr() const
bool usesSunStyleELFSectionSwitchSyntax() const
bool doesAllowDollarAtStartOfIdentifier() const
virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI=nullptr) const
Returns the maximum possible encoded instruction size in bytes.
unsigned getMinInstAlignment() const
bool hasLEB128Directives() const
bool doesSupportDataRegionDirectives() const
MCSymbolAttr getExportedVisibilityAttr() const
bool usesSetToEquateSymbol() const
const char * getData32bitsDirective() const
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
const char * Data64bitsDirective
const std::vector< MCCFIInstruction > & getInitialFrameState() const
bool useFullRegisterNames() const
llvm::DenseMap< uint32_t, StringRef > AtSpecifierToName
unsigned getAssemblerDialect() const
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
const char * getInlineAsmEnd() const
unsigned getTextAlignFillValue() const
StringRef getLinkerPrivateGlobalPrefix() const
bool doesAllowAtInName() const
bool useDwarfRegNumForCFI() const
bool useAssignmentForEHBegin() const
bool usesCFIWithoutEH() const
bool supportsExtendedDwarfLocDirective() const
StringRef getPrivateLabelPrefix() const
bool PreserveAsmComments
Preserve Comments in assembly.
const char * LabelSuffix
This is appended to emitted labels. Defaults to ":".
StringRef PrivateGlobalPrefix
This prefix is used for globals like constant pool entries that are completely private to the ....
const char * getData8bitsDirective() const
const char * getData64bitsDirective() const
AsmCharLiteralSyntax characterLiteralSyntax() const
bool avoidWeakIfComdat() const
const char * Data32bitsDirective
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
bool shouldUseMotorolaIntegers() const
bool supportsNameQuoting() const
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const
const char * GlobalDirective
This is the directive used to declare a global entity.
bool hasWeakDefCanBeHiddenDirective() const
virtual void setPreserveAsmComments(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
bool hasLinkerPrivateGlobalPrefix() const
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
bool needsDwarfSectionOffsetDirective() const
bool shouldUseLogicalShr() const
bool usesCFIForEH() const
Returns true if the exception handling method for the platform uses call frame information to unwind.
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection, const Triple &, raw_ostream &) const
StringRef getCommentString() const
const char * getAscizDirective() const
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
bool doesSupportDebugInformation() const
bool doesSetDirectiveSuppressReloc() const
bool ParseInlineAsmUsingAsmParser
Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
WinEH::EncodingType getWinEHEncodingType() const
bool doesDwarfUseRelocationsAcrossSections() const
virtual void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
const char * getZeroDirective() const
StringRef LinkerPrivateGlobalPrefix
This prefix is used for symbols that should be passed through the assembler but be removed by the lin...
void setFullRegisterNames(bool V)
const char * getWeakDirective() const
bool hasSubsectionsViaSymbols() const
const char * InlineAsmEnd
const char * getData16bitsDirective() const
const char * getSeparatorString() const
bool doesAllowAtAtStartOfIdentifier() const
bool getCOMMDirectiveAlignmentIsInBytes() const
bool isStackGrowthDirectionUp() const
True if target stack grow up.
virtual bool useCodeAlign(const MCSection &Sec) const
bool useParensForSpecifier() const
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
bool shouldAllowAdditionalComments() const
unsigned getCalleeSaveStackSlotSize() const
Get the callee-saved register stack slot size in bytes.
bool parseInlineAsmUsingAsmParser() const
Return true if target want to use AsmParser to parse inlineasm.
void setBinutilsVersion(std::pair< int, int > Value)
bool doDwarfFDESymbolsUseAbsDiff() const
const char * getGlobalDirective() const
void setExceptionsType(ExceptionHandling EH)
bool doesAllowQuestionAtStartOfIdentifier() const
bool getAlignmentIsInBytes() const
bool usesWindowsCFI() const
bool usesELFSectionDirectiveForBSS() const
bool getDollarIsPC() const
bool binutilsIsAtLeast(int Major, int Minor) const
const char * ZeroDirective
This should be set to the directive used to get some number of zero (and non-zero if supported by the...
unsigned getCommentColumn() const
MCSymbolAttr getHiddenVisibilityAttr() const
bool hasSingleParameterDotFile() const
const char * AscizDirective
If not null, this allows for special handling of zero terminated strings on this target.
const char * getAsciiDirective() const
AsmCharLiteralSyntax
Assembly character literal syntax types.
@ ACLS_SingleQuotePrefix
Unknown; character literals not used by LLVM for this target.
const char * getWeakRefDirective() const
bool hasCOFFComdatConstants() const
bool hasNoDeadStrip() const
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...
ExceptionHandling getExceptionHandlingType() const
StringRef CommentString
This indicates the comment string used by the assembler.
bool needsLocalForSize() const
const char * WeakDirective
Used to declare a global as being a weak symbol. Defaults to ".weak".
void setCommentColumn(unsigned Col)
bool hasFunctionAlignment() const
bool enableDwarfFileDirectoryDefault() const
bool usesDwarfFileAndLocDirectives() const
bool hasIdentDirective() const
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Streaming machine code generation interface.
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ MIPS
Windows x86, uses no CFI, just EH tables.
@ Itanium
Windows CE ARM, PowerPC, SH3, SH4.
@ CE
Windows NT (Windows on ARM)
@ X86
Windows x64, Windows Itanium (IA-64)
This is an optimization pass for GlobalISel generic memory operations.
@ WinEH
Windows Exception Handling.
@ MCSA_Protected
.protected (ELF)
@ MCSA_Exported
.globl _foo, exported (XCOFF)
@ MCSA_Hidden
.hidden (ELF)