[PATCH] D110514: MIPS: Triple::setArch as R6 if MipsSubArch_r6

YunQiang Su via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 26 20:52:38 PDT 2021


wzssyqa created this revision.
wzssyqa added a reviewer: atanasyan.
Herald added subscribers: dexonsmith, hiraditya, arichardson, sdardis.
wzssyqa requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently,

  clang -target mipsisa64r6-linux-gnu -mabi=32

will generate a r2 32bit object instead expected r6 one.

The reason is that for some R6 <https://reviews.llvm.org/source/compiler-rt/> triples, the ArchName and ArchTypeName are different:

  ArchTypeName has only 4 choice: mips, mipsel, mips64, mips64el, 
  ArchName may be something like mipsisa{32,64}r6{,el}  


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110514

Files:
  llvm/lib/Support/Triple.cpp


Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -1206,6 +1206,24 @@
 }
 
 void Triple::setArch(ArchType Kind) {
+  if (getSubArch() == Triple::MipsSubArch_r6) {
+    switch (Kind) {
+    case Triple::mips:
+      setArchName("mipsisa32r6");
+      return;
+    case Triple::mipsel:
+      setArchName("mipsisa32r6el");
+      return;
+    case Triple::mips64:
+      setArchName("mipsisa64r6");
+      return;
+    case Triple::mips64el:
+      setArchName("mipsisa64r6el");
+      return;
+    default:
+      llvm_unreachable("unexpected Triple for MIPS r6");
+    }
+  }
   setArchName(getArchTypeName(Kind));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110514.375141.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210927/6889bbf4/attachment.bin>


More information about the llvm-commits mailing list