15#define GEN_PASS_DEF_TOPOLOGICALSORT
16#include "mlir/Transforms/Passes.h.inc"
22struct TopologicalSortPass
24 void runOnOperation()
override {
26 getOperation()->walk([](RegionKindInterface op) {
27 for (
auto it : llvm::enumerate(op->getRegions())) {
28 if (op.hasSSADominance(it.index()))
30 for (
Block &block : it.value())
39 return std::make_unique<TopologicalSortPass>();
Include the generated interface declarations.
std::unique_ptr< Pass > createTopologicalSortPass()
Creates a pass that recursively sorts nested regions without SSA dominance topologically such that,...
bool sortTopologically(Block *block, iterator_range< Block::iterator > ops, function_ref< bool(Value, Operation *)> isOperandReady=nullptr)
Given a block, sort a range operations in said block in topological order.