aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86JITInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-04 10:46:51 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-04 10:46:51 +0000
commitbe8c03fc66b75fa775e1f47d62a1b0d803fced1c (patch)
treef7d4aff605c112d72392dd096356c1b12e72ce62 /lib/Target/X86/X86JITInfo.cpp
parent2674d71df02f562cf8c3bc011be92d6dcb9cd9aa (diff)
X86 PIC JIT support fixes: encoding bugs, add lazy pointer stubs support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86JITInfo.cpp')
-rw-r--r--lib/Target/X86/X86JITInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp
index af1a8b8947..d5d3cda2dc 100644
--- a/lib/Target/X86/X86JITInfo.cpp
+++ b/lib/Target/X86/X86JITInfo.cpp
@@ -380,6 +380,18 @@ X86JITInfo::getLazyResolverFunction(JITCompilerFn F) {
return X86CompilationCallback;
}
+void *X86JITInfo::emitGlobalValueLazyPtr(void *GV, MachineCodeEmitter &MCE) {
+#ifdef __x86_64__
+ MCE.startFunctionStub(8, 8);
+ MCE.emitWordLE(((unsigned *)&GV)[0]);
+ MCE.emitWordLE(((unsigned *)&GV)[1]);
+#else
+ MCE.startFunctionStub(4, 4);
+ MCE.emitWordLE((unsigned)GV);
+#endif
+ return MCE.finishFunctionStub(0);
+}
+
void *X86JITInfo::emitFunctionStub(void *Fn, 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.