LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
SymbolUseGraphPass.cpp
Go to the documentation of this file.
1//===-- SymbolUseGraphPass.cpp ----------------------------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
13//===----------------------------------------------------------------------===//
14
17
18namespace llzk {
19
20#define GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
21#define GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
23
24using namespace component;
25
26class SymbolUseGraphPass : public impl::SymbolUseGraphPrinterPassBase<SymbolUseGraphPass> {
27public:
29
30protected:
31 void runOnOperation() override {
32 markAllAnalysesPreserved();
33
34 SymbolUseGraph &a = getAnalysis<SymbolUseGraph>();
35 if (saveDotGraph) {
36 a.dumpToDotFile();
37 }
39 }
40};
41
42std::unique_ptr<mlir::Pass> createSymbolUseGraphPrinterPass() {
43 return std::make_unique<SymbolUseGraphPass>();
44}
45
46} // namespace llzk
Builds a graph structure representing the relationships between symbols and their uses.
void dumpToDotFile(std::string filename="") const
Dump the graph to file in dot graph format.
void print(llvm::raw_ostream &os) const
llvm::raw_ostream & toStream(OutputStream val)
std::unique_ptr< mlir::Pass > createSymbolUseGraphPrinterPass()