From 960ede2e1d3387719cf4176582883d60dec6f67b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 19 Dec 2013 00:44:37 +0000 Subject: [PATCH] Synchronize the NaCl DataLayout strings with the ones in clang. Patch by Derek Schuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197640 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMTargetMachine.cpp | 7 +++++-- lib/Target/X86/X86Subtarget.h | 3 ++- lib/Target/X86/X86TargetMachine.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 5afc7ccedf1..7f387ec466d 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -102,8 +102,11 @@ static std::string computeDataLayout(ARMSubtarget &ST) { // Integer registers are 32 bits. Ret += "-n32"; - // The stack is 64 bit aligned on AAPCS and 32 bit aligned everywhere else. - if (ST.isAAPCS_ABI()) + // The stack is 128 bit aligned on NaCl, 64 bit aligned on AAPCS and 32 bit + // aligned everywhere else. + if (ST.isTargetNaCl()) + Ret += "-S128"; + else if (ST.isAAPCS_ABI()) Ret += "-S64"; else Ret += "-S32"; diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 08dbf0270c0..93d251a6794 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -246,7 +246,8 @@ public: /// Is this x86_64 with the ILP32 programming model (x32 ABI)? bool isTarget64BitILP32() const { - return In64BitMode && (TargetTriple.getEnvironment() == Triple::GNUX32); + return In64BitMode && (TargetTriple.getEnvironment() == Triple::GNUX32 || + TargetTriple.getOS() == Triple::NaCl); } /// Is this x86_64 with the LP64 programming model (standard AMD64, no x32)? diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 64816e413c4..04c1d7ebb98 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -39,13 +39,16 @@ static std::string computeDataLayout(const X86Subtarget &ST) { Ret += "-p:32:32"; // Some ABIs align 64 bit integers and doubles to 64 bits, others to 32. - if (ST.is64Bit() || ST.isTargetCygMing() || ST.isTargetWindows()) + if (ST.is64Bit() || ST.isTargetCygMing() || ST.isTargetWindows() || + ST.isTargetNaCl()) Ret += "-i64:64"; else Ret += "-f64:32:64"; // Some ABIs align long double to 128 bits, others to 32. - if (ST.is64Bit() || ST.isTargetDarwin()) + if (ST.isTargetNaCl()) + ; // No f80 + else if (ST.is64Bit() || ST.isTargetDarwin()) Ret += "-f80:128"; else Ret += "-f80:32";