summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
diff options
context:
space:
mode:
authorDavid M Peixotto <dmp@rice.edu>2011-10-19 15:49:06 -0500
committerDavid Terei <davidterei@gmail.com>2011-11-01 03:18:40 -0700
commita9ce36118f0de3aeb427792f8f2c5ae097c94d3f (patch)
treed03c1697a04df842b21bafa214f22140473a2e0d /compiler/llvmGen
parentf0ae3f31277ebfe2384fca3f89867f340ae9b492 (diff)
downloadhaskell-a9ce36118f0de3aeb427792f8f2c5ae097c94d3f.tar.gz
Change stack alignment to 16+8 bytes in STG code
This patch changes the STG code so that %rsp to be aligned to a 16-byte boundary + 8. This is the alignment required by the x86_64 ABI on entry to a function. Previously we kept %rsp aligned to a 16-byte boundary, but this was causing problems for the LLVM backend (see #4211). We now don't need to invoke llvm stack mangler on x86_64 targets. Since the stack is now 16+8 byte algined in STG land on x86_64, we don't need to mangle the stack manipulations with the llvm mangler. This patch only modifies the alignement for x86_64 backends. Signed-off-by: David Terei <davidterei@gmail.com>
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r--compiler/llvmGen/LlvmMangler.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs
index 68e92cf651..981bbf2858 100644
--- a/compiler/llvmGen/LlvmMangler.hs
+++ b/compiler/llvmGen/LlvmMangler.hs
@@ -143,11 +143,13 @@ fixTables ss = fixed
have been pushed, so sub 4). GHC though since it always uses jumps keeps
the stack 16 byte aligned on both function calls and function entry.
- We correct the alignment here.
+ We correct the alignment here for Mac OS X i386. The x86_64 target already
+ has the correct alignment since we keep the stack 16+8 aligned throughout
+ STG land for 64-bit targets.
-}
fixupStack :: B.ByteString -> B.ByteString -> B.ByteString
-#if !darwin_TARGET_OS
+#if !darwin_TARGET_OS || x86_64_TARGET_ARCH
fixupStack = const
#else