Implement the TargetMachine::getJITStubForFunction method for X86, finegrainify
authorChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2003 07:11:18 +0000 (07:11 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2003 07:11:18 +0000 (07:11 +0000)
namespacification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10430 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86CodeEmitter.cpp
lib/Target/X86/X86TargetMachine.h

index e24e2904b51e957b57ed18e23577208e8663a299..d4a87070e633612274ee9affe2a1afa09892dc9b 100644 (file)
@@ -23,8 +23,7 @@
 #include "Support/Debug.h"
 #include "Support/Statistic.h"
 #include "Config/alloca.h"
-
-namespace llvm {
+using namespace llvm;
 
 namespace {
   Statistic<>
@@ -54,6 +53,12 @@ namespace {
   JITResolver *TheJITResolver;
 }
 
+void *X86TargetMachine::getJITStubForFunction(Function *F,
+                                              MachineCodeEmitter &MCE) {
+  if (TheJITResolver == 0)
+    TheJITResolver = new JITResolver(MCE);
+  return (void*)TheJITResolver->getLazyResolver(F);
+}
 
 /// addFunctionReference - This method is called when we need to emit the
 /// address of a function that has not yet been emitted, so we don't know the
@@ -591,5 +596,3 @@ void Emitter::emitInstruction(MachineInstr &MI) {
     break;
   }
 }
-
-} // End llvm namespace
index 12f5c0e6a22ba17aa36d37a0a7731b7c2590f907..206ef89a46d48623450c3c8b1d9a3355232c4a4e 100644 (file)
@@ -55,6 +55,12 @@ public:
   virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
 
   virtual void replaceMachineCodeForFunction (void *Old, void *New);
+
+  /// getJITStubForFunction - Create or return a stub for the specified
+  /// function.  This stub acts just like the specified function, except that it
+  /// allows the "address" of the function to be taken without having to
+  /// generate code for it.
+  virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE);
 };
 
 } // End llvm namespace