3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-24 14:53:42 +00:00

internal_stats: astnode (sizeof)

This commit is contained in:
Emil J. Tywoniak 2024-09-11 11:34:20 +02:00
parent 17ee367c7b
commit 1372c47036
3 changed files with 10 additions and 0 deletions

View file

@ -41,6 +41,8 @@ namespace AST {
std::string current_filename;
void (*set_line_num)(int) = NULL;
int (*get_line_num)() = NULL;
unsigned long long astnodes = 0;
unsigned long long astnode_count() { return astnodes; }
}
// instantiate global variables (private API)
@ -204,6 +206,7 @@ AstNode::AstNode(AstNodeType type, AstNode *child1, AstNode *child2, AstNode *ch
static unsigned int hashidx_count = 123456789;
hashidx_count = mkhash_xorshift(hashidx_count);
hashidx_ = hashidx_count;
astnodes++;
this->type = type;
filename = current_filename;
@ -292,6 +295,7 @@ void AstNode::delete_children()
// AstNode destructor
AstNode::~AstNode()
{
astnodes--;
delete_children();
}