diff options
author | Lang Hames <lhames@gmail.com> | 2015-03-24 04:27:02 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2015-03-24 04:27:02 +0000 |
commit | cd118e7632383c431c24c11168c61c12ce43d645 (patch) | |
tree | e2af1f5e7d8b92e8faca9e8b2ee9080ab5887655 /llvm | |
parent | 96a1004db289d0572d51a762953b302947c3fa13 (diff) | |
download | bcm5719-llvm-cd118e7632383c431c24c11168c61c12ce43d645.tar.gz bcm5719-llvm-cd118e7632383c431c24c11168c61c12ce43d645.zip |
[Orc] Move delta-handling for trampoline sizes into the resolver block.
This is the first step towards adding a target-independent callback
handler API.
llvm-svn: 233049
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h | 2 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h index e9d3d34085d..6168684950a 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h @@ -56,7 +56,7 @@ public: // Moving the trampoline ID back to the available list first means there's at // least one available trampoline if the compile action triggers a request for // a new one. - AvailableTrampolines.push_back(I->first - TargetT::CallSize); + AvailableTrampolines.push_back(I->first); auto CallbackHandler = std::move(I->second); ActiveTrampolines.erase(I); @@ -140,7 +140,7 @@ public: CompileCallbackInfo getCompileCallback(FunctionType &FT) { TargetAddress TrampolineAddr = getAvailableTrampolineAddr(FT.getContext()); auto &CallbackHandler = - this->ActiveTrampolines[TrampolineAddr + TargetT::CallSize]; + this->ActiveTrampolines[TrampolineAddr]; Constant *AddrIntVal = ConstantInt::get(Type::getInt64Ty(FT.getContext()), TrampolineAddr); Constant *AddrPtrVal = diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h index c6f866a0469..045528b865b 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h @@ -32,8 +32,6 @@ public: /// @brief Get a label name from the given index. typedef std::function<std::string(unsigned)> LabelNameFtor; - static const unsigned CallSize = 6; - /// @brief Insert the requested number of trampolines into the given module. /// @param M Module to insert the call block into. /// @param NumCalls Number of calls to create in the call block. diff --git a/llvm/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp b/llvm/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp index b5dda8e4ee5..4932ec16bb0 100644 --- a/llvm/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp +++ b/llvm/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp @@ -53,6 +53,7 @@ const char* OrcX86_64::ResolverBlockName = "orc_resolver_block"; void OrcX86_64::insertResolverBlock( Module &M, JITCompileCallbackManagerBase<OrcX86_64> &JCBM) { + const unsigned X86_64_TrampolineLength = 6; auto CallbackPtr = executeCompileCallback<OrcX86_64>; uint64_t CallbackAddr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(CallbackPtr)); @@ -77,6 +78,7 @@ void OrcX86_64::insertResolverBlock( AsmStream << " leaq jit_callback_manager_addr(%rip), %rdi\n" << " movq (%rdi), %rdi\n" << " movq " << ReturnAddrOffset << "(%rsp), %rsi\n" + << " subq $" << X86_64_TrampolineLength << ", %rsi\n" << " movabsq $" << CallbackAddr << ", %rax\n" << " callq *%rax\n" << " movq %rax, " << ReturnAddrOffset << "(%rsp)\n"; |