summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86JITInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-06-24 08:36:10 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-06-24 08:36:10 +0000
commitda08d2c39af6aceaa0230f699c4b53de0e97c2b9 (patch)
tree351d962f905c0cd5f351a1a45a971c70cf2e60fa /lib/Target/X86/X86JITInfo.cpp
parent89d67faf30ed1a8b5364f53c9a0f5e07a9a0719c (diff)
downloadllvm-da08d2c39af6aceaa0230f699c4b53de0e97c2b9.tar.gz
llvm-da08d2c39af6aceaa0230f699c4b53de0e97c2b9.tar.bz2
llvm-da08d2c39af6aceaa0230f699c4b53de0e97c2b9.tar.xz
Simplify X86CompilationCallback: always align to 16-byte boundary; don't save EAX/EDX if unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86JITInfo.cpp')
-rw-r--r--lib/Target/X86/X86JITInfo.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp
index 87fca4381c..a96b4a67e3 100644
--- a/lib/Target/X86/X86JITInfo.cpp
+++ b/lib/Target/X86/X86JITInfo.cpp
@@ -57,26 +57,28 @@ extern "C" {
#endif
"pushl %ebp\n"
"movl %esp, %ebp\n" // Standard prologue
+#if FASTCC_NUM_INT_ARGS_INREGS > 0
"pushl %eax\n"
- "pushl %edx\n" // save EAX/EDX
-#if defined(__CYGWIN__) || defined(__MINGW32__)
- "call _X86CompilationCallback2\n"
-#elif defined(__APPLE__)
- "movl 4(%ebp), %eax\n" // load the address of return address
- "movl $24, %edx\n" // if the opcode of the instruction at the
- "cmpb $-51, (%eax)\n" // return address is our 0xCD marker, then
- "movl $12, %eax\n" // subtract 24 from %esp to realign it to 16
- "cmovne %eax, %edx\n" // bytes after the push of edx, the amount to.
- "subl %edx, %esp\n" // the push of edx to keep it aligned.
- "pushl %edx\n" // subtract. Otherwise, subtract 12 bytes after
+ "pushl %edx\n" // Save EAX/EDX
+#endif
+#if defined(__APPLE__)
+ "andl $-16, %esp\n" // Align ESP on 16-byte boundary
+#endif
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
"call _X86CompilationCallback2\n"
- "popl %edx\n"
- "addl %edx, %esp\n"
#else
- "call X86CompilationCallback2\n"
+ "call X86CompilationCallback2\n"
+#endif
+#if defined(__APPLE__)
+ "movl %ebp, %esp\n" // Restore ESP
+#endif
+#if FASTCC_NUM_INT_ARGS_INREGS > 0
+#if defined(__APPLE__)
+ "subl $8, %esp\n"
#endif
"popl %edx\n"
"popl %eax\n"
+#endif
"popl %ebp\n"
"ret\n");
#else