[mlir] Extend Operation visitor with pre-order traversal
authorDiego Caballero <diego.caballero@intel.com>
Fri, 5 Mar 2021 21:46:56 +0000 (23:46 +0200)
committerDiego Caballero <diego.caballero@intel.com>
Fri, 5 Mar 2021 22:02:20 +0000 (00:02 +0200)
commit71a86245ca620d26ed63a86dda3b65a533f5df6b
treef0da7d216549a11caabde72195a9fc41c9219c48
parentb635492c3f1a51eb2026bc2add9fefd7a92004b0
[mlir] Extend Operation visitor with pre-order traversal

This patch extends the Region, Block and Operation visitors to also support pre-order walks.
We introduce a new template argument that dictates the walk order (only pre-order and
post-order are supported for now). The default order for Regions, Blocks and Operations is
post-order. Mixed orders (e.g., Region/Block pre-order + Operation post-order) could easily
be implemented, as shown in NumberOfExecutions.cpp.

Reviewed By: rriddle, frgossen, bondhugula

Differential Revision: https://reviews.llvm.org/D97217
mlir/include/mlir/IR/Block.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/Operation.h
mlir/include/mlir/IR/Region.h
mlir/include/mlir/IR/Visitors.h
mlir/lib/Analysis/Liveness.cpp
mlir/lib/Analysis/NumberOfExecutions.cpp
mlir/lib/IR/Visitors.cpp