[llvm] [NFCI][AMDGPU] Use `GET_SUBTARGETINFO_MACRO` in `GCNSubtarget.h` and `R600Subtarget.h` (PR #177402)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 11:58:10 PST 2026


================
@@ -231,22 +183,33 @@ class AMDGPUSubtarget {
 
   bool isGCN() const { return TargetTriple.isAMDGCN(); }
 
-  // Simple subtarget feature getters - auto-generated from X-macro.
-#define DECL_HAS_GETTER(Name)                                                  \
-  bool has##Name() const { return Has##Name; }
-  AMDGPU_SUBTARGET_HAS_FEATURE(DECL_HAS_GETTER)
-#undef DECL_HAS_GETTER
-#undef AMDGPU_SUBTARGET_HAS_FEATURE
+  //==----------------------------------------------------------------------===//
+  // TableGen-generated features.
+  //
+  // We mark all features as disabled by default and they will be overridden
+  // by the subtarget features in the target-specific subtarget class. Since
+  // there is overlap between AMDGPUGenSubtargetInfo.inc and
+  // R600GenSubtargetInfo.inc, we can't simply just include both files.
+  // Therefore, we add those virtual functions dedicated for R600Subtarget here.
+  //==----------------------------------------------------------------------===//
+  virtual bool hasCFALUBug() const { return false; }
+  virtual bool hasCaymanISA() const { return false; }
+  virtual bool hasVertexCache() const { return false; }
+  virtual bool hasR600ALUInst() const { return false; }
----------------
shiltian wrote:

They have to be here, because when we include the TableGen file in R600Subtarget, all of the attribute getters are virtual function overriding, so they have to be in the parent class, as mentioned in the comment above.

https://github.com/llvm/llvm-project/pull/177402


More information about the llvm-commits mailing list