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