Internals: Use 'Bit' where mean 2-state type. No functional change.

This commit is contained in:
Wilson Snyder
2020-11-29 08:23:36 -05:00
parent aa360052a8
commit a54ac52a35
13 changed files with 117 additions and 113 deletions
+4 -5
View File
@@ -161,7 +161,7 @@ private:
// rarely required (only when trying to merge a "cond & value" with an
// earlier ternary), we will just always mask it for safety.
AstNode* maskLsb(AstNode* nodep) {
AstNode* const maskp = new AstConst(nodep->fileline(), AstConst::LogicTrue());
AstNode* const maskp = new AstConst(nodep->fileline(), AstConst::BitTrue());
return new AstAnd(nodep->fileline(), nodep, maskp);
}
@@ -170,8 +170,7 @@ private:
// of the RHS is expected to be deleted by the caller.
AstNode* foldAndUnlink(AstNode* rhsp, bool condTrue) {
if (rhsp->sameTree(m_mgCondp)) {
return condTrue ? new AstConst(rhsp->fileline(), AstConst::LogicTrue())
: new AstConst(rhsp->fileline(), AstConst::LogicFalse());
return new AstConst(rhsp->fileline(), AstConst::BitTrueFalse(), condTrue);
} else if (AstNodeCond* const condp = extractCond(rhsp)) {
AstNode* const resp
= condTrue ? condp->expr1p()->unlinkFrBack() : condp->expr2p()->unlinkFrBack();
@@ -183,12 +182,12 @@ private:
} else if (AstAnd* const andp = VN_CAST(rhsp, And)) {
if (andp->lhsp()->sameTree(m_mgCondp)) {
return condTrue ? maskLsb(andp->rhsp()->unlinkFrBack())
: new AstConst(rhsp->fileline(), AstConst::LogicFalse());
: new AstConst(rhsp->fileline(), AstConst::BitFalse());
} else {
UASSERT_OBJ(andp->rhsp()->sameTree(m_mgCondp), rhsp,
"AstAnd doesn't hold condition expression");
return condTrue ? maskLsb(andp->lhsp()->unlinkFrBack())
: new AstConst(rhsp->fileline(), AstConst::LogicFalse());
: new AstConst(rhsp->fileline(), AstConst::BitFalse());
}
}
rhsp->v3fatalSrc("Don't know how to fold expression");