[MLIR] Introduce generic visitors.
authorRahul Joshi <jurahul@google.com>
Thu, 13 Jan 2022 21:32:14 +0000 (13:32 -0800)
committerRahul Joshi <jurahul@google.com>
Fri, 14 Jan 2022 17:15:27 +0000 (09:15 -0800)
commit8067ced144a213574b6c8cb4c15aba276d5cf906
tree3e2c28751758fe46ab4f44cac879958022139f5f
parent67076ebb606e9fc0e6403796ab9cb2952001684d
[MLIR] Introduce generic visitors.

- Generic visitors invoke operation callbacks before/in-between/after visiting the regions
  attached to an operation and use a `WalkStage` to indicate which regions have been
  visited.
- This can be useful for cases where we need to visit the operation in between visiting
  regions attached to the operation.

Differential Revision: https://reviews.llvm.org/D116230
mlir/include/mlir/IR/Operation.h
mlir/include/mlir/IR/Visitors.h
mlir/lib/IR/Visitors.cpp
mlir/test/IR/generic-visitors-interrupt.mlir [new file with mode: 0644]
mlir/test/IR/generic-visitors.mlir [new file with mode: 0644]
mlir/test/lib/IR/CMakeLists.txt
mlir/test/lib/IR/TestVisitorsGeneric.cpp [new file with mode: 0644]
mlir/tools/mlir-opt/mlir-opt.cpp