[llvm] 4c3357a - [SystemZ][NFC] Simplify SystemZSubtarget

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 13:33:59 PST 2022


Author: Kai Nacke
Date: 2022-12-09T21:33:35Z
New Revision: 4c3357ad56a0f5f85dfcadc83f719b09954d43fa

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

LOG: [SystemZ][NFC] Simplify SystemZSubtarget

The flags, initialization of the flags, and the getter methods for
features defined in SystemZFeatures.td can be generated by TableGen.

Reviewed By: uweigand

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

Added: 
    

Modified: 
    llvm/lib/Target/SystemZ/SystemZSubtarget.cpp
    llvm/lib/Target/SystemZ/SystemZSubtarget.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp
index f6889035b654c..25b013ba1876b 100644
--- a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp
@@ -68,27 +68,7 @@ SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
                                    const std::string &TuneCPU,
                                    const std::string &FS,
                                    const TargetMachine &TM)
-    : SystemZGenSubtargetInfo(TT, CPU, TuneCPU, FS),
-      HasDistinctOps(false), HasLoadStoreOnCond(false), HasHighWord(false),
-      HasFPExtension(false), HasPopulationCount(false),
-      HasMessageSecurityAssist3(false), HasMessageSecurityAssist4(false),
-      HasResetReferenceBitsMultiple(false), HasFastSerialization(false),
-      HasInterlockedAccess1(false), HasMiscellaneousExtensions(false),
-      HasExecutionHint(false), HasLoadAndTrap(false),
-      HasTransactionalExecution(false), HasProcessorAssist(false),
-      HasDFPZonedConversion(false), HasEnhancedDAT2(false), HasVector(false),
-      HasLoadStoreOnCond2(false), HasLoadAndZeroRightmostByte(false),
-      HasMessageSecurityAssist5(false), HasDFPPackedConversion(false),
-      HasMiscellaneousExtensions2(false), HasGuardedStorage(false),
-      HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false),
-      HasVectorEnhancements1(false), HasVectorPackedDecimal(false),
-      HasInsertReferenceBitsMultiple(false), HasMiscellaneousExtensions3(false),
-      HasMessageSecurityAssist9(false), HasVectorEnhancements2(false),
-      HasVectorPackedDecimalEnhancement(false), HasEnhancedSort(false),
-      HasDeflateConversion(false), HasVectorPackedDecimalEnhancement2(false),
-      HasNNPAssist(false), HasBEAREnhancement(false),
-      HasResetDATProtection(false), HasProcessorActivityInstrumentation(false),
-      HasSoftFloat(false), TargetTriple(TT),
+    : SystemZGenSubtargetInfo(TT, CPU, TuneCPU, FS), TargetTriple(TT),
       SpecialRegisters(initializeSpecialRegisters()),
       InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),
       TLInfo(TM, *this), FrameLowering(SystemZFrameLowering::create(*this)) {}

