43 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains test passes for constructing and resolving liveness10// information.11//12//===----------------------------------------------------------------------===//13 14#include "mlir/Analysis/Liveness.h"15#include "mlir/IR/SymbolTable.h"16#include "mlir/Pass/Pass.h"17 18using namespace mlir;19 20namespace {21 22struct TestLivenessPass23 : public PassWrapper<TestLivenessPass, InterfacePass<SymbolOpInterface>> {24 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestLivenessPass)25 26 StringRef getArgument() const final { return "test-print-liveness"; }27 StringRef getDescription() const final {28 return "Print the contents of a constructed liveness information.";29 }30 void runOnOperation() override {31 llvm::errs() << "Testing : " << getOperation().getName() << "\n";32 getAnalysis<Liveness>().print(llvm::errs());33 }34};35 36} // namespace37 38namespace mlir {39namespace test {40void registerTestLivenessPass() { PassRegistration<TestLivenessPass>(); }41} // namespace test42} // namespace mlir43