summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-06 18:25:33 +0000
committerChris Lattner <sabre@nondot.org>2003-06-06 18:25:33 +0000
commit30d002bd66d28e0c074ca350a30b57886566f8ae (patch)
treea4a2f665189b24bc7a4d1111ac2c961a2829caf1 /lib
parent8631ac4b7637722b772907a339e726f8440e3903 (diff)
downloadllvm-30d002bd66d28e0c074ca350a30b57886566f8ae.tar.gz
llvm-30d002bd66d28e0c074ca350a30b57886566f8ae.tar.bz2
llvm-30d002bd66d28e0c074ca350a30b57886566f8ae.tar.xz
Fix warnings on Sparc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86CodeEmitter.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index 687cbc731e..45d0b8c547 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -13,6 +13,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Value.h"
#include "Support/Statistic.h"
+#include <alloca.h>
namespace {
Statistic<>
@@ -77,7 +78,9 @@ void JITResolver::CompilationCallback() {
unsigned RetAddr = (unsigned)(intptr_t)__builtin_return_address(0);
assert(StackPtr[1] == RetAddr &&
"Could not find return address on the stack!");
- bool isStub = ((unsigned char*)RetAddr)[0] == 0xCD; // Interrupt marker?
+
+ // It's a stub if there is an interrupt marker after the call...
+ bool isStub = ((unsigned char*)(intptr_t)RetAddr)[0] == 0xCD;
// FIXME FIXME FIXME FIXME: __builtin_frame_address doesn't work if frame
// pointer elimination has been performed. Having a variable sized alloca
@@ -97,20 +100,20 @@ void JITResolver::CompilationCallback() {
#endif
// Sanity check to make sure this really is a call instruction...
- assert(((unsigned char*)RetAddr)[-1] == 0xE8 && "Not a call instr!");
+ assert(((unsigned char*)(intptr_t)RetAddr)[-1] == 0xE8 &&"Not a call instr!");
unsigned NewVal = TheJITResolver->resolveFunctionReference(RetAddr);
// Rewrite the call target... so that we don't fault every time we execute
// the call.
- *(unsigned*)RetAddr = NewVal-RetAddr-4;
+ *(unsigned*)(intptr_t)RetAddr = NewVal-RetAddr-4;
if (isStub) {
// If this is a stub, rewrite the call into an unconditional branch
// instruction so that two return addresses are not pushed onto the stack
// when the requested function finally gets called. This also makes the
// 0xCD byte (interrupt) dead, so the marker doesn't effect anything.
- ((unsigned char*)RetAddr)[-1] = 0xE9;
+ ((unsigned char*)(intptr_t)RetAddr)[-1] = 0xE9;
}
// Change the return address to reexecute the call instruction...
@@ -195,7 +198,7 @@ bool Emitter::runOnMachineFunction(MachineFunction &MF) {
for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) {
unsigned Location = BasicBlockAddrs[BBRefs[i].first];
unsigned Ref = BBRefs[i].second;
- *(unsigned*)Ref = Location-Ref-4;
+ *(unsigned*)(intptr_t)Ref = Location-Ref-4;
}
BBRefs.clear();
BasicBlockAddrs.clear();