r271647 - [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

Daniel Sanders via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 03:11:02 PDT 2016


Author: dsanders
Date: Fri Jun  3 05:11:01 2016
New Revision: 271647

URL: http://llvm.org/viewvc/llvm-project?rev=271647&view=rev
Log:
[mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

Summary:

Reviewers: atanasyan

Subscribers: atanasyan, cfe-commits

Differential Revision: http://reviews.llvm.org/D20680

Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271647&r1=271646&r2=271647&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jun  3 05:11:01 2016
@@ -7009,25 +7009,21 @@ public:
 
 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());
   }
 
 




More information about the cfe-commits mailing list