[PATCH] [x32] Add X32 support to driver

Pavel Chupin pavel.v.chupin at gmail.com
Thu Jun 19 05:28:54 PDT 2014


Thanks for review. See next patchset.

================
Comment at: lib/Basic/Targets.cpp:3262
@@ -3260,4 +3261,3 @@
     SuitableAlign = 128;
-    IntMaxType = SignedLong;
-    UIntMaxType = UnsignedLong;
-    Int64Type = SignedLong;
+    if (IsX32) {
+      SizeType = UnsignedInt;
----------------
Saleem Abdulrasool wrote:
> I think chaining the assignment here similar to above might be nicer.
Done

================
Comment at: lib/Basic/Targets.cpp:3273
@@ -3265,2 +3272,3 @@
 
-    DescriptionString = "e-m:e-i64:64-f80:128-n8:16:32:64-S128";
+    DescriptionString = (IsX32)
+                            ? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
----------------
Saleem Abdulrasool wrote:
> The two data layouts are identical except for the pointer size.  Can you factor that out so that its more obvious and less redundant please?
DescriptionString is C-style string so next patchset change seems the best what can be done here.

================
Comment at: lib/Driver/ToolChains.cpp:2977
@@ -2955,1 +2976,3 @@
 
+  if (Triple.getEnvironment() == llvm::Triple::GNUX32)
+    return "libx32";
----------------
Saleem Abdulrasool wrote:
> Can you add a check that arch is x86_64?  Right now, you could make up ppc64---gnux32 if Im not mistaken.
Done

================
Comment at: lib/Driver/Tools.cpp:6730
@@ -6729,1 +6729,3 @@
     CmdArgs.push_back("--64");
+  } else if (getToolChain().getTriple().getEnvironment() ==
+             llvm::Triple::GNUX32) {
----------------
Saleem Abdulrasool wrote:
> Can you do this inside the x86_64 case?  Or is there a reason to make this its own case?
Done

================
Comment at: lib/Driver/Tools.cpp:6928
@@ -6924,1 +6927,3 @@
     return "/lib64/ld-linux.so.2";
+  else if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
+    return "/libx32/ld-linux-x32.so.2";
----------------
Saleem Abdulrasool wrote:
> Can you extend this to check the arch?
Done

================
Comment at: lib/Driver/Tools.cpp:7040
@@ -7034,1 +7039,3 @@
     CmdArgs.push_back("elf64_s390");
+  else if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
+    CmdArgs.push_back("elf32_x86_64");
----------------
Saleem Abdulrasool wrote:
> Here as well.
Done.

http://reviews.llvm.org/D4180






More information about the cfe-commits mailing list