LLVM 24.0.0git
BindCallControllerHandlerSPS.h
Go to the documentation of this file.
1//===--------------- BindCallControllerHandlerSPS.h -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Convenience functions for building call-controller handlers using SPS
10// serialization / deserialization.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_EXECUTIONENGINE_ORC_BINDCALLCONTROLLERHANDLERSPS_H
15#define LLVM_EXECUTIONENGINE_ORC_BINDCALLCONTROLLERHANDLERSPS_H
16
21
22namespace llvm::orc {
23
24/// Bind a call-controller handler that takes concrete argument types (and a
25/// sender for a concrete return type) to the tag with the given name. Uses SPS
26/// to unpack the arguments and pack the result.
27template <typename SPSSigT, typename HandlerT>
29 SymbolNameSpec Name, HandlerT &&Handler,
32 Name,
33 [Handler = std::forward<HandlerT>(Handler)](
35 shared::WrapperFunctionBuffer ArgBytes) mutable {
37 ArgBytes.data(), ArgBytes.size(), std::move(Return), Handler);
38 },
39 LF);
40}
41
42/// Bind a class method as a call-controller handler. The method takes
43/// concrete argument types (and a sender for a concrete return type). Uses SPS
44/// to unpack the arguments and pack the result.
45template <typename SPSSigT, typename ClassT, typename... MethodArgTs>
47 SymbolNameSpec Name, ClassT *Instance,
48 void (ClassT::*Method)(MethodArgTs...),
51 Name,
52 [Instance, Method](MethodArgTs &&...MethodArgs) {
53 (Instance->*Method)(std::forward<MethodArgTs>(MethodArgs)...);
54 },
55 LF);
56}
57
58} // namespace llvm::orc
59
60#endif // LLVM_EXECUTIONENGINE_ORC_BINDCALLCONTROLLERHANDLERSPS_H
Associates a call-controller handler with the name of the tag symbol that the executor will use to ca...
Definition Core.h:1141
unique_function< void(shared::WrapperFunctionBuffer)> CallControllerReturnFn
Function type for returning results from a call-controller handler.
Definition Core.h:1125
A symbol name together with the naming level (SymbolNameKind) it is expressed in, so that a Mangler /...
C++ wrapper function buffer: Same as CWrapperFunctionBuffer but auto-releases memory.
size_t size() const
Returns the size of the data contained in this instance.
char * data()
Get a pointer to the data contained in this instance.
ExecutionSession::CallControllerHandlerBinding bindCallControllerHandlerSPS(SymbolNameSpec Name, HandlerT &&Handler, SymbolLookupFlags LF=SymbolLookupFlags::RequiredSymbol)
Bind a call-controller handler that takes concrete argument types (and a sender for a concrete return...
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
static std::unique_ptr< UnwindInfoManager > Instance