From: Amy Huang Date: Tue, 27 Aug 2019 17:46:53 +0000 (+0000) Subject: Change the X86 datalayout to add three address spaces for 32 bit signed, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8260e31a27b8c4007d1d54af3a9f0d096b792a1d;p=clang Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370083 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h index da22e6508c..cc72a0a39f 100644 --- a/lib/Basic/Targets/OSTargets.h +++ b/lib/Basic/Targets/OSTargets.h @@ -775,9 +775,11 @@ public: if (Triple.getArch() == llvm::Triple::arm) { // Handled in ARM's setABI(). } else if (Triple.getArch() == llvm::Triple::x86) { - this->resetDataLayout("e-m:e-p:32:32-i64:64-n8:16:32-S128"); + this->resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-n8:16:32-S128"); } else if (Triple.getArch() == llvm::Triple::x86_64) { - this->resetDataLayout("e-m:e-p:32:32-i64:64-n8:16:32:64-S128"); + this->resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-n8:16:32:64-S128"); } else if (Triple.getArch() == llvm::Triple::mipsel) { // Handled on mips' setDataLayout. } else { diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h index dd1e7db6c8..dee342c0d0 100644 --- a/lib/Basic/Targets/X86.h +++ b/lib/Basic/Targets/X86.h @@ -340,7 +340,8 @@ public: LongDoubleWidth = 96; LongDoubleAlign = 32; SuitableAlign = 128; - resetDataLayout("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"); + resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-" + "f80:32-n8:16:32-S128"); SizeType = UnsignedInt; PtrDiffType = SignedInt; IntPtrType = SignedInt; @@ -440,7 +441,8 @@ public: UseSignedCharForObjCBool = false; SizeType = UnsignedLong; IntPtrType = SignedLong; - resetDataLayout("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"); + resetDataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-" + "f80:128-n8:16:32-S128"); HasAlignMac68kSupport = true; } @@ -465,9 +467,10 @@ public: DoubleAlign = LongLongAlign = 64; bool IsWinCOFF = getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); - resetDataLayout(IsWinCOFF - ? "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" - : "e-m:e-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"); + resetDataLayout(IsWinCOFF ? "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:32-n8:16:32-a:0:32-S32" + : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:32-n8:16:32-a:0:32-S32"); } }; @@ -515,7 +518,8 @@ public: : X86_32TargetInfo(Triple, Opts) { this->WCharType = TargetInfo::UnsignedShort; DoubleAlign = LongLongAlign = 64; - resetDataLayout("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"); + resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:" + "32-n8:16:32-a:0:32-S32"); } void getTargetDefines(const LangOptions &Opts, @@ -552,7 +556,8 @@ public: : X86_32TargetInfo(Triple, Opts) { LongDoubleWidth = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); - resetDataLayout("e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32"); + resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-f64:" + "32-f128:32-n8:16:32-a:0:32-S32"); WIntType = UnsignedInt; } @@ -611,10 +616,12 @@ public: RegParmMax = 6; // Pointers are 32-bit in x32. - resetDataLayout(IsX32 - ? "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" - : IsWinCOFF ? "e-m:w-i64:64-f80:128-n8:16:32:64-S128" - : "e-m:e-i64:64-f80:128-n8:16:32:64-S128"); + resetDataLayout(IsX32 ? "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-" + "i64:64-f80:128-n8:16:32:64-S128" + : IsWinCOFF ? "e-m:w-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128" + : "e-m:e-p270:32:32-p271:32:32-p272:64:" + "64-i64:64-f80:128-n8:16:32:64-S128"); // Use fpret only for long double. RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble); @@ -804,7 +811,8 @@ public: llvm::Triple T = llvm::Triple(Triple); if (T.isiOS()) UseSignedCharForObjCBool = false; - resetDataLayout("e-m:o-i64:64-f80:128-n8:16:32:64-S128"); + resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:" + "16:32:64-S128"); } bool handleTargetFeatures(std::vector &Features, diff --git a/test/CodeGen/Inputs/thinlto-multi-module.ll b/test/CodeGen/Inputs/thinlto-multi-module.ll index e8dc16a8f5..e6fe92084a 100644 --- a/test/CodeGen/Inputs/thinlto-multi-module.ll +++ b/test/CodeGen/Inputs/thinlto-multi-module.ll @@ -1,4 +1,4 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define void @f2() { diff --git a/test/CodeGen/Inputs/thinlto_backend.ll b/test/CodeGen/Inputs/thinlto_backend.ll index 78678c0c5a..86c410efb5 100644 --- a/test/CodeGen/Inputs/thinlto_backend.ll +++ b/test/CodeGen/Inputs/thinlto_backend.ll @@ -1,4 +1,4 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define void @f2() { diff --git a/test/CodeGen/Inputs/thinlto_backend_local_name_conflict1.ll b/test/CodeGen/Inputs/thinlto_backend_local_name_conflict1.ll index fb5306fc33..bec5f67f59 100644 --- a/test/CodeGen/Inputs/thinlto_backend_local_name_conflict1.ll +++ b/test/CodeGen/Inputs/thinlto_backend_local_name_conflict1.ll @@ -1,6 +1,6 @@ ; ModuleID = 'local_name_conflict_var.o' source_filename = "local_name_conflict_var.c" -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @baz = internal global i32 10, align 4 diff --git a/test/CodeGen/Inputs/thinlto_backend_local_name_conflict2.ll b/test/CodeGen/Inputs/thinlto_backend_local_name_conflict2.ll index bf3c262f18..51cd0bef09 100644 --- a/test/CodeGen/Inputs/thinlto_backend_local_name_conflict2.ll +++ b/test/CodeGen/Inputs/thinlto_backend_local_name_conflict2.ll @@ -1,6 +1,6 @@ ; ModuleID = 'local_name_conflict_var.o' source_filename = "local_name_conflict_var.c" -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @baz = internal global i32 10, align 4 diff --git a/test/CodeGen/iamcu-abi.c b/test/CodeGen/iamcu-abi.c index 897d475d49..6bb73d2031 100644 --- a/test/CodeGen/iamcu-abi.c +++ b/test/CodeGen/iamcu-abi.c @@ -1,9 +1,8 @@ // RUN: %clang_cc1 -triple i386-pc-elfiamcu -emit-llvm -o - %s | FileCheck %s -// CHECK: target datalayout = "e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32" +// CHECK: target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32" // CHECK: target triple = "i386-pc-elfiamcu" - void food(double *d); void fooll(long long *ll); void fooull(unsigned long long *ull); diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c index d9efe9f0a8..3e4d054363 100644 --- a/test/CodeGen/target-data.c +++ b/test/CodeGen/target-data.c @@ -1,22 +1,22 @@ // RUN: %clang_cc1 -triple i686-unknown-unknown -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-UNKNOWN %s -// I686-UNKNOWN: target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" +// I686-UNKNOWN: target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" // RUN: %clang_cc1 -triple i686-apple-darwin9 -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-DARWIN %s -// I686-DARWIN: target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" +// I686-DARWIN: target datalayout = "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128" // RUN: %clang_cc1 -triple i686-unknown-win32 -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-WIN32 %s -// I686-WIN32: target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" +// I686-WIN32: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32" // RUN: %clang_cc1 -triple i686-unknown-cygwin -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=I686-CYGWIN %s -// I686-CYGWIN: target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" +// I686-CYGWIN: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32" // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=X86_64 %s -// X86_64: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +// X86_64: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" // RUN: %clang_cc1 -triple xcore-unknown-unknown -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=XCORE %s @@ -88,11 +88,11 @@ // RUN: %clang_cc1 -triple i686-nacl -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=I686-NACL -// I686-NACL: target datalayout = "e-m:e-p:32:32-i64:64-n8:16:32-S128" +// I686-NACL: target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-n8:16:32-S128" // RUN: %clang_cc1 -triple x86_64-nacl -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=X86_64-NACL -// X86_64-NACL: target datalayout = "e-m:e-p:32:32-i64:64-n8:16:32:64-S128" +// X86_64-NACL: target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-n8:16:32:64-S128" // RUN: %clang_cc1 -triple arm-nacl -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=ARM-NACL diff --git a/test/CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll b/test/CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll index 2d25930e50..0362786ecd 100644 --- a/test/CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll +++ b/test/CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll @@ -32,7 +32,7 @@ ; CHECK: tinkywinky inlined into main with (cost=0, threshold=337) (hotness: 300) -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-scei-ps4" declare i32 @patatino() diff --git a/test/CodeGen/thinlto-distributed-backend-skip.ll b/test/CodeGen/thinlto-distributed-backend-skip.ll index d9fa47d23d..d7b8225ee2 100644 --- a/test/CodeGen/thinlto-distributed-backend-skip.ll +++ b/test/CodeGen/thinlto-distributed-backend-skip.ll @@ -9,7 +9,7 @@ ; RUN: -fthinlto-index=%S/Inputs/thinlto-distributed-backend-skip.bc \ ; RUN: -emit-llvm -o - -x ir %t.o | FileCheck %s -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" ; CHECK: "empty" diff --git a/test/CodeGen/thinlto-distributed-cfi-devirt.ll b/test/CodeGen/thinlto-distributed-cfi-devirt.ll index d69b77bbc0..2920cf19c8 100644 --- a/test/CodeGen/thinlto-distributed-cfi-devirt.ll +++ b/test/CodeGen/thinlto-distributed-cfi-devirt.ll @@ -47,7 +47,7 @@ ; RUN: -emit-obj -fthinlto-index=%t.o.thinlto.bc -O2 \ ; RUN: -o %t.native.o -x ir %t.o -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" %struct.A = type { i32 (...)** } diff --git a/test/CodeGen/thinlto-distributed-cfi.ll b/test/CodeGen/thinlto-distributed-cfi.ll index ccd5c241eb..65808fdc01 100644 --- a/test/CodeGen/thinlto-distributed-cfi.ll +++ b/test/CodeGen/thinlto-distributed-cfi.ll @@ -36,7 +36,7 @@ ; RUN: -emit-obj -fthinlto-index=%t.o.thinlto.bc \ ; RUN: -o %t.native.o -x ir %t.o -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" %struct.B = type { %struct.A } diff --git a/test/CodeGen/thinlto-distributed.ll b/test/CodeGen/thinlto-distributed.ll index ae21d7b3e9..a578aae7e0 100644 --- a/test/CodeGen/thinlto-distributed.ll +++ b/test/CodeGen/thinlto-distributed.ll @@ -12,7 +12,7 @@ ; RUN: -emit-obj -fthinlto-index=%t.o.thinlto.bc \ ; RUN: -o %t.native.o -x ir %t.o -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" define i32 @main() { diff --git a/test/CodeGen/thinlto-multi-module.ll b/test/CodeGen/thinlto-multi-module.ll index 385d98c74d..186b34d2d7 100644 --- a/test/CodeGen/thinlto-multi-module.ll +++ b/test/CodeGen/thinlto-multi-module.ll @@ -11,7 +11,7 @@ ; CHECK-OBJ: T f1 ; CHECK-OBJ: U f2 -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" declare void @f2() diff --git a/test/CodeGen/thinlto_backend.ll b/test/CodeGen/thinlto_backend.ll index 2dd919d5f7..3546b74b13 100644 --- a/test/CodeGen/thinlto_backend.ll +++ b/test/CodeGen/thinlto_backend.ll @@ -47,7 +47,7 @@ ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR2 ; CHECK-ERROR2: Error loading imported file '{{.*}}': Could not find module summary -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" declare void @f2() diff --git a/test/CodeGen/thinlto_backend_local_name_conflict.ll b/test/CodeGen/thinlto_backend_local_name_conflict.ll index cefbc51bf0..2e3fe9b504 100644 --- a/test/CodeGen/thinlto_backend_local_name_conflict.ll +++ b/test/CodeGen/thinlto_backend_local_name_conflict.ll @@ -21,7 +21,7 @@ ; ModuleID = 'local_name_conflict_var_main.o' source_filename = "local_name_conflict_var_main.c" -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: noinline nounwind uwtable