[PATCH] D153707: [Clang][LoongArch] Consume and check -mabi and -mfpu even if -m*-float is present

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 08:26:35 PDT 2023


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

LGTM. Thanks.



================
Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:64
+    // conflicts with the higher-priority settings implied by -m*-float.
+    if (!ImpliedABI.empty()) {
+      if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
----------------
Seems that this condition is always `true`.


================
Comment at: clang/lib/Driver/ToolChains/Arch/LoongArch.cpp:85
   // Select abi based on -mfpu=xx.
-  if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) {
-    StringRef FPU = A->getValue();
-    if (FPU == "64")
-      return IsLA32 ? "ilp32d" : "lp64d";
-    if (FPU == "32")
-      return IsLA32 ? "ilp32f" : "lp64f";
-    if (FPU == "0" || FPU == "none")
-      return IsLA32 ? "ilp32s" : "lp64s";
-    D.Diag(diag::err_drv_loongarch_invalid_mfpu_EQ) << FPU;
+  switch (FPU) {
+  case 64:
----------------
Without `default`, there may be compiling warning?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153707



More information about the cfe-commits mailing list