diff options
author | Chris Lattner <sabre@nondot.org> | 2003-12-12 07:11:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-12-12 07:11:18 +0000 |
commit | 2e7416cb04ef722ad6cb6772f66627d50400cbb8 (patch) | |
tree | 3f8010c34b7e332193f4a4824536d8e8a101bee4 /llvm/lib | |
parent | 538dffd9fa4bf625d2dadf698e18e4c1b2771bc0 (diff) | |
download | bcm5719-llvm-2e7416cb04ef722ad6cb6772f66627d50400cbb8.tar.gz bcm5719-llvm-2e7416cb04ef722ad6cb6772f66627d50400cbb8.zip |
Implement the TargetMachine::getJITStubForFunction method for X86, finegrainify
namespacification.
llvm-svn: 10430
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86CodeEmitter.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86TargetMachine.h | 6 |
2 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86CodeEmitter.cpp b/llvm/lib/Target/X86/X86CodeEmitter.cpp index e24e2904b51..d4a87070e63 100644 --- a/llvm/lib/Target/X86/X86CodeEmitter.cpp +++ b/llvm/lib/Target/X86/X86CodeEmitter.cpp @@ -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 diff --git a/llvm/lib/Target/X86/X86TargetMachine.h b/llvm/lib/Target/X86/X86TargetMachine.h index 12f5c0e6a22..206ef89a46d 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.h +++ b/llvm/lib/Target/X86/X86TargetMachine.h @@ -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 |