]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h
zfs: merge openzfs/zfs@86783d7d9 (zfs-2.1-release) into stable/13
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / include / llvm / ExecutionEngine / Orc / EPCEHFrameRegistrar.h
1 //===-- EPCEHFrameRegistrar.h - EPC based eh-frame registration -*- 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 // ExecutorProcessControl based eh-frame registration.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
14 #define LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H
15
16 #include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
17 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
18
19 namespace llvm {
20 namespace orc {
21
22 class ExecutionSession;
23
24 /// Register/Deregisters EH frames in a remote process via a
25 /// ExecutorProcessControl instance.
26 class EPCEHFrameRegistrar : public jitlink::EHFrameRegistrar {
27 public:
28   /// Create from a ExecutorProcessControl instance alone. This will use
29   /// the EPC's lookupSymbols method to find the registration/deregistration
30   /// funciton addresses by name.
31   static Expected<std::unique_ptr<EPCEHFrameRegistrar>>
32   Create(ExecutionSession &ES);
33
34   /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
35   /// object and registration/deregistration function addresses.
36   EPCEHFrameRegistrar(ExecutionSession &ES,
37                       ExecutorAddr RegisterEHFrameWrapperFnAddr,
38                       ExecutorAddr DeregisterEHFRameWrapperFnAddr)
39       : ES(ES), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr),
40         DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {}
41
42   Error registerEHFrames(ExecutorAddrRange EHFrameSection) override;
43   Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override;
44
45 private:
46   ExecutionSession &ES;
47   ExecutorAddr RegisterEHFrameWrapperFnAddr;
48   ExecutorAddr DeregisterEHFrameWrapperFnAddr;
49 };
50
51 } // end namespace orc
52 } // end namespace llvm
53
54 #endif // LLVM_EXECUTIONENGINE_ORC_EPCEHFRAMEREGISTRAR_H