File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
llvm/lib/ExecutionEngine/JIT Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,23 @@ void *VM::getPointerToFunction(Function *F) {
77
77
return Addr;
78
78
}
79
79
80
+ // getPointerToFunctionOrStub - If the specified function has been
81
+ // code-gen'd, return a pointer to the function. If not, compile it, or use
82
+ // a stub to implement lazy compilation if available.
83
+ //
84
+ void *VM::getPointerToFunctionOrStub (Function *F) {
85
+ // If we have already code generated the function, just return the address.
86
+ std::map<const GlobalValue*, void *>::iterator I = GlobalAddress.find (F);
87
+ if (I != GlobalAddress.end ()) return I->second ;
88
+
89
+ // If the target supports "stubs" for functions, get a stub now.
90
+ if (void *Ptr = TM.getJITStubForFunction (F, *MCE))
91
+ return Ptr;
92
+
93
+ // Otherwise, if the target doesn't support it, just codegen the function.
94
+ return getPointerToFunction (F);
95
+ }
96
+
80
97
// / recompileAndRelinkFunction - This method is used to force a function
81
98
// / which has already been compiled, to be compiled again, possibly
82
99
// / after it has been modified. Then the entry to the old copy is overwritten
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ class VM : public ExecutionEngine {
66
66
// /
67
67
void *getPointerToFunction (Function *F);
68
68
69
+ // / getPointerToFunctionOrStub - If the specified function has been
70
+ // / code-gen'd, return a pointer to the function. If not, compile it, or use
71
+ // / a stub to implement lazy compilation if available.
72
+ // /
73
+ void *getPointerToFunctionOrStub (Function *F);
74
+
69
75
// / recompileAndRelinkFunction - This method is used to force a function
70
76
// / which has already been compiled, to be compiled again, possibly
71
77
// / after it has been modified. Then the entry to the old copy is overwritten
You can’t perform that action at this time.
0 commit comments