Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
[oota-llvm.git] / lib / Target / X86 / X86JITInfo.cpp
index fdc33ba482f9d2c547e719da422fbcf123c1f235..cb16c6c26b99201c2a064ff7fa8e467826debe53 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     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.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -18,6 +18,7 @@
 #include "llvm/CodeGen/MachineCodeEmitter.h"
 #include "llvm/Config/alloca.h"
 #include <cstdlib>
+#include <cstring>
 using namespace llvm;
 
 #ifdef _MSC_VER
@@ -380,6 +381,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((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.
@@ -428,6 +441,12 @@ void *X86JITInfo::emitFunctionStub(void *Fn, MachineCodeEmitter &MCE) {
   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.