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 
16 #include "llvm/ExecutionEngine/JITSymbol.h"
17 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
18 
19 namespace llvm {
20 namespace orc {
21 
22 /// Represents a defining location for a JIT symbol.
23 class ExecutorSymbolDef {
24 public:
25   ExecutorSymbolDef() = default;
26   ExecutorSymbolDef(ExecutorAddr Addr, JITSymbolFlags Flags)
27     : Addr(Addr), Flags(Flags) {}
28 
29   const ExecutorAddr &getAddress() const { return Addr; }
30 
31   const JITSymbolFlags &getFlags() const { return Flags; }
32 
33   void setFlags(JITSymbolFlags Flags) { this->Flags = Flags; }
34 
35   friend bool operator==(const ExecutorSymbolDef &LHS,
36                          const ExecutorSymbolDef &RHS) {
37     return LHS.getAddress() == RHS.getAddress() &&
38            LHS.getFlags() == RHS.getFlags();
39   }
40 
41   friend bool operator!=(const ExecutorSymbolDef &LHS,
42                          const ExecutorSymbolDef &RHS) {
43     return !(LHS == RHS);
44   }
45 
46 private:
47   ExecutorAddr Addr;
48   JITSymbolFlags Flags;
49 };
50 
51 } // End namespace orc.
52 } // End namespace llvm.
53 
54 #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORSYMBOLDEF_H
55