[mlir] Refactoring a few Parser APIs
authorSandeep Dasgupta <sdasgup@google.com>
Tue, 23 Nov 2021 06:05:41 +0000 (06:05 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 23 Nov 2021 06:11:01 +0000 (06:11 +0000)
commite5a8c8c883f1f3f91f40c883dd4f613aca0f7105
tree2ef7c7121c4351962ead502f86dc597ddce91664
parentd5b73a70a0611fc6c082e20acb6ce056980c8323
[mlir] Refactoring a few Parser APIs

Refactored two new parser APIs parseGenericOperationAfterOperands and
 parseCustomOperationName out of parseGenericOperation and parseCustomOperation.

Motivation: Sometimes an op can be printed in a special way if certain criteria
is met. While parsing, we need to handle all the versions.
`parseGenericOperationAfterOperands` is handy in situation where we already
parsed the operands and decide to fall back to default parsing.

`parseCustomOperationName` is useful when we need to know details (dialect,
operation name etc.) about a parsed token meant to be an mlir operation.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D113719
mlir/include/mlir/IR/OpImplementation.h
mlir/lib/Parser/Parser.cpp
mlir/test/IR/pretty_printed_region_op.mlir [new file with mode: 0644]
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestOps.td