[PATCH] D144967: [PowerPC] Recognize long CPU name for -mtune in Clang

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 28 10:02:29 PST 2023


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

Thanks for the patch!



================
Comment at: clang/lib/Driver/ToolChains/Arch/PPC.cpp:37
 
-/// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
-std::string ppc::getPPCTargetCPU(const ArgList &Args, const llvm::Triple &T) {
-  if (Arg *A = Args.getLastArg(clang::driver::options::OPT_mcpu_EQ)) {
-    StringRef CPUName = A->getValue();
-
-    // 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.
-    if (CPUName == "generic" || CPUName == "405")
+static std::string getLLVMPPCCpuName(StringRef CPUName, const llvm::Triple &T) {
+  // Clang/LLVM does not actually support code generation
----------------
The casing of the function name is a bit awkward, consider something perhaps more concise like `normalizeCPUName` and retaining the comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144967



More information about the cfe-commits mailing list