LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
SymbolDefTreePass.cpp
Go to the documentation of this file.
1//===-- SymbolDefTreePass.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_SYMBOLDEFTREEPRINTERPASS
21#define GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
23
24using namespace component;
25
26class SymbolDefTreePass : public impl::SymbolDefTreePrinterPassBase<SymbolDefTreePass> {
27public:
29
30protected:
31 void runOnOperation() override {
32 markAllAnalysesPreserved();
33
34 SymbolDefTree &a = getAnalysis<SymbolDefTree>();
35 if (saveDotGraph) {
36 a.dumpToDotFile();
37 }
39 }
40};
41
42std::unique_ptr<mlir::Pass> createSymbolDefTreePrinterPass() {
43 return std::make_unique<SymbolDefTreePass>();
44}
45
46} // namespace llzk
Builds a tree structure representing the symbol table structure.
void dumpToDotFile(std::string filename="") const
Dump the tree to file in dot graph format.
void print(llvm::raw_ostream &os) const
::mlir::Pass::Option<::llzk::OutputStream > outputStream
llvm::raw_ostream & toStream(OutputStream val)
std::unique_ptr< mlir::Pass > createSymbolDefTreePrinterPass()