Add JSON AST dumps (#5020)

This commit is contained in:
Szymon Gizler
2024-03-28 07:32:18 -04:00
committed by GitHub
parent f645382f11
commit 8301fdc6d3
17 changed files with 828 additions and 26 deletions
+19 -1
View File
@@ -16,6 +16,10 @@
#include "V3PchAstMT.h"
#include "V3Global.h"
#include "V3EmitV.h"
#include "V3Error.h"
#include "V3File.h"
#include "V3HierBlock.h"
#include "V3LinkCells.h"
@@ -23,6 +27,8 @@
#include "V3ParseSym.h"
#include "V3Stats.h"
VL_DEFINE_DEBUG_FUNCTIONS;
//######################################################################
// V3Global
@@ -106,11 +112,23 @@ string V3Global::digitsFilename(int number) {
void V3Global::dumpCheckGlobalTree(const string& stagename, int newNumber, bool doDump) {
const string treeFilename = v3Global.debugFilename(stagename + ".tree", newNumber);
v3Global.rootp()->dumpTreeFile(treeFilename, doDump);
if (dumpTreeLevel()) v3Global.rootp()->dumpTreeFile(treeFilename, doDump);
if (dumpTreeJsonLevel()) {
v3Global.rootp()->dumpTreeJsonFile(treeFilename + ".json", doDump);
}
if (v3Global.opt.dumpTreeDot()) {
v3Global.rootp()->dumpTreeDotFile(treeFilename + ".dot", doDump);
}
if (v3Global.opt.stats()) V3Stats::statsStage(stagename);
if (doDump && v3Global.opt.debugEmitV()) V3EmitV::debugEmitV(treeFilename + ".v");
if (v3Global.opt.debugCheck() || dumpTreeEitherLevel()) {
// Error check
v3Global.rootp()->checkTree();
// Broken isn't part of check tree because it can munge iterp's
// set by other steps if it is called in the middle of other operations
V3Broken::brokenAll(v3Global.rootp());
}
}
void V3Global::idPtrMapDumpJson(std::ostream& os) {