Internals: Fix dead parameter calls. No functional change.

This commit is contained in:
Wilson Snyder 2012-05-09 23:04:20 -04:00
parent 942cb5e87e
commit 3ea2038d3d
1 changed files with 17 additions and 15 deletions

View File

@ -298,7 +298,7 @@ private:
nodep->expr1p()->iterateAndNext(*this,WidthVP(width,mwidth,FINAL).p()); nodep->expr1p()->iterateAndNext(*this,WidthVP(width,mwidth,FINAL).p());
nodep->expr2p()->iterateAndNext(*this,WidthVP(width,mwidth,FINAL).p()); nodep->expr2p()->iterateAndNext(*this,WidthVP(width,mwidth,FINAL).p());
// Error report and change sizes for suboperands of this node. // Error report and change sizes for suboperands of this node.
widthCheckReduce(nodep,"Conditional Test",nodep->condp(),1,0); widthCheckReduce(nodep,"Conditional Test",nodep->condp());
widthCheck(nodep,"Conditional True",nodep->expr1p(),width,mwidth); widthCheck(nodep,"Conditional True",nodep->expr1p(),width,mwidth);
widthCheck(nodep,"Conditional False",nodep->expr2p(),width,mwidth); widthCheck(nodep,"Conditional False",nodep->expr2p(),width,mwidth);
} }
@ -913,9 +913,9 @@ private:
nodep->sensesp()->iterateAndNext(*this); nodep->sensesp()->iterateAndNext(*this);
if (nodep->disablep()) { if (nodep->disablep()) {
nodep->disablep()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->disablep()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
widthCheckReduce(nodep,"Disable",nodep->disablep(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"Disable",nodep->disablep()); // it's like an if() condition.
} }
widthCheckReduce(nodep,"Property",nodep->propp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"Property",nodep->propp()); // it's like an if() condition.
nodep->dtypeSetLogicBool(); nodep->dtypeSetLogicBool();
} }
@ -961,7 +961,7 @@ private:
nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
if (!nodep->castGenFor()) nodep->bodysp()->iterateAndNext(*this); if (!nodep->castGenFor()) nodep->bodysp()->iterateAndNext(*this);
nodep->incsp()->iterateAndNext(*this); nodep->incsp()->iterateAndNext(*this);
widthCheckReduce(nodep,"For Test Condition",nodep->condp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"For Test Condition",nodep->condp()); // it's like an if() condition.
} }
virtual void visit(AstRepeat* nodep, AstNUser*) { virtual void visit(AstRepeat* nodep, AstNUser*) {
nodep->countp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p()); nodep->countp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
@ -973,7 +973,7 @@ private:
nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
nodep->bodysp()->iterateAndNext(*this); nodep->bodysp()->iterateAndNext(*this);
nodep->incsp()->iterateAndNext(*this); nodep->incsp()->iterateAndNext(*this);
widthCheckReduce(nodep,"For Test Condition",nodep->condp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"For Test Condition",nodep->condp()); // it's like an if() condition.
} }
virtual void visit(AstNodeIf* nodep, AstNUser*) { virtual void visit(AstNodeIf* nodep, AstNUser*) {
// TOP LEVEL NODE // TOP LEVEL NODE
@ -984,7 +984,7 @@ private:
} }
nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->condp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
spliceCvtCmpD0(nodep->condp()); spliceCvtCmpD0(nodep->condp());
widthCheckReduce(nodep,"If",nodep->condp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"If",nodep->condp()); // it's like an if() condition.
//if (debug()) nodep->dumpTree(cout," IfOut: "); //if (debug()) nodep->dumpTree(cout," IfOut: ");
} }
virtual void visit(AstNodeAssign* nodep, AstNUser*) { virtual void visit(AstNodeAssign* nodep, AstNUser*) {
@ -1138,19 +1138,19 @@ private:
// TOP LEVEL NODE // TOP LEVEL NODE
nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
nodep->stmtsp()->iterateChildren(*this,WidthVP(ANYSIZE,0,BOTH).p()); nodep->stmtsp()->iterateChildren(*this,WidthVP(ANYSIZE,0,BOTH).p());
widthCheckReduce(nodep,"Property",nodep->propp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"Property",nodep->propp()); // it's like an if() condition.
} }
virtual void visit(AstPslAssert* nodep, AstNUser*) { virtual void visit(AstPslAssert* nodep, AstNUser*) {
// TOP LEVEL NODE // TOP LEVEL NODE
nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
widthCheckReduce(nodep,"Property",nodep->propp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"Property",nodep->propp()); // it's like an if() condition.
} }
virtual void visit(AstVAssert* nodep, AstNUser*) { virtual void visit(AstVAssert* nodep, AstNUser*) {
// TOP LEVEL NODE // TOP LEVEL NODE
nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p());
nodep->passsp()->iterateAndNext(*this); nodep->passsp()->iterateAndNext(*this);
nodep->failsp()->iterateAndNext(*this); nodep->failsp()->iterateAndNext(*this);
widthCheckReduce(nodep,"Property",nodep->propp(),1,1); // it's like an if() condition. widthCheckReduce(nodep,"Property",nodep->propp()); // it's like an if() condition.
} }
virtual void visit(AstPin* nodep, AstNUser*) { virtual void visit(AstPin* nodep, AstNUser*) {
//if (debug()) nodep->dumpTree(cout,"- PinPre: "); //if (debug()) nodep->dumpTree(cout,"- PinPre: ");
@ -1425,7 +1425,7 @@ private:
} }
nodep->dtypeSetLogicBool(); nodep->dtypeSetLogicBool();
if (vup->c()->final()) { if (vup->c()->final()) {
widthCheckReduce(nodep,"LHS",nodep->op1p(),1,1); widthCheckReduce(nodep,"LHS",nodep->op1p());
} }
} }
void visit_log_O1_LR1rus(AstNodeBiop* nodep, AstNUser* vup) { void visit_log_O1_LR1rus(AstNodeBiop* nodep, AstNUser* vup) {
@ -1439,8 +1439,8 @@ private:
} }
nodep->dtypeSetLogicBool(); nodep->dtypeSetLogicBool();
if (vup->c()->final()) { if (vup->c()->final()) {
widthCheckReduce(nodep,"LHS",nodep->lhsp(),1,1); widthCheckReduce(nodep,"LHS",nodep->lhsp());
widthCheckReduce(nodep,"RHS",nodep->rhsp(),1,1); widthCheckReduce(nodep,"RHS",nodep->rhsp());
} }
} }
@ -1853,10 +1853,12 @@ private:
} }
void widthCheckReduce (AstNode* nodep, const char* side, void widthCheckReduce (AstNode* nodep, const char* side,
AstNode* underp, int expWidth, int expWidthMin, AstNode* underp) {
bool ignoreWarn=false) { // Underp is used in a boolean context, reduce a multibit number to one bit
// Before calling this, iterate into underp with FINAL state, so numbers get resized appropriately // Before calling this, iterate into underp with FINAL state, so numbers get resized appropriately
if (expWidthMin==0) expWidthMin = expWidth; bool ignoreWarn = false; // Not used
bool expWidth = 1;
bool expWidthMin = 1;
if (expWidth!=1) nodep->v3fatalSrc("Only for binary functions"); if (expWidth!=1) nodep->v3fatalSrc("Only for binary functions");
bool bad = widthBad(underp,expWidth,expWidthMin); bool bad = widthBad(underp,expWidth,expWidthMin);
if (bad) { if (bad) {