[Sparc] Make use of GET_SUBTARGETINFO_MACRO (NFC)
authorSergei Barannikov <barannikov88@gmail.com>
Sat, 13 May 2023 19:44:56 +0000 (22:44 +0300)
committerSergei Barannikov <barannikov88@gmail.com>
Wed, 17 May 2023 00:54:23 +0000 (03:54 +0300)
Reviewed By: koakuma

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

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

index ce7f4bd..8864181 100644 (file)
@@ -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">;
index da95602..4cc713a 100644 (file)
@@ -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",
index a55b7c3..3d602e7 100644 (file)
@@ -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
index 618a863..81c2137 100644 (file)
@@ -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())
index f474182..8e3d05d 100644 (file)
@@ -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.