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();
63 for (
OpOperand &use : llvm::make_early_inc_range(getUses())) {
64 if (exceptions.count(use.getOwner()) == 0)
73 for (
OpOperand &use : llvm::make_early_inc_range(getUses())) {
74 if (use.getOwner() != exceptedUser)
83 for (
OpOperand &use : llvm::make_early_inc_range(getUses()))
84 if (shouldReplace(use))
90 return llvm::any_of(getUsers(), [block](
Operation *user) {
97 getImpl()->shuffleUseList(indices);
119 if (
const auto *result = dyn_cast<InlineOpResult>(
this)) {
120 result += result->getResultNumber() + 1;
129 const auto *inlineIt =
reinterpret_cast<const InlineOpResult *
>(outOfLineIt);
150 if (
auto *inlineResult = dyn_cast<InlineOpResult>(
this)) {
161 intptr_t leftBeforeTrailing =
163 if (leftBeforeTrailing >= offset)
164 return inlineResult - offset;
174 result = inlineResult - leftBeforeTrailing;
175 offset -= leftBeforeTrailing;
185 unsigned OpResult::getNumInline(
unsigned numResults) {
191 unsigned OpResult::getNumTrailing(
unsigned numResults) {
194 return numResults <= maxInline ? 0 : numResults - maxInline;
208 return this - &getOwner()->getBlockOperands()[0];
217 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)
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...
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...