diff --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst --- a/llvm/docs/WritingAnLLVMBackend.rst +++ b/llvm/docs/WritingAnLLVMBackend.rst @@ -1785,7 +1785,7 @@ def FeatureV9 : SubtargetFeature<"v9", "IsV9", "true", "Enable SPARC-V9 instructions">; def FeatureV8Deprecated : SubtargetFeature<"deprecated-v8", - "V8DeprecatedInsts", "true", + "UseV8DeprecatedInsts", "true", "Enable deprecated V8 instructions in V9 mode">; def FeatureVIS : SubtargetFeature<"vis", "IsVIS", "true", "Enable UltraSPARC Visual Instruction Set extensions">; diff --git a/llvm/lib/Target/Sparc/Sparc.td b/llvm/lib/Target/Sparc/Sparc.td --- a/llvm/lib/Target/Sparc/Sparc.td +++ b/llvm/lib/Target/Sparc/Sparc.td @@ -34,7 +34,7 @@ : SubtargetFeature<"v9", "IsV9", "true", "Enable SPARC-V9 instructions">; def FeatureV8Deprecated - : SubtargetFeature<"deprecated-v8", "V8DeprecatedInsts", "true", + : SubtargetFeature<"deprecated-v8", "UseV8DeprecatedInsts", "true", "Enable deprecated V8 instructions in V9 mode">; def FeatureVIS : SubtargetFeature<"vis", "IsVIS", "true", diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.td b/llvm/lib/Target/Sparc/SparcInstrInfo.td --- a/llvm/lib/Target/Sparc/SparcInstrInfo.td +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td @@ -72,7 +72,7 @@ // V8, or when it is V9 but the V8 deprecated instructions are efficient enough // to use when appropriate. In either of these cases, the instruction selector // will pick deprecated instructions. -def UseDeprecatedInsts : Predicate<"Subtarget->useDeprecatedV8Instructions()">; +def UseDeprecatedInsts : Predicate<"Subtarget->useV8DeprecatedInsts()">; //===----------------------------------------------------------------------===// // Instruction Pattern Stuff diff --git a/llvm/lib/Target/Sparc/SparcSubtarget.h b/llvm/lib/Target/Sparc/SparcSubtarget.h --- a/llvm/lib/Target/Sparc/SparcSubtarget.h +++ b/llvm/lib/Target/Sparc/SparcSubtarget.h @@ -31,26 +31,12 @@ class SparcSubtarget : public SparcGenSubtargetInfo { Triple TargetTriple; virtual void anchor(); - bool UseSoftMulDiv; - bool IsV9; - bool IsLeon; - bool V8DeprecatedInsts; - bool IsVIS, IsVIS2, IsVIS3; + bool Is64Bit; - bool HasHardQuad; - bool UsePopc; - bool UseSoftFloat; - bool HasNoFSMULD; - bool HasNoFMULS; - - // LEON features - bool HasUmacSmac; - bool HasLeonCasa; - bool HasPWRPSR; - bool InsertNOPLoad; - bool FixAllFDIVSQRT; - bool DetectRoundChange; - bool HasLeonCycleCounter; + +#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \ + bool ATTRIBUTE = DEFAULT; +#include "SparcGenSubtargetInfo.inc" SparcInstrInfo InstrInfo; SparcTargetLowering TLInfo; @@ -77,27 +63,9 @@ bool enableMachineScheduler() const override; - bool useSoftMulDiv() const { return UseSoftMulDiv; } - bool isV9() const { return IsV9; } - bool isLeon() const { return IsLeon; } - bool isVIS() const { return IsVIS; } - bool isVIS2() const { return IsVIS2; } - bool isVIS3() const { return IsVIS3; } - bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; } - bool hasHardQuad() const { return HasHardQuad; } - bool usePopc() const { return UsePopc; } - bool useSoftFloat() const { return UseSoftFloat; } - bool hasNoFSMULD() const { return HasNoFSMULD; } - bool hasNoFMULS() const { return HasNoFMULS; } - - // Leon options - bool hasUmacSmac() const { return HasUmacSmac; } - bool hasLeonCasa() const { return HasLeonCasa; } - bool hasPWRPSR() const { return HasPWRPSR; } - bool insertNOPLoad() const { return InsertNOPLoad; } - bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; } - bool detectRoundChange() const { return DetectRoundChange; } - bool hasLeonCycleCounter() const { return HasLeonCycleCounter; } +#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \ + bool GETTER() const { return ATTRIBUTE; } +#include "SparcGenSubtargetInfo.inc" /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/llvm/lib/Target/Sparc/SparcSubtarget.cpp b/llvm/lib/Target/Sparc/SparcSubtarget.cpp --- a/llvm/lib/Target/Sparc/SparcSubtarget.cpp +++ b/llvm/lib/Target/Sparc/SparcSubtarget.cpp @@ -27,28 +27,6 @@ SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { - UseSoftMulDiv = false; - IsV9 = false; - IsLeon = false; - V8DeprecatedInsts = false; - IsVIS = false; - IsVIS2 = false; - IsVIS3 = false; - HasHardQuad = false; - UsePopc = false; - UseSoftFloat = false; - HasNoFSMULD = false; - HasNoFMULS = false; - - // Leon features - HasLeonCasa = false; - HasUmacSmac = false; - HasPWRPSR = false; - InsertNOPLoad = false; - FixAllFDIVSQRT = false; - DetectRoundChange = false; - HasLeonCycleCounter = false; - // Determine default and user specified characteristics std::string CPUName = std::string(CPU); if (CPUName.empty())