9#ifndef LLVM_SANDBOXIR_USER_H
10#define LLVM_SANDBOXIR_USER_H
29#define DEF_INSTR(ID, OPC, CLASS) friend class CLASS;
30#include "llvm/SandboxIR/Values.def"
51 return !(*
this ==
Other);
77 return Use.LLVMUse->getOperandNo();
81 friend unsigned Use::getOperandNo()
const;
84 assert(OpIdxA < getNumOperands() &&
"OpIdxA out of bounds!");
85 assert(OpIdxB < getNumOperands() &&
"OpIdxB out of bounds!");
86 auto UseA = getOperandUse(OpIdxA);
87 auto UseB = getOperandUse(OpIdxB);
104 assert(isa<llvm::User>(Val) &&
"Expect User value!");
105 return op_iterator(getOperandUseInternal(0,
false));
108 assert(isa<llvm::User>(Val) &&
"Expect User value!");
110 getOperandUseInternal(getNumOperands(),
false));
113 return const_cast<User *
>(
this)->op_begin();
116 return const_cast<User *
>(
this)->op_end();
121 return make_range<const_op_iterator>(op_begin(), op_end());
127 return getOperandUseInternal(
OpIdx,
true);
130 return isa<llvm::User>(Val) ? cast<llvm::User>(Val)->getNumOperands() : 0;
133 virtual void setOperand(
unsigned OperandIdx,
Value *Operand);
136 bool replaceUsesOfWith(
Value *FromV,
Value *ToV);
140 assert(isa<llvm::User>(Val) &&
"Expected User!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
BlockVerifier::State From
MachineInstr unsigned OpIdx
ppc ctr loops PowerPC CTR Loops Verify
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Iterator for the Use edges of a User's operands.
OperandUseIterator()=default
std::ptrdiff_t difference_type
std::input_iterator_tag iterator_category
OperandUseIterator operator++(int)
bool operator!=(const OperandUseIterator &Other) const
bool operator==(const OperandUseIterator &Other) const
LLVM_ABI OperandUseIterator operator-(unsigned Num) const
LLVM_ABI value_type operator*() const
LLVM_ABI OperandUseIterator & operator++()
LLVM_ABI OperandUseIterator operator+(unsigned Num) const
Represents a Def-use/Use-def edge in SandboxIR.
A sandboxir::User has operands.
virtual op_iterator op_begin()
void dumpOS(raw_ostream &OS) const override
Value * getOperand(unsigned OpIdx) const
virtual unsigned getUseOperandNo(const Use &Use) const =0
\Returns the operand index of Use.
unsigned getUseOperandNoDefault(const Use &Use) const
The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...
virtual const_op_iterator op_end() const
void verify() const override
Should crash if there is something wrong with the instruction.
const_op_range operands() const
virtual Use getOperandUseInternal(unsigned OpIdx, bool Verify) const =0
\Returns the Use for the OpIdx'th operand.
void swapOperandsInternal(unsigned OpIdxA, unsigned OpIdxB)
virtual unsigned getNumOperands() const
virtual const_op_iterator op_begin() const
Use getOperandUse(unsigned OpIdx) const
\Returns the operand edge for OpIdx.
virtual op_iterator op_end()
User(ClassID ID, llvm::Value *V, Context &Ctx)
A SandboxIR Value has users. This is the base class.