LLVM 24.0.0git
SPSHandlerSpec.h
Go to the documentation of this file.
1//===- SPSHandlerSpec.h - SPS call-controller handlers ----------*- 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// HandlerSpec binds call-controller handlers (handlers in the controller that
10// the ORC runtime calls via its call-controller mechanism) using Simple Packed
11// Serialization to decode arguments and encode results.
12//
13// A HandlerSpec is built from a handler descriptor, which supplies the default
14// tag name and the wire signature. It mirrors ProxySpec, which plays the same
15// role for calls from the controller to the executor.
16//
17//===----------------------------------------------------------------------===//
18
19#ifndef LLVM_EXECUTIONENGINE_ORC_SPSHANDLERSPEC_H
20#define LLVM_EXECUTIONENGINE_ORC_SPSHANDLERSPEC_H
21
25
26#include <utility>
27
28namespace llvm::orc::sps {
29
30/// Binds handlers for the call described by Descriptor, which must provide:
31///
32/// static constexpr SymbolNameSpec Name; // The default tag name.
33/// using SPSSig = ...; // The call's SPS signature.
34///
35/// Use with bindCallControllerHandler.
36template <typename Descriptor> class HandlerSpec {
37public:
38 static constexpr SymbolNameSpec Name = Descriptor::Name;
39
40 /// Wrap H as a handler for the call. H takes a sender for the call's result,
41 /// followed by the call's arguments.
42 template <typename HandlerT>
44 return [H = std::forward<HandlerT>(H)](
46 shared::WrapperFunctionBuffer ArgBytes) mutable {
48 ArgBytes.data(), ArgBytes.size(), std::move(Return), H);
49 };
50 }
51};
52
53} // namespace llvm::orc::sps
54
55#endif // LLVM_EXECUTIONENGINE_ORC_SPSHANDLERSPEC_H
#define H(x, y, z)
Definition MD5.cpp:56
unique_function< void(shared::WrapperFunctionBuffer)> CallControllerReturnFn
Function type for returning results from a call-controller handler.
Definition Core.h:1117
unique_function< void( CallControllerReturnFn, shared::WrapperFunctionBuffer)> CallControllerHandlerFn
A call-controller handler: handles calls from the executor made via the ORC runtime's call-controller...
Definition Core.h:1122
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.
Binds handlers for the call described by Descriptor, which must provide:
static ExecutionSession::CallControllerHandlerFn wrap(HandlerT &&H)
Wrap H as a handler for the call.
static constexpr SymbolNameSpec Name