================
@@ -828,6 +828,76 @@ mlir::LogicalResult cir::VectorType::verify(
return success();
}
+mlir::Type cir::VectorType::parse(::mlir::AsmParser &odsParser) {
+
+ llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
+ mlir::Builder odsBuilder(odsParser.getContext());
+ mlir::FailureOr<::mlir::Type> elementType;
+ mlir::FailureOr<uint64_t> size;
+ bool isScalabe = false;
+
+ // Parse literal '<'
+ if (odsParser.parseLess())
+ return {};
+
+ // Parse literal '[', if present, and set the scalability flag accordingly
+ if (odsParser.parseOptionalLSquare().succeeded()) {
+ isScalabe = true;
+ }
+
+ // Parse variable 'size'
+ size = mlir::FieldParser<uint64_t>::parse(odsParser);
+ if (mlir::failed(size)) {
+ odsParser.emitError(odsParser.getCurrentLocation(),
+ "failed to parse CIR_VectorType parameter 'size' which
"
+ "is to be a `uint64_t`");
+ return {};
+ }
+
+ // Parse literal ']', which is expected when dealing with scalable
+ // dim sizes
+ if (isScalabe && odsParser.parseRSquare().failed()) {
----------------
AmrDeveloper wrote:
Can you please add invalid-vector test to make sure the error is emitted
correctly
https://github.com/llvm/llvm-project/pull/172683
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits