]> granicus.if.org Git - clang/commitdiff
[mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 3 Jun 2016 10:11:01 +0000 (10:11 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 3 Jun 2016 10:11:01 +0000 (10:11 +0000)
Summary:

Reviewers: atanasyan

Subscribers: atanasyan, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271647 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp

index ccbe7fcbc5b1a70b36f2d4814278c3b6333fda49..3241614d01e85b8d57dda7c1485a90dc4f82e1be 100644 (file)
@@ -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());
   }