[all-commits] [llvm/llvm-project] edc6c0: [mlir] Refactor AbstractOperation and OperationName
River Riddle via All-commits
all-commits at lists.llvm.org
Wed Nov 17 14:30:15 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: edc6c0ecb9627c7c57fdb8e0ca8267295dd77bcd
https://github.com/llvm/llvm-project/commit/edc6c0ecb9627c7c57fdb8e0ca8267295dd77bcd
Author: River Riddle <riddleriver at gmail.com>
Date: 2021-11-17 (Wed, 17 Nov 2021)
Changed paths:
M mlir/include/mlir/IR/Builders.h
M mlir/include/mlir/IR/Dialect.h
M mlir/include/mlir/IR/MLIRContext.h
M mlir/include/mlir/IR/OpDefinition.h
M mlir/include/mlir/IR/Operation.h
M mlir/include/mlir/IR/OperationSupport.h
M mlir/include/mlir/Support/InterfaceSupport.h
M mlir/lib/CAPI/IR/IR.cpp
M mlir/lib/CAPI/Interfaces/Interfaces.cpp
M mlir/lib/Dialect/PDL/IR/PDL.cpp
M mlir/lib/IR/AsmPrinter.cpp
M mlir/lib/IR/MLIRContext.cpp
M mlir/lib/IR/Operation.cpp
M mlir/lib/IR/Verifier.cpp
M mlir/lib/Parser/AsmParserState.cpp
M mlir/lib/Parser/Parser.cpp
M mlir/lib/Rewrite/ByteCode.cpp
M mlir/lib/Rewrite/FrozenRewritePatternSet.cpp
M mlir/lib/Transforms/Canonicalizer.cpp
M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Log Message:
-----------
[mlir] Refactor AbstractOperation and OperationName
The current implementation is quite clunky; OperationName stores either an Identifier
or an AbstractOperation that corresponds to an operation. This has several problems:
* OperationNames created before and after an operation are registered are different
* Accessing the identifier name/dialect/etc. from an OperationName are overly branchy
- they need to dyn_cast a PointerUnion to check the state
This commit refactors this such that we create a single information struct for every
operation name, even operations that aren't registered yet. When an OperationName is
created for an unregistered operation, we only populate the name field. When the
operation is registered, we populate the remaining fields. With this we now have two
new classes: OperationName and RegisteredOperationName. These both point to the
same underlying operation information struct, but only RegisteredOperationName can
assume that the operation is actually registered. This leads to a much cleaner API, and
we can also move some AbstractOperation functionality directly to OperationName.
Differential Revision: https://reviews.llvm.org/D114049
More information about the All-commits
mailing list