Index: lib/Target/X86/X86Subtarget.cpp |
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp |
index e59395c06a5c7fe63c44d2cf9da17adfa51b4f4e..e209e4f577ae98e6b6328f586d5152212ce8f9fa 100644 |
--- a/lib/Target/X86/X86Subtarget.cpp |
+++ b/lib/Target/X86/X86Subtarget.cpp |
@@ -44,6 +44,13 @@ X86EarlyIfConv("x86-early-ifcvt", cl::Hidden, |
cl::desc("Enable early if-conversion on X86")); |
+// @LOCALMOD-START |
+static cl::opt<bool> |
+MalignDouble("malign-double", cl::Hidden, |
+ cl::desc("Align i64 and f64 types to 8 bytes")); |
+// @LOCALMOD-END |
+ |
+ |
/// ClassifyBlockAddressReference - Classify a blockaddress reference for the |
/// current subtarget according to how we should reference it in a non-pcrel |
/// context. |
@@ -175,7 +182,15 @@ bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const { |
// the following check for Win32 should be removed. |
if (In64BitMode || isTargetWin32()) |
return false; |
- return isTargetELF() || TM.getRelocationModel() == Reloc::Static; |
+ // @LOCALMOD-BEGIN |
+ // BUG= http://code.google.com/p/nativeclient/issues/detail?id=2367 |
+ // For NaCl dynamic linking we do not want to generate a text relocation to |
+ // an absolute address in PIC mode. Such a situation arises from |
+ // test/CodeGen/X86/call-imm.ll with the default implementation. |
+ // For other platforms we retain the default behavior. |
+ return (isTargetELF() && !isTargetNaCl()) || |
+ TM.getRelocationModel() == Reloc::Static; |
+ // @LOCALMOD-END |
} |
void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { |
@@ -219,10 +234,11 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { |
"64-bit code requested on a subtarget that doesn't support it!"); |
// Stack alignment is 16 bytes on Darwin, Linux and Solaris (both |
- // 32 and 64 bit) and for all 64-bit targets. |
+ // 32 and 64 bit), NaCl and for all 64-bit targets. |
if (StackAlignOverride) |
stackAlignment = StackAlignOverride; |
else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || |
+ isTargetNaCl() || // @LOCALMOD |
In64BitMode) |
stackAlignment = 16; |
} |
@@ -294,15 +310,16 @@ static std::string computeDataLayout(const Triple &TT) { |
Ret += "-p:32:32"; |
// Some ABIs align 64 bit integers and doubles to 64 bits, others to 32. |
- if (TT.isArch64Bit() || TT.isOSWindows() || TT.isOSNaCl()) |
+ if (TT.isArch64Bit() || TT.isOSWindows() || TT.isOSNaCl() |
+ || MalignDouble) // @LOCALMOD |
Ret += "-i64:64"; |
else |
Ret += "-f64:32:64"; |
// Some ABIs align long double to 128 bits, others to 32. |
- if (TT.isOSNaCl()) |
- ; // No f80 |
- else if (TT.isArch64Bit() || TT.isOSDarwin()) |
+ // @LOCALMOD Removed the NaCl special-casing for LLVM 3.5 merge, it was |
+ // wrong. Patch sent upstream. |
+ if (TT.isArch64Bit() || TT.isOSDarwin()) |
Ret += "-f80:128"; |
else |
Ret += "-f80:32"; |
@@ -368,4 +385,3 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU, |
bool X86Subtarget::enableEarlyIfConversion() const { |
return hasCMov() && X86EarlyIfConv; |
} |
- |