[clang] [llvm] AMDGPU: Handle more TargetParser queries in tablegen (PR #212357)

Chinmay Deshpande via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 29 09:27:59 PDT 2026


================
@@ -29,11 +29,14 @@ static void emitGPUKindEnum(raw_ostream &OS, StringRef Name) {
     OS << ((C == '-') ? '_' : toUpper(C));
 }
 
-// Derive the Triple::SubArchType from an AMDGPU processor name, e.g. "gfx90a"
-// -> Triple::AMDGPUSubArch90A. A generic target uses its family's major
-// subarch, e.g. "gfx9-generic" -> Triple::AMDGPUSubArch9.
-static void emitSubArch(raw_ostream &OS, StringRef Name) {
-  StringRef Suffix = Name;
+/// Derive the Triple::SubArchType for a canonical GPU record.
+static void emitSubArch(raw_ostream &OS, const Record *Rec) {
+  if (Rec->getValueAsBit("IsPseudoTarget")) {
+    OS << "Triple::NoSubArch";
----------------
chinmaydd wrote:

Returning `NoSubArch` here makes `isCPUValidForSubArch` accept these CPUs with every explicit subarch, because `isSubArchCompatible` treats `NoSubArch` as a wildcard.

Could we also add typed and untyped triple tests for both pseudo CPUs?

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


More information about the cfe-commits mailing list