[all-commits] [llvm/llvm-project] b6c71c: [mlir] NFC - Refactor and expose a parsing helper ...
Nicolas Vasilache via All-commits
all-commits at lists.llvm.org
Tue Nov 24 11:48:40 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: b6c71c13a38b76942c9561575837c94215f23c9e
https://github.com/llvm/llvm-project/commit/b6c71c13a38b76942c9561575837c94215f23c9e
Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
Date: 2020-11-24 (Tue, 24 Nov 2020)
Changed paths:
M mlir/include/mlir/Interfaces/ViewLikeInterface.h
M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
M mlir/lib/Interfaces/ViewLikeInterface.cpp
Log Message:
-----------
[mlir] NFC - Refactor and expose a parsing helper for OffsetSizeAndStrideInterface
Parse trailing part of an op of the form:
```
<optional-offset-prefix>`[` offset-list `]`
<optional-size-prefix>`[` size-list `]`
<optional-stride-prefix>[` stride-list `]`
```
Each entry in the offset, size and stride list either resolves to an integer
constant or an operand of index type.
Constants are added to the `result` as named integer array attributes with
name `OffsetSizeAndStrideOpInterface::getStaticOffsetsAttrName()` (resp.
`getStaticSizesAttrName()`, `getStaticStridesAttrName()`).
Append the number of offset, size and stride operands to `segmentSizes`
before adding it to `result` as the named attribute:
`OpTrait::AttrSizedOperandSegments<void>::getOperandSegmentSizeAttr()`.
Offset, size and stride operands resolution occurs after `preResolutionFn`
to give a chance to leading operands to resolve first, after parsing the
types.
```
ParseResult parseOffsetsSizesAndStrides(
OpAsmParser &parser, OperationState &result, ArrayRef<int> segmentSizes,
llvm::function_ref<ParseResult(OpAsmParser &, OperationState &)>
preResolutionFn = nullptr,
llvm::function_ref<ParseResult(OpAsmParser &)> parseOptionalOffsetPrefix =
nullptr,
llvm::function_ref<ParseResult(OpAsmParser &)> parseOptionalSizePrefix =
nullptr,
llvm::function_ref<ParseResult(OpAsmParser &)> parseOptionalStridePrefix =
nullptr);
```
Differential revision: https://reviews.llvm.org/D92030
More information about the All-commits
mailing list