25 if (!
Val->uses().empty())
26 LLVMUse = &*
Val->use_begin();
28 Val->use_begin()->getUser()))
34 auto UseBegin =
Val->use_begin();
35 auto UseEnd =
Val->use_end();
36 bool AtEnd = UseBegin == UseEnd;
37 llvm::Use *LLVMUse = AtEnd ? nullptr : &*UseBegin;
54 OtherVal, [&ShouldReplace,
this, OtherV](
llvm::Use &LLVMUse) ->
bool {
58 Use UseToReplace(&LLVMUse, DstU, Ctx);
59 if (!ShouldReplace(UseToReplace))
61 Ctx.getTracker().emplaceIfTracking<UseSet>(UseToReplace);
62 Ctx.runSetUseCallbacks(UseToReplace, OtherV);
69 "Replacing with Value of different type!");
83 SS <<
"SB" <<
UID <<
".";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI 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.
LLVM_ABI 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.
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.
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
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
LLVM_ABI void replaceAllUsesWith(Value *Other)
LLVM_ABI 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
LLVM_ABI Type * getType() const
LLVM_ABI Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)
std::string getUid() const
Returns the unique id in the form 'SB<number>.' like 'SB1.'.
LLVM_ABI 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)
LLVM_ABI use_iterator use_begin()
LLVM_ABI user_iterator user_begin()
auto cast_or_null(const Y &Val)
constexpr size_t range_size(R &&Range)
Returns the size of the Range, i.e., the number of elements.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.