mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Based on this discussion: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120305/138477.html
1. Declare a virtual function getPointerToNamedFunction() in JITMemoryManager 2. Move the implementation of getPointerToNamedFunction() form JIT/MCJIT to DefaultJITMemoryManager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "llvm/CodeGen/MachineCodeInfo.h"
|
||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||
#include "llvm/ExecutionEngine/JITEventListener.h"
|
||||
#include "llvm/ExecutionEngine/JITMemoryManager.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetJITInfo.h"
|
||||
@@ -267,9 +268,9 @@ extern "C" {
|
||||
}
|
||||
|
||||
JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
|
||||
JITMemoryManager *JMM, bool GVsWithCode)
|
||||
: ExecutionEngine(M), TM(tm), TJI(tji), AllocateGVsWithCode(GVsWithCode),
|
||||
isAlreadyCodeGenerating(false) {
|
||||
JITMemoryManager *jmm, bool GVsWithCode)
|
||||
: ExecutionEngine(M), TM(tm), TJI(tji), JMM(jmm),
|
||||
AllocateGVsWithCode(GVsWithCode), isAlreadyCodeGenerating(false) {
|
||||
setTargetData(TM.getTargetData());
|
||||
|
||||
jitstate = new JITState(M);
|
||||
@@ -711,6 +712,27 @@ void *JIT::getPointerToBasicBlock(BasicBlock *BB) {
|
||||
}
|
||||
}
|
||||
|
||||
void *JIT::getPointerToNamedFunction(const std::string &Name,
|
||||
bool AbortOnFailure){
|
||||
if (!isSymbolSearchingDisabled()) {
|
||||
void *ptr = JMM->getPointerToNamedFunction(Name, false);
|
||||
if (ptr)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// If a LazyFunctionCreator is installed, use it to get/create the function.
|
||||
if (LazyFunctionCreator)
|
||||
if (void *RP = LazyFunctionCreator(Name))
|
||||
return RP;
|
||||
|
||||
if (AbortOnFailure) {
|
||||
report_fatal_error("Program used external function '"+Name+
|
||||
"' which could not be resolved!");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// getOrEmitGlobalVariable - Return the address of the specified global
|
||||
/// variable, possibly emitting it to memory if needed. This is used by the
|
||||
/// Emitter.
|
||||
|
||||
Reference in New Issue
Block a user