Skip to content

Commit a34f9da

Browse files
committed
Properly implement a fix for PR475
llvm-svn: 18537
1 parent cc6d192 commit a34f9da

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

llvm/lib/ExecutionEngine/JIT/JIT.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -265,19 +265,6 @@ void *JIT::getPointerToFunction(Function *F) {
265265
return Addr;
266266
}
267267

268-
// getPointerToFunctionOrStub - If the specified function has been
269-
// code-gen'd, return a pointer to the function. If not, compile it, or use
270-
// a stub to implement lazy compilation if available.
271-
//
272-
void *JIT::getPointerToFunctionOrStub(Function *F) {
273-
// If we have already code generated the function, just return the address.
274-
if (void *Addr = getPointerToGlobalIfAvailable(F))
275-
return Addr;
276-
277-
// Otherwise, if the target doesn't support it, just codegen the function.
278-
return getPointerToFunction(F);
279-
}
280-
281268
/// getOrEmitGlobalVariable - Return the address of the specified global
282269
/// variable, possibly emitting it to memory if needed. This is used by the
283270
/// Emitter.

llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,21 @@ void *JITResolver::JITCompilerFn(void *Stub) {
208208
}
209209

210210

211+
// getPointerToFunctionOrStub - If the specified function has been
212+
// code-gen'd, return a pointer to the function. If not, compile it, or use
213+
// a stub to implement lazy compilation if available.
214+
//
215+
void *JIT::getPointerToFunctionOrStub(Function *F) {
216+
// If we have already code generated the function, just return the address.
217+
if (void *Addr = getPointerToGlobalIfAvailable(F))
218+
return Addr;
219+
220+
// Get a stub if the target supports it
221+
return getJITResolver(MCE).getFunctionStub(F);
222+
}
223+
224+
225+
211226
//===----------------------------------------------------------------------===//
212227
// JITEmitter code.
213228
//

0 commit comments

Comments
 (0)