aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.h
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
committerNate Begeman <natebegeman@mac.com>2009-02-18 08:31:02 +0000
commitd6b7a242d345fd79a337afd384bb586c5619cfe7 (patch)
treecc149d70595f6859c7607a5129ce01ce9a98e0bb /lib/ExecutionEngine/JIT/JIT.h
parent98c507ed5c2883bc8ef487d952e851da37f8b32f (diff)
Add support to the JIT for true non-lazy operation. When a call to a function
that has not been JIT'd yet, the callee is put on a list of pending functions to JIT. The call is directed through a stub, which is updated with the address of the function after it has been JIT'd. A new interface for allocating and updating empty stubs is provided. Add support for removing the ModuleProvider the JIT was created with, which would otherwise invalidate the JIT's PassManager, which is initialized with the ModuleProvider's Module. Add support under a new ExecutionEngine flag for emitting the infomration necessary to update Function and GlobalVariable stubs after JITing them, by recording the address of the stub and the name of the GlobalValue. This allows code to be copied from one address space to another, where libraries may live at different virtual addresses, and have the stubs updated with their new correct target addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.h')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h
index 395e04926d..e0c74f8738 100644
--- a/lib/ExecutionEngine/JIT/JIT.h
+++ b/lib/ExecutionEngine/JIT/JIT.h
@@ -20,8 +20,6 @@
namespace llvm {
class Function;
-class GlobalValue;
-class Constant;
class TargetMachine;
class TargetJITInfo;
class MachineCodeEmitter;
@@ -29,21 +27,22 @@ class MachineCodeEmitter;
class JITState {
private:
FunctionPassManager PM; // Passes to compile a function
+ ModuleProvider *MP; // ModuleProvider used to create the PM
- /// PendingGlobals - Global variables which have had memory allocated for them
- /// while a function was code generated, but which have not been initialized
- /// yet.
- std::vector<const GlobalVariable*> PendingGlobals;
+ /// PendingFunctions - Functions which have not been code generated yet, but
+ /// were called from a function being code generated.
+ std::vector<Function*> PendingFunctions;
public:
- explicit JITState(ModuleProvider *MP) : PM(MP) {}
+ explicit JITState(ModuleProvider *MP) : PM(MP), MP(MP) {}
FunctionPassManager &getPM(const MutexGuard &L) {
return PM;
}
-
- std::vector<const GlobalVariable*> &getPendingGlobals(const MutexGuard &L) {
- return PendingGlobals;
+
+ ModuleProvider *getMP() const { return MP; }
+ std::vector<Function*> &getPendingFunctions(const MutexGuard &L) {
+ return PendingFunctions;
}
};
@@ -139,6 +138,12 @@ public:
///
void freeMachineCodeForFunction(Function *F);
+ /// addPendingFunction - while jitting non-lazily, a called but non-codegen'd
+ /// function was encountered. Add it to a pending list to be processed after
+ /// the current function.
+ ///
+ void addPendingFunction(Function *F);
+
/// getCodeEmitter - Return the code emitter this JIT is emitting into.
MachineCodeEmitter *getCodeEmitter() const { return MCE; }
@@ -149,7 +154,9 @@ private:
static MachineCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM);
void runJITOnFunction(Function *F);
void runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked);
-
+ void updateFunctionStub(Function *F);
+ void updateDlsymStubTable();
+
protected:
/// getMemoryforGV - Allocate memory for a global variable.