Add --localize-max-size option and optimization (#5072).

This commit is contained in:
Wilson Snyder
2024-04-30 19:46:54 -04:00
parent 4982f63da2
commit 8fd038f88e
9 changed files with 84 additions and 7 deletions
+6 -3
View File
@@ -63,9 +63,12 @@ class LocalizeVisitor final : public VNVisitor {
// METHODS
bool isOptimizable(AstVarScope* nodep) {
return !nodep->user1() || // Not marked as not optimizable, or ...
(nodep->varp()->varType() == VVarType::BLOCKTEMP
&& m_accessors(nodep).size() == 1); // .. a block temp used in a single CFunc
return ((!nodep->user1() // Not marked as not optimizable, or ...
// .. a block temp used in a single CFunc
|| (nodep->varp()->varType() == VVarType::BLOCKTEMP
&& m_accessors(nodep).size() == 1))
// and under size limit
&& nodep->varp()->dtypep()->widthTotalBytes() <= v3Global.opt.localizeMaxSize());
}
static bool existsNonLeaf(const std::unordered_set<AstCFunc*>& funcps) {