mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-23 16:30:00 +00:00
[Orc] Use raw TargetAddresses for callback trampoline addresses, rather than IR.
Add convenience function for building a typed IR Constant from trampoline addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
19d058836a
commit
7a2870e2e2
@ -258,7 +258,8 @@ private:
|
|||||||
CompileCallbackMgr.getCompileCallback(*Proto->getFunctionType());
|
CompileCallbackMgr.getCompileCallback(*Proto->getFunctionType());
|
||||||
GlobalVariable *FunctionBodyPointer =
|
GlobalVariable *FunctionBodyPointer =
|
||||||
createImplPointer(*Proto, Name + AddrSuffix,
|
createImplPointer(*Proto, Name + AddrSuffix,
|
||||||
CallbackInfo.getAddress());
|
createIRTypedAddress(*Proto->getFunctionType(),
|
||||||
|
CallbackInfo.getAddress()));
|
||||||
makeStub(*Proto, *FunctionBodyPointer);
|
makeStub(*Proto, *FunctionBodyPointer);
|
||||||
|
|
||||||
F.setName(Name + BodySuffix);
|
F.setName(Name + BodySuffix);
|
||||||
|
@ -37,11 +37,11 @@ public:
|
|||||||
/// the compile and update actions for the callback.
|
/// the compile and update actions for the callback.
|
||||||
class CompileCallbackInfo {
|
class CompileCallbackInfo {
|
||||||
public:
|
public:
|
||||||
CompileCallbackInfo(Constant *Addr, CompileFtor &Compile,
|
CompileCallbackInfo(TargetAddress Addr, CompileFtor &Compile,
|
||||||
UpdateFtor &Update)
|
UpdateFtor &Update)
|
||||||
: Addr(Addr), Compile(Compile), Update(Update) {}
|
: Addr(Addr), Compile(Compile), Update(Update) {}
|
||||||
|
|
||||||
Constant* getAddress() const { return Addr; }
|
TargetAddress getAddress() const { return Addr; }
|
||||||
void setCompileAction(CompileFtor Compile) {
|
void setCompileAction(CompileFtor Compile) {
|
||||||
this->Compile = std::move(Compile);
|
this->Compile = std::move(Compile);
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
this->Update = std::move(Update);
|
this->Update = std::move(Update);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Constant *Addr;
|
TargetAddress Addr;
|
||||||
CompileFtor &Compile;
|
CompileFtor &Compile;
|
||||||
UpdateFtor &Update;
|
UpdateFtor &Update;
|
||||||
};
|
};
|
||||||
@ -139,13 +139,8 @@ public:
|
|||||||
TargetAddress TrampolineAddr = getAvailableTrampolineAddr(FT.getContext());
|
TargetAddress TrampolineAddr = getAvailableTrampolineAddr(FT.getContext());
|
||||||
auto &CallbackHandler =
|
auto &CallbackHandler =
|
||||||
this->ActiveTrampolines[TrampolineAddr];
|
this->ActiveTrampolines[TrampolineAddr];
|
||||||
Constant *AddrIntVal =
|
|
||||||
ConstantInt::get(Type::getInt64Ty(FT.getContext()), TrampolineAddr);
|
|
||||||
Constant *AddrPtrVal =
|
|
||||||
ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
|
|
||||||
PointerType::get(&FT, 0));
|
|
||||||
|
|
||||||
return CompileCallbackInfo(AddrPtrVal, CallbackHandler.Compile,
|
return CompileCallbackInfo(TrampolineAddr, CallbackHandler.Compile,
|
||||||
CallbackHandler.Update);
|
CallbackHandler.Update);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +196,15 @@ private:
|
|||||||
TargetAddress ResolverBlockAddr;
|
TargetAddress ResolverBlockAddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Constant* createIRTypedAddress(FunctionType &FT, TargetAddress Addr) {
|
||||||
|
Constant *AddrIntVal =
|
||||||
|
ConstantInt::get(Type::getInt64Ty(FT.getContext()), Addr);
|
||||||
|
Constant *AddrPtrVal =
|
||||||
|
ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
|
||||||
|
PointerType::get(&FT, 0));
|
||||||
|
return AddrPtrVal;
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Get an update functor for updating the value of a named function
|
/// @brief Get an update functor for updating the value of a named function
|
||||||
/// pointer.
|
/// pointer.
|
||||||
template <typename JITLayerT>
|
template <typename JITLayerT>
|
||||||
|
Loading…
Reference in New Issue
Block a user