diff options
Diffstat (limited to 'include/llvm/MC/MCAsmInfo.h')
-rw-r--r-- | include/llvm/MC/MCAsmInfo.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h index a750a0fd5cef..0335f3188fc3 100644 --- a/include/llvm/MC/MCAsmInfo.h +++ b/include/llvm/MC/MCAsmInfo.h @@ -18,7 +18,6 @@ #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCDwarf.h" -#include "llvm/MC/MachineLocation.h" #include <cassert> #include <vector> @@ -37,17 +36,17 @@ enum class EncodingType { ARM, /// Windows NT (Windows on ARM) CE, /// Windows CE ARM, PowerPC, SH3, SH4 Itanium, /// Windows x64, Windows Itanium (IA-64) + X86, /// Windows x86, uses no CFI, just EH tables MIPS = Alpha, }; } enum class ExceptionHandling { - None, /// No exception support - DwarfCFI, /// DWARF-like instruction based exceptions - SjLj, /// setjmp/longjmp based exceptions - ARM, /// ARM EHABI - ItaniumWinEH, /// Itanium EH built on Windows unwind info (.pdata and .xdata) - MSVC, /// MSVC compatible exception handling + None, /// No exception support + DwarfCFI, /// DWARF-like instruction based exceptions + SjLj, /// setjmp/longjmp based exceptions + ARM, /// ARM EHABI + WinEH, /// Windows Exception Handling }; namespace LCOMM { @@ -119,6 +118,9 @@ protected: // Print the EH begin symbol with an assignment. Defaults to false. bool UseAssignmentForEHBegin; + // Do we need to create a local symbol for .size? + bool NeedsLocalForSize; + /// This prefix is used for globals like constant pool entries that are /// completely private to the .s file and should not have names in the .o /// file. Defaults to "L" @@ -226,7 +228,7 @@ protected: /// True if the expression /// .long f - g - /// uses an relocation but it can be supressed by writting + /// uses a relocation but it can be suppressed by writing /// a = f - g /// .long a bool SetDirectiveSuppressesReloc; @@ -254,6 +256,10 @@ protected: /// argument and how it is interpreted. Defaults to NoAlignment. LCOMM::LCOMMType LCOMMDirectiveAlignmentType; + // True if the target allows .align directives on functions. This is true for + // most targets, so defaults to true. + bool HasFunctionAlignment; + /// True if the target has .type and .size directives, this is true for most /// ELF targets. Defaults to true. bool HasDotTypeDotSizeDirective; @@ -333,7 +339,7 @@ protected: std::vector<MCCFIInstruction> InitialFrameState; - //===--- Integrated Assembler State ----------------------------------===// + //===--- Integrated Assembler Information ----------------------------===// /// Should we use the integrated assembler? /// The integrated assembler should be enabled by default (by the @@ -345,6 +351,10 @@ protected: /// Compress DWARF debug sections. Defaults to false. bool CompressDebugSections; + /// True if the integrated assembler should interpret 'a >> b' constant + /// expressions as logical rather than arithmetic. + bool UseLogicalShr; + public: explicit MCAsmInfo(); virtual ~MCAsmInfo(); @@ -378,7 +388,7 @@ public: /// Targets can implement this method to specify a section to switch to if the /// translation unit doesn't have any trampolines that require an executable /// stack. - virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const { + virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const { return nullptr; } @@ -428,6 +438,7 @@ public: const char *getLabelSuffix() const { return LabelSuffix; } bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; } + bool needsLocalForSize() const { return NeedsLocalForSize; } const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; } const char *getPrivateLabelPrefix() const { return PrivateLabelPrefix; } bool hasLinkerPrivateGlobalPrefix() const { @@ -464,6 +475,7 @@ public: LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const { return LCOMMDirectiveAlignmentType; } + bool hasFunctionAlignment() const { return HasFunctionAlignment; } bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; } bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; } bool hasIdentDirective() const { return HasIdentDirective; } @@ -490,18 +502,17 @@ public: ExceptionHandling getExceptionHandlingType() const { return ExceptionsType; } WinEH::EncodingType getWinEHEncodingType() const { return WinEHEncodingType; } - /// Return true if the exception handling type uses the language-specific data - /// area (LSDA) format specified by the Itanium C++ ABI. - bool usesItaniumLSDAForExceptions() const { + /// Returns true if the exception handling method for the platform uses call + /// frame information to unwind. + bool usesCFIForEH() const { return (ExceptionsType == ExceptionHandling::DwarfCFI || - ExceptionsType == ExceptionHandling::ARM || - // This Windows EH type uses the Itanium LSDA encoding. - ExceptionsType == ExceptionHandling::ItaniumWinEH); + ExceptionsType == ExceptionHandling::ARM || usesWindowsCFI()); } bool usesWindowsCFI() const { - return ExceptionsType == ExceptionHandling::ItaniumWinEH || - ExceptionsType == ExceptionHandling::MSVC; + return ExceptionsType == ExceptionHandling::WinEH && + (WinEHEncodingType != WinEH::EncodingType::Invalid && + WinEHEncodingType != WinEH::EncodingType::X86); } bool doesDwarfUseRelocationsAcrossSections() const { @@ -532,6 +543,8 @@ public: void setCompressDebugSections(bool CompressDebugSections) { this->CompressDebugSections = CompressDebugSections; } + + bool shouldUseLogicalShr() const { return UseLogicalShr; } }; } |