diff  --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.h b/llvm/lib/Target/SystemZ/SystemZSubtarget.h
index cd16c19f9bfa4..9d4c1f0fe7105 100644
--- a/llvm/lib/Target/SystemZ/SystemZSubtarget.h
+++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.h
@@ -33,47 +33,10 @@ class StringRef;
 class SystemZSubtarget : public SystemZGenSubtargetInfo {
   virtual void anchor();
 protected:
-  bool HasDistinctOps;
-  bool HasLoadStoreOnCond;
-  bool HasHighWord;
-  bool HasFPExtension;
-  bool HasPopulationCount;
-  bool HasMessageSecurityAssist3;
-  bool HasMessageSecurityAssist4;
-  bool HasResetReferenceBitsMultiple;
-  bool HasFastSerialization;
-  bool HasInterlockedAccess1;
-  bool HasMiscellaneousExtensions;
-  bool HasExecutionHint;
-  bool HasLoadAndTrap;
-  bool HasTransactionalExecution;
-  bool HasProcessorAssist;
-  bool HasDFPZonedConversion;
-  bool HasEnhancedDAT2;
-  bool HasVector;
-  bool HasLoadStoreOnCond2;
-  bool HasLoadAndZeroRightmostByte;
-  bool HasMessageSecurityAssist5;
-  bool HasDFPPackedConversion;
-  bool HasMiscellaneousExtensions2;
-  bool HasGuardedStorage;
-  bool HasMessageSecurityAssist7;
-  bool HasMessageSecurityAssist8;
-  bool HasVectorEnhancements1;
-  bool HasVectorPackedDecimal;
-  bool HasInsertReferenceBitsMultiple;
-  bool HasMiscellaneousExtensions3;
-  bool HasMessageSecurityAssist9;
-  bool HasVectorEnhancements2;
-  bool HasVectorPackedDecimalEnhancement;
-  bool HasEnhancedSort;
-  bool HasDeflateConversion;
-  bool HasVectorPackedDecimalEnhancement2;
-  bool HasNNPAssist;
-  bool HasBEAREnhancement;
-  bool HasResetDATProtection;
-  bool HasProcessorActivityInstrumentation;
-  bool HasSoftFloat;
+// Bool members corresponding to the SubtargetFeatures defined in tablegen.
+#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER)                    \
+  bool ATTRIBUTE = DEFAULT;
+#include "SystemZGenSubtargetInfo.inc"
 
 private:
   Triple TargetTriple;
@@ -138,155 +101,10 @@ class SystemZSubtarget : public SystemZGenSubtargetInfo {
   // Automatically generated by tblgen.
   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
 
-  // Return true if the target has the distinct-operands facility.
-  bool hasDistinctOps() const { return HasDistinctOps; }
-
-  // Return true if the target has the load/store-on-condition facility.
-  bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
-
-  // Return true if the target has the load/store-on-condition facility 2.
-  bool hasLoadStoreOnCond2() const { return HasLoadStoreOnCond2; }
-
-  // Return true if the target has the high-word facility.
-  bool hasHighWord() const { return HasHighWord; }
-
-  // Return true if the target has the floating-point extension facility.
-  bool hasFPExtension() const { return HasFPExtension; }
-
-  // Return true if the target has the population-count facility.
-  bool hasPopulationCount() const { return HasPopulationCount; }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 3.
-  bool hasMessageSecurityAssist3() const { return HasMessageSecurityAssist3; }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 4.
-  bool hasMessageSecurityAssist4() const { return HasMessageSecurityAssist4; }
-
-  // Return true if the target has the reset-reference-bits-multiple facility.
-  bool hasResetReferenceBitsMultiple() const {
-    return HasResetReferenceBitsMultiple;
-  }
-
-  // Return true if the target has the fast-serialization facility.
-  bool hasFastSerialization() const { return HasFastSerialization; }
-
-  // Return true if the target has interlocked-access facility 1.
-  bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
-
-  // Return true if the target has the miscellaneous-extensions facility.
-  bool hasMiscellaneousExtensions() const {
-    return HasMiscellaneousExtensions;
-  }
-
-  // Return true if the target has the execution-hint facility.
-  bool hasExecutionHint() const { return HasExecutionHint; }
-
-  // Return true if the target has the load-and-trap facility.
-  bool hasLoadAndTrap() const { return HasLoadAndTrap; }
-
-  // Return true if the target has the transactional-execution facility.
-  bool hasTransactionalExecution() const { return HasTransactionalExecution; }
-
-  // Return true if the target has the processor-assist facility.
-  bool hasProcessorAssist() const { return HasProcessorAssist; }
-
-  // Return true if the target has the DFP zoned-conversion facility.
-  bool hasDFPZonedConversion() const { return HasDFPZonedConversion; }
-
-  // Return true if the target has the enhanced-DAT facility 2.
-  bool hasEnhancedDAT2() const { return HasEnhancedDAT2; }
-
-  // Return true if the target has the load-and-zero-rightmost-byte facility.
-  bool hasLoadAndZeroRightmostByte() const {
-    return HasLoadAndZeroRightmostByte;
-  }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 5.
-  bool hasMessageSecurityAssist5() const { return HasMessageSecurityAssist5; }
-
-  // Return true if the target has the DFP packed-conversion facility.
-  bool hasDFPPackedConversion() const { return HasDFPPackedConversion; }
-
-  // Return true if the target has the vector facility.
-  bool hasVector() const { return HasVector; }
-
-  // Return true if the target has the miscellaneous-extensions facility 2.
-  bool hasMiscellaneousExtensions2() const {
-    return HasMiscellaneousExtensions2;
-  }
-
-  // Return true if the target has the guarded-storage facility.
-  bool hasGuardedStorage() const { return HasGuardedStorage; }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 7.
-  bool hasMessageSecurityAssist7() const { return HasMessageSecurityAssist7; }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 8.
-  bool hasMessageSecurityAssist8() const { return HasMessageSecurityAssist8; }
-
-  // Return true if the target has the vector-enhancements facility 1.
-  bool hasVectorEnhancements1() const { return HasVectorEnhancements1; }
-
-  // Return true if the target has the vector-packed-decimal facility.
-  bool hasVectorPackedDecimal() const { return HasVectorPackedDecimal; }
-
-  // Return true if the target has the insert-reference-bits-multiple facility.
-  bool hasInsertReferenceBitsMultiple() const {
-    return HasInsertReferenceBitsMultiple;
-  }
-
-  // Return true if the target has the miscellaneous-extensions facility 3.
-  bool hasMiscellaneousExtensions3() const {
-    return HasMiscellaneousExtensions3;
-  }
-
-  // Return true if the target has the message-security-assist
-  // extension facility 9.
-  bool hasMessageSecurityAssist9() const { return HasMessageSecurityAssist9; }
-
-  // Return true if the target has the vector-enhancements facility 2.
-  bool hasVectorEnhancements2() const { return HasVectorEnhancements2; }
-
-  // Return true if the target has the vector-packed-decimal
-  // enhancement facility.
-  bool hasVectorPackedDecimalEnhancement() const {
-    return HasVectorPackedDecimalEnhancement;
-  }
-
-  // Return true if the target has the enhanced-sort facility.
-  bool hasEnhancedSort() const { return HasEnhancedSort; }
-
-  // Return true if the target has the deflate-conversion facility.
-  bool hasDeflateConversion() const { return HasDeflateConversion; }
-
-  // Return true if the target has the vector-packed-decimal
-  // enhancement facility 2.
-  bool hasVectorPackedDecimalEnhancement2() const {
-    return HasVectorPackedDecimalEnhancement2;
-  }
-
-  // Return true if the target has the NNP-assist facility.
-  bool hasNNPAssist() const { return HasNNPAssist; }
-
-  // Return true if the target has the BEAR-enhancement facility.
-  bool hasBEAREnhancement() const { return HasBEAREnhancement; }
-
-  // Return true if the target has the reset-DAT-protection facility.
-  bool hasResetDATProtection() const { return HasResetDATProtection; }
-
-  // Return true if the target has the processor-activity-instrumentation
-  // facility.
-  bool hasProcessorActivityInstrumentation() const {
-    return HasProcessorActivityInstrumentation;
-  }
-
-  // Return true if soft float should be used.
-  bool hasSoftFloat() const { return HasSoftFloat; }
+// Getters for SubtargetFeatures defined in tablegen.
+#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER)                    \
+  bool GETTER() const { return ATTRIBUTE; }
+#include "SystemZGenSubtargetInfo.inc"
 
   // Return true if GV can be accessed using LARL for reloc model RM
   // and code model CM.


        


More information about the llvm-commits mailing list