mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
ast: delete wires and localparams after finishing const evaluation
This commit is contained in:
parent
091295a5a5
commit
62a42c317c
|
@ -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*> backup_scope = current_scope;
|
||||||
std::map<std::string, AstNode::varinfo_t> variables;
|
std::map<std::string, AstNode::varinfo_t> variables;
|
||||||
|
std::vector<AstNode*> to_delete;
|
||||||
AstNode *block = new AstNode(AST_BLOCK);
|
AstNode *block = new AstNode(AST_BLOCK);
|
||||||
AstNode *result = nullptr;
|
AstNode *result = nullptr;
|
||||||
|
|
||||||
|
@ -4831,6 +4832,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall, bool must_succeed)
|
||||||
current_scope[stmt->str] = stmt;
|
current_scope[stmt->str] = stmt;
|
||||||
|
|
||||||
block->children.erase(block->children.begin());
|
block->children.erase(block->children.begin());
|
||||||
|
to_delete.push_back(stmt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4843,6 +4845,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall, bool must_succeed)
|
||||||
current_scope[stmt->str] = stmt;
|
current_scope[stmt->str] = stmt;
|
||||||
|
|
||||||
block->children.erase(block->children.begin());
|
block->children.erase(block->children.begin());
|
||||||
|
to_delete.push_back(stmt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5038,6 +5041,11 @@ finished:
|
||||||
delete block;
|
delete block;
|
||||||
current_scope = backup_scope;
|
current_scope = backup_scope;
|
||||||
|
|
||||||
|
for (auto it : to_delete) {
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
|
to_delete.clear();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue