5555// } // namespace sandboxir
5656//
5757
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
6060
6161#include " llvm/IR/Function.h"
6262#include " llvm/IR/User.h"
6363#include " llvm/IR/Value.h"
64+ #include " llvm/SandboxIR/Use.h"
6465#include " llvm/Support/raw_ostream.h"
6566#include < iterator>
6667
@@ -75,42 +76,6 @@ class Instruction;
7576class User ;
7677class Value ;
7778
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-
11479// / Returns the operand edge when dereferenced.
11580class OperandUseIterator {
11681 sandboxir::Use Use;
@@ -764,4 +729,4 @@ class Function : public sandboxir::Value {
764729} // namespace sandboxir
765730} // namespace llvm
766731
767- #endif // LLVM_TRANSFORMS_SANDBOXIR_SANDBOXIR_H
732+ #endif // LLVM_SANDBOXIR_SANDBOXIR_H
0 commit comments