diff options
author | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2008-04-16 20:46:05 +0000 |
---|---|---|
committer | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2008-04-16 20:46:05 +0000 |
commit | a7557dfe71691a6406f2af76daaff29b515d3e85 (patch) | |
tree | e1d48396b56c82a14a330b964bcb985fdf6f43fd /llvm/lib/Target/ARM/ARMJITInfo.cpp | |
parent | b7066c75393275b1a39d03cda7eeede370d922ad (diff) | |
download | bcm5719-llvm-a7557dfe71691a6406f2af76daaff29b515d3e85.tar.gz bcm5719-llvm-a7557dfe71691a6406f2af76daaff29b515d3e85.zip |
Correlate stubs with functions in JIT: when emitting a stub, the JIT tells the memory manager which function
the stub will resolve.
llvm-svn: 49814
Diffstat (limited to 'llvm/lib/Target/ARM/ARMJITInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMJITInfo.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMJITInfo.cpp b/llvm/lib/Target/ARM/ARMJITInfo.cpp index 915963c26ca..bc2bba36c80 100644 --- a/llvm/lib/Target/ARM/ARMJITInfo.cpp +++ b/llvm/lib/Target/ARM/ARMJITInfo.cpp @@ -15,6 +15,7 @@ #include "ARMJITInfo.h" #include "ARMRelocations.h" #include "ARMSubtarget.h" +#include "llvm/Function.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/Config/alloca.h" #include <cstdlib> @@ -93,20 +94,21 @@ ARMJITInfo::getLazyResolverFunction(JITCompilerFn F) { return ARMCompilationCallback; } -void *ARMJITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { +void *ARMJITInfo::emitFunctionStub(const Function* F, void *Fn, + MachineCodeEmitter &MCE) { unsigned addr = (intptr_t)Fn; // If this is just a call to an external function, emit a branch instead of a // call. The code is the same except for one bit of the last instruction. if (Fn != (void*)(intptr_t)ARMCompilationCallback) { // branch to the corresponding function addr // the stub is 8-byte size and 4-aligned - MCE.startFunctionStub(8, 4); + MCE.startFunctionStub(F, 8, 4); MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4] MCE.emitWordLE(addr); // addr of function } else { // branch and link to the corresponding function addr // the stub is 20-byte size and 4-aligned - MCE.startFunctionStub(20, 4); + MCE.startFunctionStub(F, 20, 4); MCE.emitWordLE(0xE92D4800); // STMFD SP!, [R11, LR] MCE.emitWordLE(0xE28FE004); // ADD LR, PC, #4 MCE.emitWordLE(0xE51FF004); // LDR PC, [PC,#-4] @@ -114,7 +116,7 @@ void *ARMJITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) { MCE.emitWordLE(0xE8BD8800); // LDMFD SP!, [R11, PC] } - return MCE.finishFunctionStub(0); + return MCE.finishFunctionStub(F); } /// relocate - Before the JIT can run a block of code that has been emitted, |