From d3b9d8b28f8e9fde41a4136c28f458347d9bb292 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Sat, 13 May 2023 22:44:56 +0300 Subject: [PATCH] [Sparc] Make use of GET_SUBTARGETINFO_MACRO (NFC) Reviewed By: koakuma Differential Revision: https://reviews.llvm.org/D150512 --- llvm/docs/WritingAnLLVMBackend.rst | 2 +- llvm/lib/Target/Sparc/Sparc.td | 2 +- llvm/lib/Target/Sparc/SparcInstrInfo.td | 2 +- llvm/lib/Target/Sparc/SparcSubtarget.cpp | 22 --------------- llvm/lib/Target/Sparc/SparcSubtarget.h | 48 ++++++-------------------------- 5 files changed, 11 insertions(+), 65 deletions(-) diff --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst index ce7f4bd..8864181 100644 --- a/llvm/docs/WritingAnLLVMBackend.rst +++ b/llvm/docs/WritingAnLLVMBackend.rst @@ -1785,7 +1785,7 @@ following features. 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 index da95602..4cc713a 100644 --- a/llvm/lib/Target/Sparc/Sparc.td +++ b/llvm/lib/Target/Sparc/Sparc.td @@ -34,7 +34,7 @@ def FeatureV9 : 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 index a55b7c3..3d602e7 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.td +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.td @@ -72,7 +72,7 @@ def HasFSMULD : Predicate<"!Subtarget->hasNoFSMULD()">; // 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.cpp b/llvm/lib/Target/Sparc/SparcSubtarget.cpp index 618a863..81c2137 100644 --- a/llvm/lib/Target/Sparc/SparcSubtarget.cpp +++ b/llvm/lib/Target/Sparc/SparcSubtarget.cpp @@ -27,28 +27,6 @@ void SparcSubtarget::anchor() { } 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()) diff --git a/llvm/lib/Target/Sparc/SparcSubtarget.h b/llvm/lib/Target/Sparc/SparcSubtarget.h index f474182..8e3d05d 100644 --- a/llvm/lib/Target/Sparc/SparcSubtarget.h +++ b/llvm/lib/Target/Sparc/SparcSubtarget.h @@ -31,26 +31,12 @@ class StringRef; 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 @@ public: 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. -- 2.7.4