diff options
author | Xiretza <xiretza@xiretza.xyz> | 2021-03-17 00:14:27 +0100 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-06-14 13:56:51 -0400 |
commit | 62a42c317c41590b654f59851b4730c89bfcd7ae (patch) | |
tree | 85b7f527c7fc32289e2f9d41372d053fbfb47c72 /frontends/ast | |
parent | 091295a5a533c44a4ad20d297fdad1ec2a77903c (diff) | |
download | yosys-62a42c317c41590b654f59851b4730c89bfcd7ae.tar.gz yosys-62a42c317c41590b654f59851b4730c89bfcd7ae.tar.bz2 yosys-62a42c317c41590b654f59851b4730c89bfcd7ae.zip |
ast: delete wires and localparams after finishing const evaluation
Diffstat (limited to 'frontends/ast')
-rw-r--r-- | frontends/ast/simplify.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 8ef681069..f85306423 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -4774,6 +4774,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall, bool must_succeed) { std::map<std::string, AstNode*> backup_scope = current_scope; std::map<std::string, AstNode::varinfo_t> variables; + std::vector<AstNode*> to_delete; AstNode *block = new AstNode(AST_BLOCK); AstNode *result = nullptr; @@ -4831,6 +4832,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall, bool must_succeed) current_scope[stmt->str] = stmt; block->children.erase(block->children.begin()); + to_delete.push_back(stmt); continue; } @@ -4843,6 +4845,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall, bool must_succeed) current_scope[stmt->str] = stmt; block->children.erase(block->children.begin()); + to_delete.push_back(stmt); continue; } @@ -5038,6 +5041,11 @@ finished: delete block; current_scope = backup_scope; + for (auto it : to_delete) { + delete it; + } + to_delete.clear(); + return result; } |