Internals: Move widthPow2. No functional change.

This commit is contained in:
Wilson Snyder 2012-04-29 11:34:25 -04:00
parent 87e8736823
commit 33c9591a4b
4 changed files with 10 additions and 11 deletions

View File

@ -230,15 +230,6 @@ string AstNode::quoteName(const string& namein) {
return out;
}
int AstNode::widthPow2() const {
// I.e. width 30 returns 32, width 32 returns 32.
uint32_t width = this->width();
for (int p2=30; p2>=0; p2--) {
if (width > (1UL<<p2)) return (1UL<<(p2+1));
}
return 1;
}
//######################################################################
// Insertion

View File

@ -981,7 +981,6 @@ public:
int width() const;
int widthMin() const;
int widthWords() const { return VL_WORDS_I(width()); }
int widthPow2() const;
bool isQuad() const { return (width()>VL_WORDSIZE && width()<=VL_QUADSIZE); }
bool isWide() const { return (width()>VL_QUADSIZE); }
bool isDouble() const;

View File

@ -326,6 +326,15 @@ pair<uint32_t,uint32_t> AstNodeDType::dimensions() {
return make_pair(packed, unpacked);
}
int AstNodeDType::widthPow2() const {
// I.e. width 30 returns 32, width 32 returns 32.
uint32_t width = this->width();
for (int p2=30; p2>=0; p2--) {
if (width > (1UL<<p2)) return (1UL<<(p2+1));
}
return 1;
}
// Special operators
int AstArraySel::dimension(AstNode* nodep) {
// How many dimensions is this reference from the base variable?

View File

@ -487,7 +487,7 @@ public:
visit(nodep->castNodeUniop(), vup);
} else {
putbs("VL_REDXOR_");
puts(cvtToStr(nodep->lhsp()->widthPow2()));
puts(cvtToStr(nodep->lhsp()->dtypep()->widthPow2()));
puts("(");
nodep->lhsp()->iterateAndNext(*this);
puts(")");