diff options
author | Chris Lattner <sabre@nondot.org> | 2004-10-18 15:54:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-10-18 15:54:17 +0000 |
commit | 7d0974b9a07aea5488d8123c6df6d79f1b40bc40 (patch) | |
tree | c77b6d5c207f66aa843a775fab9e51cd4982f5b5 | |
parent | f26801b0e6ab958001f796fd42367e93e9feb96e (diff) | |
download | external_llvm-7d0974b9a07aea5488d8123c6df6d79f1b40bc40.zip external_llvm-7d0974b9a07aea5488d8123c6df6d79f1b40bc40.tar.gz external_llvm-7d0974b9a07aea5488d8123c6df6d79f1b40bc40.tar.bz2 |
Improve compatibility with VC++, patch contributed by Morten Ofstad!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17126 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86CodeEmitter.cpp | 17 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetMachine.cpp | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index 5bc0442..eef01ad 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -102,21 +102,34 @@ unsigned JITResolver::getLazyResolver(Function *F) { return Stub; } +#ifdef _MSC_VER +#pragma optimize("y", off) +#endif + void JITResolver::CompilationCallback() { +#ifdef _MSC_VER + unsigned *StackPtr, RetAddr; + __asm mov StackPtr, ebp; + __asm mov eax, DWORD PTR [ebp + 4]; + __asm mov RetAddr, eax; +#else unsigned *StackPtr = (unsigned*)__builtin_frame_address(0); unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0); +#endif assert(StackPtr[1] == RetAddr && "Could not find return address on the stack!"); // It's a stub if there is an interrupt marker after the call... bool isStub = ((unsigned char*)(intptr_t)RetAddr)[0] == 0xCD; +#ifndef _MSC_VER // FIXME FIXME FIXME FIXME: __builtin_frame_address doesn't work if frame // pointer elimination has been performed. Having a variable sized alloca // disables frame pointer elimination currently, even if it's dead. This is a // gross hack. alloca(10+isStub); // FIXME FIXME FIXME FIXME +#endif // The call instruction should have pushed the return value onto the stack... RetAddr -= 4; // Backtrack to the reference itself... @@ -150,6 +163,10 @@ void JITResolver::CompilationCallback() { StackPtr[1] -= 5; } +#ifdef _MSC_VER +#pragma optimize( "", on ) +#endif + /// emitStubForFunction - This method is used by the JIT when it needs to emit /// the address of a function for a function whose code has not yet been /// generated. In order to do this, it generates a stub which jumps to the lazy diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 65df2d9..6732893 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -54,7 +54,7 @@ namespace { } unsigned X86TargetMachine::getJITMatchQuality() { -#if defined(i386) || defined(__i386__) || defined(__x86__) +#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86) return 10; #else return 0; |