mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
[mlir][Linalg] Add couple of convenience methods to LinalgInterface
.
Add methods to - Get block argument that is tied with an opOperand - Get the yield value that is tied with a output opOperand. Differential Revision: https://reviews.llvm.org/D118085
This commit is contained in:
parent
0944c196c5
commit
f3ab0ccd00
@ -641,6 +641,19 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
||||
return !opOperand->get().getType().template isa<ShapedType>();
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<
|
||||
/*desc=*/[{
|
||||
Return the block argument for an `opOperand`.
|
||||
}],
|
||||
/*retTy=*/"BlockArgument",
|
||||
/*methodName=*/"getTiedBlockArgument",
|
||||
/*args=*/(ins "OpOperand *":$opOperand),
|
||||
/*methodBody=*/"",
|
||||
/*defaultImplementation=*/[{
|
||||
assert(opOperand->getOwner() == this->getOperation());
|
||||
return getBlock()->getArgument(opOperand->getOperandNumber());
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<
|
||||
/*desc=*/[{
|
||||
Return the input or output indexing map for `opOperand`.
|
||||
@ -672,6 +685,24 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
||||
return this->getOperation()->getResult(resultIndex);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<
|
||||
/*desc=*/[{
|
||||
Return the value yielded by the region corresponding to an output
|
||||
`opOperand`.
|
||||
}],
|
||||
/*retTy=*/"OpOperand *",
|
||||
/*methodName=*/"getTiedYieldValue",
|
||||
/*args=*/(ins "OpOperand*":$opOperand),
|
||||
/*methodBody=*/"",
|
||||
/*defaultImplementation=*/[{
|
||||
assert(opOperand->getOwner() == this->getOperation());
|
||||
int64_t resultIndex = opOperand->getOperandNumber() - getNumInputs();
|
||||
assert(resultIndex >= 0 &&
|
||||
resultIndex < this->getOperation()->getNumResults());
|
||||
Operation *yieldOp = getBlock()->getTerminator();
|
||||
return &yieldOp->getOpOperand(resultIndex);
|
||||
}]
|
||||
>,
|
||||
//===------------------------------------------------------------------===//
|
||||
// Other interface methods.
|
||||
//===------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user