[llvm] [PowerPC][AIX] Emit PowerPC version for XCOFF (PR #95510)

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 03:17:20 PDT 2024


================
@@ -107,6 +108,61 @@ StringRef XCOFF::getNameForTracebackTableLanguageId(
 }
 #undef LANG_CASE
 
+XCOFF::CFileCpuId XCOFF::getCpuID(StringRef CPU) {
+  return StringSwitch<XCOFF::CFileCpuId>(CPU)
+      .Case("generic", XCOFF::TCPU_PWR7)
+      .Case("601", XCOFF::TCPU_601)
+      .Cases("602", "603", "603e", "603ev", XCOFF::TCPU_603)
+      .Cases("604", "604e", XCOFF::TCPU_604)
+      .Case("620", XCOFF::TCPU_620)
----------------
chenzheng1030 wrote:

I don't think we need to handle names like `power10` or `ppc32` or `powerpc` which are all not supported by aix system assembler.

You can just add a statement here to say that the cpu names will be normalized by https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Arch/PPC.cpp#L54-L77 in previous logic.

I continue to improve that normalization in https://github.com/llvm/llvm-project/pull/97541

The aix system supports:
```
        Valid values are:COM PWR PWR2 PPC 601 603 604 PPC64 620 A35 PWR4 PWR5 PWR5X 970 PPC970 PWR6 PWR6E PWR7 PWR8 PWR9 PWR10 ANY
```

We may need to map some other normalized CPU names like `a2`,`g5` or others to some know value like `COM`.

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


More information about the llvm-commits mailing list