13 #include "llvm/ADT/SmallPtrSet.h"
21 if (
auto result = llvm::dyn_cast<OpResult>(*
this))
22 return result.getOwner();
27 if (
auto *op = getDefiningOp())
30 return llvm::cast<BlockArgument>(*this).getLoc();
34 if (
auto *op = getDefiningOp())
35 return op->setLoc(loc);
37 return llvm::cast<BlockArgument>(*this).setLoc(loc);
42 if (
auto *op = getDefiningOp())
44 return llvm::cast<BlockArgument>(*this).getOwner()->getParent();
50 return op->getBlock();
51 return llvm::cast<BlockArgument>(*this).getOwner();
55 return (
unsigned)std::distance(use_begin(), use_end());
59 return hasNItems(use_begin(), use_end(), n);
63 return hasNItemsOrMore(use_begin(), use_end(), n);
75 for (
OpOperand &use : llvm::make_early_inc_range(getUses())) {
76 if (exceptions.count(use.getOwner()) == 0)
85 for (
OpOperand &use : llvm::make_early_inc_range(getUses())) {
86 if (use.getOwner() != exceptedUser)
95 for (
OpOperand &use : llvm::make_early_inc_range(getUses()))
96 if (shouldReplace(use))
102 return llvm::any_of(getUsers(), [block](
Operation *user) {
109 getImpl()->shuffleUseList(indices);
131 if (
const auto *result = dyn_cast<InlineOpResult>(
this)) {
132 result += result->getResultNumber() + 1;
141 const auto *inlineIt =
reinterpret_cast<const InlineOpResult *
>(outOfLineIt);
162 if (
auto *inlineResult = dyn_cast<InlineOpResult>(
this)) {
173 intptr_t leftBeforeTrailing =
175 if (leftBeforeTrailing >= offset)
176 return inlineResult - offset;
186 result = inlineResult - leftBeforeTrailing;
187 offset -= leftBeforeTrailing;
197 unsigned OpResult::getNumInline(
unsigned numResults) {
203 unsigned OpResult::getNumTrailing(
unsigned numResults) {
206 return numResults <= maxInline ? 0 : numResults - maxInline;
220 return this - &getOwner()->getBlockOperands()[0];
229 return this - &getOwner()->getOpOperands()[0];
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
unsigned getOperandNumber()
Return which operand this is in the BlockOperand list of the Operation.
static IRObjectWithUseList< BlockOperand > * getUseList(Block *value)
Provide the use list that is attached to the given block.
Block represents an ordered list of Operations.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class represents an operand of an operation.
unsigned getOperandNumber()
Return which operand this is in the OpOperand list of the Operation.
Operation is the basic unit of execution within MLIR.
Block * getBlock()
Returns the operation block that contains this operation.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Region * getParentRegion()
Return the region containing this region or nullptr if the region is attached to a top-level operatio...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
void setLoc(Location loc)
bool hasNUsesOrMore(unsigned n) const
Return true if this value has n uses or more.
void replaceUsesWithIf(Value newValue, function_ref< bool(OpOperand &)> shouldReplace)
Replace all uses of 'this' value with 'newValue' if the given callback returns true.
void shuffleUseList(ArrayRef< unsigned > indices)
Shuffle the use list order according to the provided indices.
Block * getParentBlock()
Return the Block in which this Value is defined.
void replaceAllUsesExcept(Value newValue, const SmallPtrSetImpl< Operation * > &exceptions)
Replace all uses of 'this' value with 'newValue', updating anything in the IR that uses 'this' to use...
unsigned getNumUses() const
This method computes the number of uses of this Value.
bool hasNUses(unsigned n) const
Return true if this Value has exactly n uses.
bool isUsedOutsideOfBlock(Block *block) const
Returns true if the value is used outside of the given block.
Location getLoc() const
Return the location of this value.
Operation * getDefiningOp() const
If this value is the result of an operation, return the operation that defines it.
Region * getParentRegion()
Return the Region in which this Value is defined.
This class provides the implementation for an operation result.
OpResultImpl * getNextResultAtOffset(intptr_t offset)
Returns the next operation result at offset after this result.
Operation * getOwner() const
Returns the parent operation of this result.
static unsigned getMaxInlineResults()
Returns the maximum number of results that can be stored inline.
This class provides the implementation for an operation result whose index cannot be represented "inl...
uint64_t outOfLineIndex
The trailing result number, or the offset from the beginning of the OutOfLineOpResult array.
Include the generated interface declarations.
This class provides the implementation for an operation result whose index can be represented "inline...