[llvm] r233504 - [Orc] Use raw TargetAddresses for callback trampoline addresses, rather than IR.
Lang Hames
lhames at gmail.com
Sun Mar 29 14:55:28 PDT 2015
Author: lhames
Date: Sun Mar 29 16:55:27 2015
New Revision: 233504
URL: http://llvm.org/viewvc/llvm-project?rev=233504&view=rev
Log:
[Orc] Use raw TargetAddresses for callback trampoline addresses, rather than IR.
Add convenience function for building a typed IR Constant from trampoline
addresses.
Modified:
llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=233504&r1=233503&r2=233504&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Sun Mar 29 16:55:27 2015
@@ -258,7 +258,8 @@ private:
CompileCallbackMgr.getCompileCallback(*Proto->getFunctionType());
GlobalVariable *FunctionBodyPointer =
createImplPointer(*Proto, Name + AddrSuffix,
- CallbackInfo.getAddress());
+ createIRTypedAddress(*Proto->getFunctionType(),
+ CallbackInfo.getAddress()));
makeStub(*Proto, *FunctionBodyPointer);
F.setName(Name + BodySuffix);
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h?rev=233504&r1=233503&r2=233504&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h Sun Mar 29 16:55:27 2015
@@ -37,11 +37,11 @@ public:
/// the compile and update actions for the callback.
class CompileCallbackInfo {
public:
- CompileCallbackInfo(Constant *Addr, CompileFtor &Compile,
+ CompileCallbackInfo(TargetAddress Addr, CompileFtor &Compile,
UpdateFtor &Update)
: Addr(Addr), Compile(Compile), Update(Update) {}
- Constant* getAddress() const { return Addr; }
+ TargetAddress getAddress() const { return Addr; }
void setCompileAction(CompileFtor Compile) {
this->Compile = std::move(Compile);
}
@@ -49,7 +49,7 @@ public:
this->Update = std::move(Update);
}
private:
- Constant *Addr;
+ TargetAddress Addr;
CompileFtor &Compile;
UpdateFtor &Update;
};
@@ -139,13 +139,8 @@ public:
TargetAddress TrampolineAddr = getAvailableTrampolineAddr(FT.getContext());
auto &CallbackHandler =
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);
}
@@ -201,6 +196,15 @@ private:
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
/// pointer.
template <typename JITLayerT>
More information about the llvm-commits
mailing list