Add -Oo to disable const bit tree (#2830).

This commit is contained in:
Wilson Snyder 2021-03-10 17:47:31 -05:00
parent 9483ebefae
commit 5a4e4b2dcd
3 changed files with 6 additions and 1 deletions

View File

@ -687,6 +687,7 @@ private:
return true;
}
bool matchBitOpTree(AstNode* nodep) {
if (!v3Global.opt.oConstBitOpTree()) return false;
AstNode* newp = nullptr;
bool tried = false;
if (AstAnd* andp = VN_CAST(nodep, And)) { // 1 & BitOpTree

View File

@ -1159,7 +1159,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
case 'k': m_oSubstConst = flag; break;
case 'l': m_oLife = flag; break;
case 'm': m_oAssemble = flag; break;
// n o
// n
case 'o': m_oConstBitOpTree = flag; break; // Can remove ~2022-01 when stable
case 'p':
m_public = !flag;
break; // With -Op so flag=0, we want public on so few optimizations done
@ -1864,6 +1865,7 @@ void V3Options::optimize(int level) {
m_oCase = flag;
m_oCombine = flag;
m_oConst = flag;
m_oConstBitOpTree = flag;
m_oDedupe = flag;
m_oExpand = flag;
m_oGate = flag;

View File

@ -341,6 +341,7 @@ private:
bool m_oCase; // main switch: -Oe: case tree conversion
bool m_oCombine; // main switch: -Ob: common icode packing
bool m_oConst; // main switch: -Oc: constant folding
bool m_oConstBitOpTree; // main switch: -Oo: constant bit op tree
bool m_oDedupe; // main switch: -Od: logic deduplication
bool m_oExpand; // main switch: -Ox: expansion of C macros
bool m_oGate; // main switch: -Og: gate wire elimination
@ -563,6 +564,7 @@ public:
bool oCase() const { return m_oCase; }
bool oCombine() const { return m_oCombine; }
bool oConst() const { return m_oConst; }
bool oConstBitOpTree() const { return m_oConstBitOpTree; }
bool oDedupe() const { return m_oDedupe; }
bool oExpand() const { return m_oExpand; }
bool oGate() const { return m_oGate; }