13 #ifndef MLIR_INTERFACES_VIEWLIKEINTERFACE_H_
14 #define MLIR_INTERFACES_VIEWLIKEINTERFACE_H_
25 class OffsetSizeAndStrideOpInterface;
32 OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b,
44 #include "mlir/Interfaces/ViewLikeInterface.h.inc"
57 template <
typename OpType,
typename ResultTypeFn,
typename CastOpFunc>
77 ResultTypeFn()(op, mixedOffsets, mixedSizes, mixedStrides);
81 rewriter.
create<OpType>(op.getLoc(), resultType, op.getSource(),
82 mixedOffsets, mixedSizes, mixedStrides);
83 CastOpFunc()(rewriter, op, newOp);
108 OpAsmPrinter &printer, Operation *op, OperandRange values,
109 ArrayRef<int64_t> integers, TypeRange valueTypes = TypeRange(),
110 ArrayRef<bool> scalables = {},
136 SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
138 SmallVectorImpl<Type> *valueTypes =
nullptr,
147 valueTypes, delimiter);
156 &valueTypes, delimiter);
166 &valueTypes, delimiter);
172 unsigned expectedNumElements,
173 ArrayRef<int64_t> attr,
Delimiter
These are the supported delimiters around operand lists and region argument lists,...
@ Square
Square brackets surrounding zero or more operands.
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Pattern to rewrite dynamic offsets/sizes/strides of view/slice-like ops as constant arguments.
LogicalResult matchAndRewrite(OpType op, PatternRewriter &rewriter) const override
This class represents success/failure for parsing-like operations that find it important to chain tog...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
Base class for DenseArrayAttr that is instantiated and specialized for each supported element type be...
bool sameOffsetsSizesAndStrides(OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b, llvm::function_ref< bool(OpFoldResult, OpFoldResult)> cmp)
unsigned getNumDynamicEntriesUpToIdx(ArrayRef< int64_t > staticVals, unsigned idx)
Helper method to compute the number of dynamic entries of staticVals, up to idx.
LogicalResult verifyOffsetSizeAndStrideOp(OffsetSizeAndStrideOpInterface op)
Include the generated interface declarations.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
detail::DenseArrayAttrImpl< int64_t > DenseI64ArrayAttr
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
detail::DenseArrayAttrImpl< bool > DenseBoolArrayAttr
void printDynamicIndexList(OpAsmPrinter &printer, Operation *op, OperandRange values, ArrayRef< int64_t > integers, TypeRange valueTypes=TypeRange(), ArrayRef< bool > scalables={}, AsmParser::Delimiter delimiter=AsmParser::Delimiter::Square)
Printer hook for custom directive in assemblyFormat.
LogicalResult verifyListOfOperandsOrIntegers(Operation *op, StringRef name, unsigned expectedNumElements, ArrayRef< int64_t > attr, ValueRange values)
Verify that a the values has as many elements as the number of entries in attr for which isDynamic ev...
ParseResult parseDynamicIndexList(OpAsmParser &parser, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &values, DenseI64ArrayAttr &integers, DenseBoolArrayAttr &scalableVals, SmallVectorImpl< Type > *valueTypes=nullptr, AsmParser::Delimiter delimiter=AsmParser::Delimiter::Square)
Parser hook for custom directive in assemblyFormat.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
LogicalResult foldDynamicIndexList(SmallVectorImpl< OpFoldResult > &ofrs, bool onlyNonNegative=false, bool onlyNonZero=false)
Returns "success" when any of the elements in ofrs is a constant value.
This class represents an efficient way to signal success or failure.
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...