File indexing completed on 2026-05-10 08:44:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_SANDBOXIR_USE_H
0014 #define LLVM_SANDBOXIR_USE_H
0015
0016 #include "llvm/IR/Use.h"
0017 #include "llvm/Support/raw_ostream.h"
0018
0019 namespace llvm::sandboxir {
0020
0021 class Context;
0022 class Value;
0023 class User;
0024 class CallBase;
0025 class CallBrInst;
0026 class PHINode;
0027
0028
0029
0030
0031
0032 class Use {
0033 llvm::Use *LLVMUse;
0034 User *Usr;
0035 Context *Ctx;
0036
0037
0038 Use(llvm::Use *LLVMUse, User *Usr, Context &Ctx)
0039 : LLVMUse(LLVMUse), Usr(Usr), Ctx(&Ctx) {}
0040 Use() : LLVMUse(nullptr), Ctx(nullptr) {}
0041
0042 friend class Value;
0043 friend class User;
0044 friend class OperandUseIterator;
0045 friend class UserUseIterator;
0046 friend class CallBase;
0047 friend class CallBrInst;
0048 friend class PHINode;
0049
0050 public:
0051 operator Value *() const { return get(); }
0052 Value *get() const;
0053 void set(Value *V);
0054 class User *getUser() const { return Usr; }
0055 unsigned getOperandNo() const;
0056 void swap(Use &OtherUse);
0057 Context *getContext() const { return Ctx; }
0058 bool operator==(const Use &Other) const {
0059 assert(Ctx == Other.Ctx && "Contexts differ!");
0060 return LLVMUse == Other.LLVMUse && Usr == Other.Usr;
0061 }
0062 bool operator!=(const Use &Other) const { return !(*this == Other); }
0063 #ifndef NDEBUG
0064 void dumpOS(raw_ostream &OS) const;
0065 void dump() const;
0066 #endif
0067 };
0068
0069 }
0070
0071 #endif