1 //===- TestLiveness.cpp - Test liveness construction and information
2 //-------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains test passes for constructing and resolving liveness
11 // information.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "mlir/Analysis/Liveness.h"
16 #include "mlir/Pass/Pass.h"
17 
18 using namespace mlir;
19 
20 namespace {
21 
22 struct TestLivenessPass
23     : public PassWrapper<TestLivenessPass, OperationPass<FuncOp>> {
24   StringRef getArgument() const final { return "test-print-liveness"; }
25   StringRef getDescription() const final {
26     return "Print the contents of a constructed liveness information.";
27   }
28   void runOnOperation() override {
29     llvm::errs() << "Testing : " << getOperation().getName() << "\n";
30     getAnalysis<Liveness>().print(llvm::errs());
31   }
32 };
33 
34 } // namespace
35 
36 namespace mlir {
37 namespace test {
38 void registerTestLivenessPass() { PassRegistration<TestLivenessPass>(); }
39 } // namespace test
40 } // namespace mlir
41