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   MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestLivenessPass)
24 
25   StringRef getArgument() const final { return "test-print-liveness"; }
26   StringRef getDescription() const final {
27     return "Print the contents of a constructed liveness information.";
28   }
29   void runOnOperation() override {
30     llvm::errs() << "Testing : " << getOperation().getName() << "\n";
31     getAnalysis<Liveness>().print(llvm::errs());
32   }
33 };
34 
35 } // namespace
36 
37 namespace mlir {
38 namespace test {
39 void registerTestLivenessPass() { PassRegistration<TestLivenessPass>(); }
40 } // namespace test
41 } // namespace mlir
42