Index: llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h =================================================================== --- llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h +++ llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h @@ -259,6 +259,13 @@ virtual Expected runAsMain(ExecutorAddr MainFnAddr, ArrayRef Args) = 0; + /// Run function with a int (*)(void) signature. + virtual Expected runAsVoidFunction(ExecutorAddr VoidFnAddr) = 0; + + /// Run function with a int (*)(int) signature. + virtual Expected runAsIntFunction(ExecutorAddr IntFnAddr, + int Arg) = 0; + /// Run a wrapper function in the executor. The given WFRHandler will be /// called on the result when it is returned. /// @@ -397,6 +404,14 @@ llvm_unreachable("Unsupported"); } + Expected runAsVoidFunction(ExecutorAddr VoidFnAddr) override { + llvm_unreachable("Unsupported"); + } + + Expected runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override { + llvm_unreachable("Unsupported"); + } + void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef ArgBuffer) override { @@ -434,6 +449,10 @@ Expected runAsMain(ExecutorAddr MainFnAddr, ArrayRef Args) override; + Expected runAsVoidFunction(ExecutorAddr VoidFnAddr) override; + + Expected runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override; + void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef ArgBuffer) override; Index: llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp =================================================================== --- llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp +++ llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp @@ -121,6 +121,18 @@ return orc::runAsMain(MainFnAddr.toPtr(), Args); } +Expected +SelfExecutorProcessControl::runAsVoidFunction(ExecutorAddr VoidFnAddr) { + using VoidTy = int (*)(); + return VoidFnAddr.toPtr()(); +} + +Expected +SelfExecutorProcessControl::runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) { + using IntTy = int (*)(int); + return IntFnAddr.toPtr()(Arg); +} + void SelfExecutorProcessControl::callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler SendResult, ArrayRef ArgBuffer) {