[PATCH] D155824: [LoongArch] Support -march=native and -mtune=

WÁNG Xuěruì via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 00:43:18 PDT 2023


xen0n added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:199-204
+  // Handle CPU name is 'native'.
+  if (CPU == "native") {
+    CPU = llvm::sys::getHostCPUName();
+    if (CPU == "generic")
+      CPU = llvm::LoongArch::getDefaultArch(Triple.isLoongArch64());
+  }
----------------
This part is identical between `-march=` and `-mtune=` handling. I'd suggest extracting out a common helper for this, or making this function generic over `options::OPT_m*_EQ` (whichever more suitable for you and the Clang maintainers; I don't have a particular preference).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155824



More information about the cfe-commits mailing list