1 //===--- TargetProcessControlTypes.h -- Shared Core/TPC types ---*- 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 // TargetProcessControl types that are used by both the Orc and
10 // OrcTargetProcess libraries.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_TARGETPROCESSCONTROLTYPES_H
15 #define LLVM_EXECUTIONENGINE_ORC_SHARED_TARGETPROCESSCONTROLTYPES_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ExecutionEngine/JITSymbol.h"
20 
21 #include <vector>
22 
23 namespace llvm {
24 namespace orc {
25 namespace tpctypes {
26 
27 template <typename T> struct UIntWrite {
28   UIntWrite() = default;
29   UIntWrite(JITTargetAddress Address, T Value)
30       : Address(Address), Value(Value) {}
31 
32   JITTargetAddress Address = 0;
33   T Value = 0;
34 };
35 
36 /// Describes a write to a uint8_t.
37 using UInt8Write = UIntWrite<uint8_t>;
38 
39 /// Describes a write to a uint16_t.
40 using UInt16Write = UIntWrite<uint16_t>;
41 
42 /// Describes a write to a uint32_t.
43 using UInt32Write = UIntWrite<uint32_t>;
44 
45 /// Describes a write to a uint64_t.
46 using UInt64Write = UIntWrite<uint64_t>;
47 
48 /// Describes a write to a buffer.
49 /// For use with TargetProcessControl::MemoryAccess objects.
50 struct BufferWrite {
51   BufferWrite() = default;
52   BufferWrite(JITTargetAddress Address, StringRef Buffer)
53       : Address(Address), Buffer(Buffer) {}
54 
55   JITTargetAddress Address = 0;
56   StringRef Buffer;
57 };
58 
59 /// A handle used to represent a loaded dylib in the target process.
60 using DylibHandle = JITTargetAddress;
61 
62 using LookupResult = std::vector<JITTargetAddress>;
63 
64 } // end namespace tpctypes
65 } // end namespace orc
66 } // end namespace llvm
67 
68 #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_TARGETPROCESSCONTROLTYPES_H
69