================
@@ -34,9 +34,159 @@ StringRef llvm::AMDGPU::getArchFamilyNameAMDGCN(GPUKind AK) 
{
   return ArchName.empty() ? "" : ArchName.drop_back(2);
 }
 
+Triple::SubArchType llvm::AMDGPU::getSubArch(GPUKind AK) {
+  switch (AK) {
+#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES)                  
\
+  case ENUM:                                                                   
\
+    return SUBARCH;
+#include "llvm/TargetParser/AMDGPUTargetParser.def"
+  default:
+    return Triple::SubArchType::NoSubArch;
+  }
+}
+
+AMDGPU::GPUKind
+llvm::AMDGPU::getGPUKindFromSubArch(Triple::SubArchType SubArch) {
+  switch (SubArch) {
+#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES)                  
\
+  case SUBARCH:                                                                
\
+    return ENUM;
+#include "llvm/TargetParser/AMDGPUTargetParser.def"
+  default:
+    return GK_NONE;
+  }
+}
+
+static const Triple::SubArchType
----------------
slinder1 wrote:

This seems like a bit of a nightmare to maintain, although I guess we will only 
be adding on to the end.

I think a `switch` would at least be more immediately digestible

https://github.com/llvm/llvm-project/pull/206480
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to