TestDialect has many operations and they all live in ::mlir namespace. Sometimes it is not clear whether the ops used in the code for the test passes belong to Standard or to Test dialects. Also, with this change it is easier to understand what test passes registered in mlir-opt are actually passes in mlir/test. Differential Revision: https://reviews.llvm.org/D90794
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
//===- TestCallGraph.cpp - Test callgraph construction and iteration ------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains test passes for constructing and iterating over a
|
|
// callgraph.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Analysis/CallGraph.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
struct TestCallGraphPass
|
|
: public PassWrapper<TestCallGraphPass, OperationPass<ModuleOp>> {
|
|
void runOnOperation() override {
|
|
llvm::errs() << "Testing : " << getOperation().getAttr("test.name") << "\n";
|
|
getAnalysis<CallGraph>().print(llvm::errs());
|
|
}
|
|
};
|
|
} // end anonymous namespace
|
|
|
|
namespace mlir {
|
|
namespace test {
|
|
void registerTestCallGraphPass() {
|
|
PassRegistration<TestCallGraphPass> pass(
|
|
"test-print-callgraph", "Print the contents of a constructed callgraph.");
|
|
}
|
|
} // namespace test
|
|
} // namespace mlir
|