55
55
// } // namespace sandboxir
56
56
//
57
57
58
- #ifndef LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
59
- #define LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
58
+ #ifndef LLVM_SANDBOXIR_SANDBOXIR_H
59
+ #define LLVM_SANDBOXIR_SANDBOXIR_H
60
60
61
61
#include " llvm/IR/Function.h"
62
62
#include " llvm/IR/User.h"
63
63
#include " llvm/IR/Value.h"
64
+ #include " llvm/SandboxIR/Use.h"
64
65
#include " llvm/Support/raw_ostream.h"
65
66
#include < iterator>
66
67
@@ -75,42 +76,6 @@ class Instruction;
75
76
class User ;
76
77
class Value ;
77
78
78
- // / Represents a Def-use/Use-def edge in SandboxIR.
79
- // / NOTE: Unlike llvm::Use, this is not an integral part of the use-def chains.
80
- // / It is also not uniqued and is currently passed by value, so you can have
81
- // / more than one sandboxir::Use objects for the same use-def edge.
82
- class Use {
83
- llvm::Use *LLVMUse;
84
- User *Usr;
85
- Context *Ctx;
86
-
87
- // / Don't allow the user to create a sandboxir::Use directly.
88
- Use (llvm::Use *LLVMUse, User *Usr, Context &Ctx)
89
- : LLVMUse(LLVMUse), Usr(Usr), Ctx(&Ctx) {}
90
- Use () : LLVMUse(nullptr ), Ctx(nullptr ) {}
91
-
92
- friend class Value ; // For constructor
93
- friend class User ; // For constructor
94
- friend class OperandUseIterator ; // For constructor
95
- friend class UserUseIterator ; // For accessing members
96
-
97
- public:
98
- operator Value *() const { return get (); }
99
- Value *get () const ;
100
- class User *getUser () const { return Usr; }
101
- unsigned getOperandNo () const ;
102
- Context *getContext () const { return Ctx; }
103
- bool operator ==(const Use &Other) const {
104
- assert (Ctx == Other.Ctx && " Contexts differ!" );
105
- return LLVMUse == Other.LLVMUse && Usr == Other.Usr ;
106
- }
107
- bool operator !=(const Use &Other) const { return !(*this == Other); }
108
- #ifndef NDEBUG
109
- void dump (raw_ostream &OS) const ;
110
- void dump () const ;
111
- #endif // NDEBUG
112
- };
113
-
114
79
// / Returns the operand edge when dereferenced.
115
80
class OperandUseIterator {
116
81
sandboxir::Use Use;
@@ -764,4 +729,4 @@ class Function : public sandboxir::Value {
764
729
} // namespace sandboxir
765
730
} // namespace llvm
766
731
767
- #endif // LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
732
+ #endif // LLVM_SANDBOXIR_SANDBOXIR_H
0 commit comments