//===- TestIRVisitors.cpp - Pass to test the IR visitors ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Iterators.h" #include "mlir/Interfaces/FunctionInterfaces.h" #include "mlir/Pass/Pass.h" usingnamespacemlir; static void printRegion(Region *region) { … } static void printBlock(Block *block) { … } static void printOperation(Operation *op) { … } /// Tests pure callbacks. static void testPureCallbacks(Operation *op) { … } /// Tests erasure callbacks that skip the walk. static void testSkipErasureCallbacks(Operation *op) { … } /// Tests callbacks that erase the op or block but don't return 'Skip'. This /// callbacks are only valid in post-order. static void testNoSkipErasureCallbacks(Operation *op) { … } /// Invoke region/block walks on regions/blocks. static void testBlockAndRegionWalkers(Operation *op) { … } namespace { /// This pass exercises the different configurations of the IR visitors. struct TestIRVisitorsPass : public PassWrapper<TestIRVisitorsPass, OperationPass<>> { … }; } // namespace namespace mlir { namespace test { void registerTestIRVisitorsPass() { … } } // namespace test } // namespace mlir