[llvm] d3b9d8b - [Sparc] Make use of GET_SUBTARGETINFO_MACRO (NFC)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 17:54:34 PDT 2023


Author: Sergei Barannikov
Date: 2023-05-17T03:54:23+03:00
New Revision: d3b9d8b28f8e9fde41a4136c28f458347d9bb292

URL: https://github.com/llvm/llvm-project/commit/d3b9d8b28f8e9fde41a4136c28f458347d9bb292
DIFF: https://github.com/llvm/llvm-project/commit/d3b9d8b28f8e9fde41a4136c28f458347d9bb292.diff

LOG: [Sparc] Make use of GET_SUBTARGETINFO_MACRO (NFC)

Reviewed By: koakuma

Differential Revision: https://reviews.llvm.org/D150512

Added: 
    

Modified: 
    llvm/docs/WritingAnLLVMBackend.rst
    llvm/lib/Target/Sparc/Sparc.td
    llvm/lib/Target/Sparc/SparcInstrInfo.td
    llvm/lib/Target/Sparc/SparcSubtarget.cpp
    llvm/lib/Target/Sparc/SparcSubtarget.h

Removed: 
    


################################################################################
diff  --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst
index ce7f4bddd10d2..88641816d0ef1 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 da95602309a1e..4cc713abe0462 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 a55b7c3f5f18b..3d602e7e43766 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 618a8633f0a9d..81c2137ea730f 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 f47418240d695..8e3d05d5d7e5d 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 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
 
   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.


        


More information about the llvm-commits mailing list