17 : SubclassID(SubclassID), Val(Val), Ctx(Ctx) {
36 bool AtEnd = UseBegin == UseEnd;
37 llvm::Use *LLVMUse = AtEnd ? nullptr : &*UseBegin;
40 : cast_or_null<sandboxir::User>(
Ctx.
getValue(&*LLVMUse->getUser()));
54 OtherVal, [&ShouldReplace,
this](
llvm::Use &LLVMUse) ->
bool {
58 Use UseToReplace(&LLVMUse, DstU,
Ctx);
59 if (!ShouldReplace(UseToReplace))
68 "Replacing with Value of different type!");
81 SS <<
"SB" <<
UID <<
".";
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Use represents the edge between a Value definition and its users.
User * getUser() const
Returns the User that contains this Use.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
iterator_range< user_iterator > users()
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
void replaceUsesWithIf(Value *New, llvm::function_ref< bool(Use &U)> ShouldReplace)
Go through the uses list for this definition and make each use point to "V" if the callback ShouldRep...
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
sandboxir::Value * getValue(llvm::Value *V) const
Type * getType(llvm::Type *LLVMTy)
size_t getNumValues() const
\Returns the number of values registered with Context.
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
bool isTracking() const
\Returns true if the tracker is recording changes.
void track(std::unique_ptr< IRChangeBase > &&Change)
Record Change and take ownership.
bool emplaceIfTracking(ArgsT... Args)
A convenience wrapper for track() that constructs and tracks the Change object if tracking is enabled...
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Represents a Def-use/Use-def edge in SandboxIR.
Iterator for the Use edges of a Value's users.
A sandboxir::User has operands.
A SandboxIR Value has users. This is the base class.
mapped_iterator< sandboxir::UserUseIterator, UseToUser > user_iterator
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
void dumpCommonFooter(raw_ostream &OS) const
virtual void dumpCommonHeader(raw_ostream &OS) const
void dumpCommonSuffix(raw_ostream &OS) const
void replaceAllUsesWith(Value *Other)
unsigned getNumUses() const
\Returns the number of user edges (not necessarily to unique users).
UserUseIterator use_iterator
void printAsOperandCommon(raw_ostream &OS) const
Context & Ctx
All values point to the context.
ClassID SubclassID
For isa/dyn_cast.
LLVM_DUMP_METHOD void dump() const
Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)
std::string getUid() const
Returns the unique id in the form 'SB<number>.' like 'SB1.'.
void replaceUsesWithIf(Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
unsigned UID
A unique ID used for forming the name (used for debugging).
virtual void dumpOS(raw_ostream &OS) const =0
void dumpCommonPrefix(raw_ostream &OS) const
iterator_range< use_iterator > uses()
static const char * getSubclassIDStr(ClassID ID)
user_iterator user_begin()
constexpr size_t range_size(R &&Range)
Returns the size of the Range, i.e., the number of elements.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.