[llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86TargetMachine.h

Chris Lattner lattner at cs.uiuc.edu
Fri Dec 12 01:12:03 PST 2003


Changes in directory llvm/lib/Target/X86:

X86CodeEmitter.cpp updated: 1.40 -> 1.41
X86TargetMachine.h updated: 1.17 -> 1.18

---
Log message:

Implement the TargetMachine::getJITStubForFunction method for X86, finegrainify
namespacification.


---
Diffs of the changes:  (+13 -4)

Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.40 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.41
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.40	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp	Fri Dec 12 01:11:18 2003
@@ -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 @@
   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 @@
     break;
   }
 }
-
-} // End llvm namespace


Index: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.17 llvm/lib/Target/X86/X86TargetMachine.h:1.18
--- llvm/lib/Target/X86/X86TargetMachine.h:1.17	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Target/X86/X86TargetMachine.h	Fri Dec 12 01:11:18 2003
@@ -55,6 +55,12 @@
   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





More information about the llvm-commits mailing list