1 //===- TestLiveness.cpp - Test liveness construction and information ------===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains test passes for constructing and resolving liveness
12 //===----------------------------------------------------------------------===//
14 #include "mlir/Analysis/Liveness.h"
15 #include "mlir/IR/SymbolTable.h"
16 #include "mlir/Pass/Pass.h"
22 struct TestLivenessPass
23 : public PassWrapper
<TestLivenessPass
, InterfacePass
<SymbolOpInterface
>> {
24 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestLivenessPass
)
26 StringRef
getArgument() const final
{ return "test-print-liveness"; }
27 StringRef
getDescription() const final
{
28 return "Print the contents of a constructed liveness information.";
30 void runOnOperation() override
{
31 llvm::errs() << "Testing : " << getOperation().getName() << "\n";
32 getAnalysis
<Liveness
>().print(llvm::errs());
40 void registerTestLivenessPass() { PassRegistration
<TestLivenessPass
>(); }