17 assert(
Use.LLVMUse !=
nullptr &&
"Already at end!");
27 assert(LLVMUse !=
nullptr &&
"Already at end!");
28 LLVMUse = LLVMUse->getNext();
29 if (LLVMUse ==
nullptr) {
34 auto *LLVMUser = LLVMUse->getUser();
35 Use.Usr = cast_or_null<sandboxir::User>(Ctx->getValue(LLVMUser));
54 int OtherOpNo =
Other.Use.getOperandNo();
55 return ThisOpNo - OtherOpNo;
60 assert(isa<llvm::User>(
Val) &&
"Non-users have no operands!");
63 LLVMUse = &cast<llvm::User>(
Val)->getOperandUse(OpIdx);
65 LLVMUse = cast<llvm::User>(
Val)->op_end();
66 return Use(LLVMUse,
const_cast<User *
>(
this),
Ctx);
72 "Use not found in this SBUser's operands!");
77 switch (
From->getSubclassID()) {
78#define DEF_VALUE(ID, CLASS)
79#define DEF_USER(ID, CLASS) \
82#define DEF_INSTR(ID, OPC, CLASS) \
85#include "llvm/SandboxIR/Values.def"
92 assert(isa<llvm::User>(
Val) &&
"No operands!");
95 cast<llvm::User>(
Val)->setOperand(OperandIdx, Operand->
Val);
100 if (Tracker.isTracking()) {
104 Tracker.emplaceIfTracking<UseSet>(
Use);
108 return cast<llvm::User>(
Val)->replaceUsesOfWith(FromV->
Val, ToV->
Val);
BlockVerifier::State From
ppc ctr loops PowerPC CTR Loops Verify
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Use represents the edge between a Value definition and its users.
This class implements an extremely fast bulk output stream that can only output to a stream.
sandboxir::Value * getValue(llvm::Value *V) const
Iterator for the Use edges of a User's operands.
OperandUseIterator()=default
OperandUseIterator operator-(unsigned Num) const
value_type operator*() const
OperandUseIterator & operator++()
OperandUseIterator operator+(unsigned Num) const
bool emplaceIfTracking(ArgsT... Args)
A convenience wrapper for track() that constructs and tracks the Change object if tracking is enabled...
Tracks the change of the source Value of a sandboxir::Use.
Represents a Def-use/Use-def edge in SandboxIR.
unsigned getOperandNo() const
class User * getUser() const
Iterator for the Use edges of a Value's users.
UserUseIterator & operator++()
A sandboxir::User has operands.
void verifyUserOfLLVMUse(const llvm::Use &Use) const
virtual void setOperand(unsigned OperandIdx, Value *Operand)
bool replaceUsesOfWith(Value *FromV, Value *ToV)
Replaces any operands that match FromV with ToV.
Use getOperandUseDefault(unsigned OpIdx, bool Verify) const
\Returns the Use edge that corresponds to OpIdx.
static bool classof(const Value *From)
For isa/dyn_cast.
virtual Use getOperandUseInternal(unsigned OpIdx, bool Verify) const =0
\Returns the Use for the OpIdx'th operand.
void dumpCommonHeader(raw_ostream &OS) const final
virtual unsigned getNumOperands() const
Use getOperandUse(unsigned OpIdx) const
\Returns the operand edge for OpIdx.
A SandboxIR Value has users. This is the base class.
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
virtual void dumpCommonHeader(raw_ostream &OS) const
Context & Ctx
All values point to the context.