LLVM  15.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::shared::WrapperFunctionCall Class Reference

Represents a serialized wrapper function call. More...

#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"

Public Types

using ArgDataBufferType = SmallVector< char, 24 >
 

Public Member Functions

 WrapperFunctionCall ()=default
 
 WrapperFunctionCall (ExecutorAddr FnAddr, ArgDataBufferType ArgData)
 Create a WrapperFunctionCall from a target function and arg buffer. More...
 
const ExecutorAddrgetCallee () const
 Returns the address to be called. More...
 
const ArgDataBufferTypegetArgData () const
 Returns the argument data. More...
 
 operator bool () const
 WrapperFunctionCalls convert to true if the callee is non-null. More...
 
shared::WrapperFunctionResult run () const
 Run call returning raw WrapperFunctionResult. More...
 
template<typename SPSRetT , typename RetT >
std::enable_if_t<!std::is_same< SPSRetT, void >::value, ErrorrunWithSPSRet (RetT &RetVal) const
 Run call and deserialize result using SPS. More...
 
template<typename SPSRetT >
std::enable_if_t< std::is_same< SPSRetT, void >::value, ErrorrunWithSPSRet () const
 Overload for SPS functions returning void. More...
 
Error runWithSPSRetErrorMerged () const
 Run call and deserialize an SPSError result. More...
 

Static Public Member Functions

template<typename SPSSerializer , typename... ArgTs>
static Expected< WrapperFunctionCallCreate (ExecutorAddr FnAddr, const ArgTs &...Args)
 Create a WrapperFunctionCall using the given SPS serializer to serialize the arguments. More...
 

Detailed Description

Represents a serialized wrapper function call.

Serializing calls themselves allows us to batch them: We can make one "run-wrapper-functions" utility and send it a list of calls to run.

The motivating use-case for this API is JITLink allocation actions, where we want to run multiple functions to finalize linked memory without having to make separate IPC calls for each one.

Definition at line 628 of file WrapperFunctionUtils.h.

Member Typedef Documentation

◆ ArgDataBufferType

Definition at line 630 of file WrapperFunctionUtils.h.

Constructor & Destructor Documentation

◆ WrapperFunctionCall() [1/2]

llvm::orc::shared::WrapperFunctionCall::WrapperFunctionCall ( )
default

Referenced by Create().

◆ WrapperFunctionCall() [2/2]

llvm::orc::shared::WrapperFunctionCall::WrapperFunctionCall ( ExecutorAddr  FnAddr,
ArgDataBufferType  ArgData 
)
inline

Create a WrapperFunctionCall from a target function and arg buffer.

Definition at line 650 of file WrapperFunctionUtils.h.

Member Function Documentation

◆ Create()

template<typename SPSSerializer , typename... ArgTs>
static Expected<WrapperFunctionCall> llvm::orc::shared::WrapperFunctionCall::Create ( ExecutorAddr  FnAddr,
const ArgTs &...  Args 
)
inlinestatic

Create a WrapperFunctionCall using the given SPS serializer to serialize the arguments.

Definition at line 635 of file WrapperFunctionUtils.h.

References llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::inconvertibleErrorCode(), move, llvm::X86II::OB, llvm::SmallVectorImpl< T >::resize(), size, and WrapperFunctionCall().

◆ getArgData()

const ArgDataBufferType& llvm::orc::shared::WrapperFunctionCall::getArgData ( ) const
inline

◆ getCallee()

const ExecutorAddr& llvm::orc::shared::WrapperFunctionCall::getCallee ( ) const
inline

◆ operator bool()

llvm::orc::shared::WrapperFunctionCall::operator bool ( ) const
inlineexplicit

WrapperFunctionCalls convert to true if the callee is non-null.

Definition at line 660 of file WrapperFunctionUtils.h.

◆ run()

shared::WrapperFunctionResult llvm::orc::shared::WrapperFunctionCall::run ( ) const
inline

Run call returning raw WrapperFunctionResult.

Definition at line 663 of file WrapperFunctionUtils.h.

References llvm::orc::ExecutorAddr::toPtr().

Referenced by runWithSPSRet().

◆ runWithSPSRet() [1/2]

template<typename SPSRetT >
std::enable_if_t<std::is_same<SPSRetT, void>::value, Error> llvm::orc::shared::WrapperFunctionCall::runWithSPSRet ( ) const
inline

Overload for SPS functions returning void.

Definition at line 688 of file WrapperFunctionUtils.h.

References E.

◆ runWithSPSRet() [2/2]

template<typename SPSRetT , typename RetT >
std::enable_if_t<!std::is_same<SPSRetT, void>::value, Error> llvm::orc::shared::WrapperFunctionCall::runWithSPSRet ( RetT &  RetVal) const
inline

Run call and deserialize result using SPS.

Definition at line 673 of file WrapperFunctionUtils.h.

References llvm::inconvertibleErrorCode(), run(), and llvm::Error::success().

◆ runWithSPSRetErrorMerged()

Error llvm::orc::shared::WrapperFunctionCall::runWithSPSRetErrorMerged ( ) const
inline

Run call and deserialize an SPSError result.

SPSError returns and deserialization failures are merged into the returned error.

Definition at line 695 of file WrapperFunctionUtils.h.


The documentation for this class was generated from the following file: