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 : public PassWrapper<TestLivenessPass, FunctionPass> { runOnFunction__anondfdbb4d60111::TestLivenessPass23 void runOnFunction() override { 24 llvm::errs() << "Testing : " << getFunction().getName() << "\n"; 25 getAnalysis<Liveness>().print(llvm::errs()); 26 } 27 }; 28 29 } // end anonymous namespace 30 31 namespace mlir { 32 namespace test { registerTestLivenessPass()33void registerTestLivenessPass() { 34 PassRegistration<TestLivenessPass>( 35 "test-print-liveness", 36 "Print the contents of a constructed liveness information."); 37 } 38 } // namespace test 39 } // namespace mlir 40