commit | 81295c54fe59a4dd9e537f73b70ef21c3a36393b | [log] [tgz] |
---|---|---|
author | River Riddle <riddleriver@gmail.com> | Wed Nov 17 21:50:28 2021 +0000 |
committer | Copybara-Service <copybara-worker@google.com> | Wed Nov 17 14:34:36 2021 -0800 |
tree | 73101b04fdbef88fdfa58f62abc1ad925099e372 | |
parent | 1c8ea33ec210b327f7e70a46848f2c531fcf36bb [diff] |
[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 GitOrigin-RevId: edc6c0ecb9627c7c57fdb8e0ca8267295dd77bcd
See https://mlir.llvm.org/ for more information.