//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/Config/alloca.h"
#include <cstdlib>
+#include <cstring>
using namespace llvm;
#ifdef _MSC_VER
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((intptr_t)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.
return MCE.finishFunctionStub(0);
}
+/// getPICJumpTableEntry - Returns the value of the jumptable entry for the
+/// specific basic block.
+intptr_t X86JITInfo::getPICJumpTableEntry(intptr_t BB, intptr_t Entry) {
+ return BB - PICBase;
+}
+
/// relocate - Before the JIT can run a block of code that has been emitted,
/// it must rewrite the code to contain the actual addresses of any
/// referenced global symbols.