//===- TestIRVisitorsGeneric.cpp - Pass to test the Generic 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 "TestOps.h" #include "mlir/Pass/Pass.h" usingnamespacemlir; static std::string getStageDescription(const WalkStage &stage) { … } namespace { /// This pass exercises generic visitor with void callbacks and prints the order /// and stage in which operations are visited. struct TestGenericIRVisitorPass : public PassWrapper<TestGenericIRVisitorPass, OperationPass<>> { … }; /// This pass exercises the generic visitor with non-void callbacks and prints /// the order and stage in which operations are visited. It will interrupt the /// walk based on attributes peesent in the IR. struct TestGenericIRVisitorInterruptPass : public PassWrapper<TestGenericIRVisitorInterruptPass, OperationPass<>> { … }; struct TestGenericIRBlockVisitorInterruptPass : public PassWrapper<TestGenericIRBlockVisitorInterruptPass, OperationPass<ModuleOp>> { … }; struct TestGenericIRRegionVisitorInterruptPass : public PassWrapper<TestGenericIRRegionVisitorInterruptPass, OperationPass<ModuleOp>> { … }; } // namespace namespace mlir { namespace test { void registerTestGenericIRVisitorsPass() { … } } // namespace test } // namespace mlir