summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86JITInfo.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
committerNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
commitd6b7a242d345fd79a337afd384bb586c5619cfe7 (patch)
treecc149d70595f6859c7607a5129ce01ce9a98e0bb /lib/Target/X86/X86JITInfo.cpp
parent98c507ed5c2883bc8ef487d952e851da37f8b32f (diff)
downloadllvm-d6b7a242d345fd79a337afd384bb586c5619cfe7.tar.gz
llvm-d6b7a242d345fd79a337afd384bb586c5619cfe7.tar.bz2
llvm-d6b7a242d345fd79a337afd384bb586c5619cfe7.tar.xz
Add support to the JIT for true non-lazy operation. When a call to a function
that has not been JIT'd yet, the callee is put on a list of pending functions to JIT. The call is directed through a stub, which is updated with the address of the function after it has been JIT'd. A new interface for allocating and updating empty stubs is provided. Add support for removing the ModuleProvider the JIT was created with, which would otherwise invalidate the JIT's PassManager, which is initialized with the ModuleProvider's Module. Add support under a new ExecutionEngine flag for emitting the infomration necessary to update Function and GlobalVariable stubs after JITing them, by recording the address of the stub and the name of the GlobalValue. This allows code to be copied from one address space to another, where libraries may live at different virtual addresses, and have the stubs updated with their new correct target addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86JITInfo.cpp')
-rw-r--r--lib/Target/X86/X86JITInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp
index f8d32b0961..4bbccf380c 100644
--- a/lib/Target/X86/X86JITInfo.cpp
+++ b/lib/Target/X86/X86JITInfo.cpp
@@ -490,6 +490,21 @@ void *X86JITInfo::emitFunctionStub(const Function* F, void *Fn,
return MCE.finishGVStub(F);
}
+void X86JITInfo::emitFunctionStubAtAddr(const Function* F, void *Fn, void *Stub,
+ MachineCodeEmitter &MCE) {
+ // Note, we cast to intptr_t here to silence a -pedantic warning that
+ // complains about casting a function pointer to a normal pointer.
+ MCE.startGVStub(F, Stub, 5);
+ MCE.emitByte(0xE9);
+#if defined (X86_64_JIT)
+ assert(((((intptr_t)Fn-MCE.getCurrentPCValue()-5) << 32) >> 32) ==
+ ((intptr_t)Fn-MCE.getCurrentPCValue()-5)
+ && "PIC displacement does not fit in displacement field!");
+#endif
+ MCE.emitWordLE((intptr_t)Fn-MCE.getCurrentPCValue()-4);
+ MCE.finishGVStub(F);
+}
+
/// getPICJumpTableEntry - Returns the value of the jumptable entry for the
/// specific basic block.
uintptr_t X86JITInfo::getPICJumpTableEntry(uintptr_t BB, uintptr_t Entry) {