Properly implement a fix for PR475

llvm-svn: 18537
This commit is contained in:
Chris Lattner 2004-12-05 07:19:16 +00:00
parent cc6d1928d2
commit a34f9da4b4
2 changed files with 15 additions and 13 deletions

View File

@ -265,19 +265,6 @@ void *JIT::getPointerToFunction(Function *F) {
return Addr;
}
// getPointerToFunctionOrStub - If the specified function has been
// code-gen'd, return a pointer to the function. If not, compile it, or use
// a stub to implement lazy compilation if available.
//
void *JIT::getPointerToFunctionOrStub(Function *F) {
// If we have already code generated the function, just return the address.
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr;
// Otherwise, if the target doesn't support it, just codegen the function.
return getPointerToFunction(F);
}
/// getOrEmitGlobalVariable - Return the address of the specified global
/// variable, possibly emitting it to memory if needed. This is used by the
/// Emitter.

View File

@ -208,6 +208,21 @@ void *JITResolver::JITCompilerFn(void *Stub) {
}
// getPointerToFunctionOrStub - If the specified function has been
// code-gen'd, return a pointer to the function. If not, compile it, or use
// a stub to implement lazy compilation if available.
//
void *JIT::getPointerToFunctionOrStub(Function *F) {
// If we have already code generated the function, just return the address.
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr;
// Get a stub if the target supports it
return getJITResolver(MCE).getFunctionStub(F);
}
//===----------------------------------------------------------------------===//
// JITEmitter code.
//