LLVM 20.0.0git
ExecutorSymbolDef.h
Go to the documentation of this file.
1//===--------- ExecutorSymbolDef.h - (Addr, Flags) pair ---------*- 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// Represents a defining location for a JIT symbol.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORSYMBOLDEF_H
14#define LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORSYMBOLDEF_H
15
19
20namespace llvm {
21namespace orc {
22
23/// Represents a defining location for a JIT symbol.
25public:
26 ExecutorSymbolDef() = default;
28 : Addr(Addr), Flags(Flags) {}
29
30 const ExecutorAddr &getAddress() const { return Addr; }
31
32 const JITSymbolFlags &getFlags() const { return Flags; }
33
34 void setFlags(JITSymbolFlags Flags) { this->Flags = Flags; }
35
36 friend bool operator==(const ExecutorSymbolDef &LHS,
37 const ExecutorSymbolDef &RHS) {
38 return LHS.getAddress() == RHS.getAddress() &&
39 LHS.getFlags() == RHS.getFlags();
40 }
41
42 friend bool operator!=(const ExecutorSymbolDef &LHS,
43 const ExecutorSymbolDef &RHS) {
44 return !(LHS == RHS);
45 }
46
47private:
48 ExecutorAddr Addr;
49 JITSymbolFlags Flags;
50};
51
52namespace shared {
53
56
57/// SPS serializatior for JITSymbolFlags.
60
61public:
62 static size_t size(const JITSymbolFlags &F) {
63 return FlagsArgList::size(F.getRawFlagsValue(), F.getTargetFlags());
64 }
65
66 static bool serialize(SPSOutputBuffer &BOB, const JITSymbolFlags &F) {
67 return FlagsArgList::serialize(BOB, F.getRawFlagsValue(),
68 F.getTargetFlags());
69 }
70
74 if (!FlagsArgList::deserialize(BIB, RawFlags, TargetFlags))
75 return false;
76 F = JITSymbolFlags{static_cast<JITSymbolFlags::FlagNames>(RawFlags),
77 TargetFlags};
78 return true;
79 }
80};
81
83
84/// SPS serializatior for ExecutorSymbolDef.
85template <>
88
89public:
90 static size_t size(const ExecutorSymbolDef &ESD) {
91 return DefArgList::size(ESD.getAddress(), ESD.getFlags());
92 }
93
94 static bool serialize(SPSOutputBuffer &BOB, const ExecutorSymbolDef &ESD) {
95 return DefArgList::serialize(BOB, ESD.getAddress(), ESD.getFlags());
96 }
97
100 JITSymbolFlags Flags;
101 if (!DefArgList::deserialize(BIB, Addr, Flags))
102 return false;
103 ESD = ExecutorSymbolDef{Addr, Flags};
104 return true;
105 }
106};
107
108} // End namespace shared.
109} // End namespace orc.
110} // End namespace llvm.
111
112#endif // LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORSYMBOLDEF_H
uint64_t Addr
#define F(x, y, z)
Definition: MD5.cpp:55
Value * RHS
Value * LHS
Flags for symbols in the JIT.
Definition: JITSymbol.h:74
uint8_t TargetFlagsType
Definition: JITSymbol.h:77
uint8_t UnderlyingType
Definition: JITSymbol.h:76
Represents an address in the executor process.
Represents a defining location for a JIT symbol.
void setFlags(JITSymbolFlags Flags)
friend bool operator==(const ExecutorSymbolDef &LHS, const ExecutorSymbolDef &RHS)
friend bool operator!=(const ExecutorSymbolDef &LHS, const ExecutorSymbolDef &RHS)
ExecutorSymbolDef(ExecutorAddr Addr, JITSymbolFlags Flags)
const JITSymbolFlags & getFlags() const
const ExecutorAddr & getAddress() const
A utility class for serializing to a blob from a variadic list.
Input char buffer with underflow check.
Output char buffer with overflow check.
static bool deserialize(SPSInputBuffer &BIB, ExecutorSymbolDef &ESD)
static bool serialize(SPSOutputBuffer &BOB, const ExecutorSymbolDef &ESD)
static bool serialize(SPSOutputBuffer &BOB, const JITSymbolFlags &F)
Specialize to describe how to serialize/deserialize to/from the given concrete type.
SPSArgList< SPSTagTs... > AsArgList
Convenience typedef of the corresponding arg list.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18