mirror of
https://github.com/verilator/verilator.git
synced 2025-04-21 12:06:55 +00:00
Internals: remove extra width sets
This commit is contained in:
parent
fdeb6bcae0
commit
b32f925468
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,6 @@ private:
|
|||||||
constwidthp),
|
constwidthp),
|
||||||
nodep,
|
nodep,
|
||||||
constzerop);
|
constzerop);
|
||||||
newp->widthSignedFrom(nodep);
|
|
||||||
replaceHandle.relink(newp);
|
replaceHandle.relink(newp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user