llvm/mlir/test/lib/Pass/TestPassManager.cpp

//===- TestPassManager.cpp - Test pass manager functionality --------------===//
//
// 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 "TestDialect.h"
#include "TestOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"

usingnamespacemlir;

namespace {
struct TestModulePass
    : public PassWrapper<TestModulePass, OperationPass<ModuleOp>> {};
struct TestFunctionPass
    : public PassWrapper<TestFunctionPass, OperationPass<func::FuncOp>> {};
struct TestInterfacePass
    : public PassWrapper<TestInterfacePass,
                         InterfacePass<FunctionOpInterface>> {};
struct TestOptionsPass
    : public PassWrapper<TestOptionsPass, OperationPass<func::FuncOp>> {};

struct TestOptionsSuperPass
    : public PassWrapper<TestOptionsSuperPass, OperationPass<func::FuncOp>> {};

/// A test pass that always aborts to enable testing the crash recovery
/// mechanism of the pass manager.
struct TestCrashRecoveryPass
    : public PassWrapper<TestCrashRecoveryPass, OperationPass<>> {};

/// A test pass that always fails to enable testing the failure recovery
/// mechanisms of the pass manager.
struct TestFailurePass : public PassWrapper<TestFailurePass, OperationPass<>> {};

/// A test pass that creates an invalid operation in a function body.
struct TestInvalidIRPass
    : public PassWrapper<TestInvalidIRPass,
                         InterfacePass<FunctionOpInterface>> {};

/// A test pass that always fails to enable testing the failure recovery
/// mechanisms of the pass manager.
struct TestInvalidParentPass
    : public PassWrapper<TestInvalidParentPass,
                         InterfacePass<FunctionOpInterface>> {};

/// A test pass that contains a statistic.
struct TestStatisticPass
    : public PassWrapper<TestStatisticPass, OperationPass<>> {};
} // namespace

static void testNestedPipeline(OpPassManager &pm) {}

static void testNestedPipelineTextual(OpPassManager &pm) {}

namespace mlir {
void registerPassManagerTestPass() {}
} // namespace mlir