[PATCH] D140080: [clang][PPC] Supporting -mcpu=405

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 05:34:37 PST 2022


nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

I don't think the comments require another round of review. Thanks for fixing this.



================
Comment at: clang/lib/Driver/ToolChains/Arch/PPC.cpp:23-29
+static constexpr llvm::StringLiteral GenericCPUNames[] = {{"generic"}, {"405"}};
+
+/// Check if Name is known to be equivalent to "generic".
+static bool isGenericCPUName(const StringRef &Name) {
+  return llvm::is_contained(GenericCPUNames, Name);
+}
+
----------------
While I understand the motivation here, I think that this is overkill. We in fact hope not to have to grow the set of CPU ID's that we treat as generic.


================
Comment at: clang/lib/Driver/ToolChains/Arch/PPC.cpp:42
 
-    if (CPUName == "generic")
       return getPPCGenericTargetCPU(T);
----------------
I think we should change this to check for `generic` or `405` and add a comment similar to the following:
```
// Clang/LLVM does not actually support code generation
// for the 405 CPU. However, there are uses of this CPU ID
// in projects that previously used GCC and rely on Clang
// accepting it. Clang has always ignored it and passed the
// generic CPU ID to the back end.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140080/new/

https://reviews.llvm.org/D140080



More information about the cfe-commits mailing list