[Mlir-commits] [mlir] 597207a - Expose parseXInDimensionList() to the `DialectAsmParser`
Mehdi Amini
llvmlistbot at llvm.org
Tue Apr 13 19:07:47 PDT 2021
Author: Mehdi Amini
Date: 2021-04-14T02:07:34Z
New Revision: 597207a3c3d7774194dbb99d4853f65bf0b84a1e
URL: https://github.com/llvm/llvm-project/commit/597207a3c3d7774194dbb99d4853f65bf0b84a1e
DIFF: https://github.com/llvm/llvm-project/commit/597207a3c3d7774194dbb99d4853f65bf0b84a1e.diff
LOG: Expose parseXInDimensionList() to the `DialectAsmParser`
This allows custom types and attribute to parse a dimension list that
isn't necessarily terminated with `xtype`, for example something like:
#tf.shape<4x5>
Differential Revision: https://reviews.llvm.org/D100432
Added:
Modified:
mlir/include/mlir/IR/DialectImplementation.h
mlir/lib/Parser/DialectSymbolParser.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/DialectImplementation.h b/mlir/include/mlir/IR/DialectImplementation.h
index f1a53df3c2cab..2815ccdaa6f08 100644
--- a/mlir/include/mlir/IR/DialectImplementation.h
+++ b/mlir/include/mlir/IR/DialectImplementation.h
@@ -361,6 +361,11 @@ class DialectAsmParser {
/// static-dimension-list ::= (integer `x`)*
virtual ParseResult parseDimensionList(SmallVectorImpl<int64_t> &dimensions,
bool allowDynamic = true) = 0;
+
+ /// Parse an 'x' token in a dimension list, handling the case where the x is
+ /// juxtaposed with an element type, as in "xf32", leaving the "f32" as the
+ /// next token.
+ virtual ParseResult parseXInDimensionList() = 0;
};
} // end namespace mlir
diff --git a/mlir/lib/Parser/DialectSymbolParser.cpp b/mlir/lib/Parser/DialectSymbolParser.cpp
index 851f40bb0fe3f..5f8255fe9f3c1 100644
--- a/mlir/lib/Parser/DialectSymbolParser.cpp
+++ b/mlir/lib/Parser/DialectSymbolParser.cpp
@@ -308,6 +308,10 @@ class CustomDialectAsmParser : public DialectAsmParser {
return parser.parseDimensionListRanked(dimensions, allowDynamic);
}
+ ParseResult parseXInDimensionList() override {
+ return parser.parseXInDimensionList();
+ }
+
OptionalParseResult parseOptionalType(Type &result) override {
return parser.parseOptionalType(result);
}
More information about the Mlir-commits
mailing list