[PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

Daniel Sanders via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 07:22:23 PDT 2016


dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
dsanders added a dependency: D20679: [mips] Kill 'support' for untested EABI..

Depends on D20679

http://reviews.llvm.org/D20680

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6940,25 +6940,21 @@
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-    if (BigEndian) {
-      if (ABI == "o32")
-        resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-      else if (ABI == "n32")
-        resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-      else if (ABI == "n64")
-        resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-      else
-        llvm_unreachable("Invalid ABI");
-    } else {
-      if (ABI == "o32")
-        resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-      else if (ABI == "n32")
-        resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-      else if (ABI == "n64")
-        resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-      else
-        llvm_unreachable("Invalid ABI");
-    }
+    StringRef Layout;
+
+    if (ABI == "o32")
+      Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+    else if (ABI == "n32")
+      Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+    else if (ABI == "n64")
+      Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+    else
+      llvm_unreachable("Invalid ABI");
+
+    if (BigEndian)
+      resetDataLayout(("E-" + Layout).str());
+    else
+      resetDataLayout(("e-" + Layout).str());
   }
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20680.58607.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160526/9326f889/attachment.bin>


More information about the cfe-commits mailing list