Internals: remove extra width sets

This commit is contained in:
Wilson Snyder 2011-12-22 19:08:49 -05:00
parent fdeb6bcae0
commit b32f925468
3 changed files with 7 additions and 6 deletions

View File

@ -48,11 +48,12 @@ class EmitCInlines : EmitCBaseVisitor {
virtual void visit(AstVar* nodep, AstNUser*) { virtual void visit(AstVar* nodep, AstNUser*) {
// All wide constants load into variables, so we can just hunt for them // All wide constants load into variables, so we can just hunt for them
nodep->iterateChildren(*this); nodep->iterateChildren(*this);
if (nodep->widthWords() >= EMITCINLINES_NUM_CONSTW ) { int words = nodep->widthWords();
if (int(m_wordWidths.size()) <= nodep->widthWords()) { if (words >= EMITCINLINES_NUM_CONSTW ) {
m_wordWidths.resize(nodep->widthWords()+5); if (int(m_wordWidths.size()) <= words) {
m_wordWidths.resize(words+5);
} }
++ m_wordWidths.at(nodep->widthWords()); ++ m_wordWidths.at(words);
v3Global.needHInlines(true); v3Global.needHInlines(true);
} }
} }

View File

@ -229,7 +229,6 @@ private:
constwidthp), constwidthp),
nodep, nodep,
constzerop); constzerop);
newp->widthSignedFrom(nodep);
replaceHandle.relink(newp); replaceHandle.relink(newp);
} }
} }

View File

@ -108,14 +108,15 @@ private:
AstNode* newp = new AstConst(lhsp->fileline(), num); AstNode* newp = new AstConst(lhsp->fileline(), num);
return newp; return newp;
} else if (rhs > 0) { } else if (rhs > 0) {
// We must make sure sub gets sign of original value
AstNode* newp = new AstSub(lhsp->fileline(), lhsp, AstNode* newp = new AstSub(lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32(), rhs)); new AstConst(lhsp->fileline(), AstConst::Unsized32(), rhs));
// We must make sure sub gets sign of original value
newp->numericFrom(lhsp); newp->numericFrom(lhsp);
return newp; return newp;
} else { // rhs < 0; } else { // rhs < 0;
AstNode* newp = new AstAdd(lhsp->fileline(), lhsp, AstNode* newp = new AstAdd(lhsp->fileline(), lhsp,
new AstConst(lhsp->fileline(), AstConst::Unsized32(), -rhs)); new AstConst(lhsp->fileline(), AstConst::Unsized32(), -rhs));
// We must make sure sub gets sign of original value
newp->numericFrom(lhsp); newp->numericFrom(lhsp);
return newp; return newp;
} }