Internals: Rename AstRefDType subDTypep. Merge from dtype. No functional change.

This commit is contained in:
Wilson Snyder 2012-04-29 08:38:53 -04:00
parent 486b6580d8
commit 91e4010039
3 changed files with 14 additions and 13 deletions

View File

@ -366,21 +366,21 @@ public:
struct AstRefDType : public AstNodeDType {
private:
AstNodeDType* m_subDTypep; // data type pointed to, BELOW the AstTypedef
AstNodeDType* m_refDTypep; // data type pointed to, BELOW the AstTypedef
string m_name; // Name of an AstTypedef
AstPackage* m_packagep; // Package hierarchy
public:
AstRefDType(FileLine* fl, const string& name)
: AstNodeDType(fl), m_subDTypep(NULL), m_name(name), m_packagep(NULL) {}
: AstNodeDType(fl), m_refDTypep(NULL), m_name(name), m_packagep(NULL) {}
AstRefDType(FileLine* fl, AstNodeDType* defp)
: AstNodeDType(fl), m_subDTypep(defp), m_packagep(NULL) {
: AstNodeDType(fl), m_refDTypep(defp), m_packagep(NULL) {
widthSignedFrom(defp);
}
ASTNODE_NODE_FUNCS(RefDType, REFDTYPE)
// METHODS
virtual bool broken() const { return m_subDTypep && !m_subDTypep->brokeExists(); }
virtual void cloneRelink() { if (m_subDTypep && m_subDTypep->clonep()) {
m_subDTypep = m_subDTypep->clonep()->castNodeDType();
virtual bool broken() const { return m_refDTypep && !m_refDTypep->brokeExists(); }
virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) {
m_refDTypep = m_refDTypep->clonep()->castNodeDType();
}}
virtual bool same(AstNode* samep) const {
return skipRefp()->sameTree(samep->castRefDType()->skipRefp()); }
@ -401,9 +401,10 @@ public:
else { v3fatalSrc("Typedef not linked"); return NULL; }
}
AstNodeDType* dtypeSkipRefp() const { return defp()->skipRefp(); } // op1 = Range of variable
AstNodeDType* defp() const { return m_subDTypep; }
AstNodeDType* subDTypep() const { return m_subDTypep; }
void subDTypep(AstNodeDType* nodep) { m_subDTypep=nodep; }
AstNodeDType* defp() const { return m_refDTypep; } // Code backward compatibility name for refDTypep
AstNodeDType* refDTypep() const { return m_refDTypep; }
void refDTypep(AstNodeDType* nodep) { m_refDTypep=nodep; }
AstNodeDType* subDTypep() const { return m_refDTypep; }
AstPackage* packagep() const { return m_packagep; }
void packagep(AstPackage* nodep) { m_packagep=nodep; }
};
@ -724,7 +725,7 @@ public:
AstNode* valuep() const { return op3p()->castNode(); } // op3 = Initial value that never changes (static const)
void valuep(AstNode* nodep) { setOp3p(nodep); } // It's valuep, not constp, as may be more complicated than an AstConst
void addAttrsp(AstNode* nodep) { addNOp4p(nodep); }
AstNode* attrsp() const { return op4p()->castNode(); } // op4 = Attributes during early parse
AstNode* attrsp() const { return op4p()->castNode(); } // op4 = Attributes during early parse
bool hasSimpleInit() const { return (op3p() && !op3p()->castInitArray()); }
void dtypep(AstNodeDType* nodep) { setOp1p(nodep); }
void attrClockEn(bool flag) { m_attrClockEn = flag; }

View File

@ -551,7 +551,7 @@ private:
defp = m_curVarsp->findIdUpward(nodep->name())->castTypedef();
}
if (!defp) { nodep->v3error("Can't find typedef: "<<nodep->prettyName()); }
nodep->subDTypep(defp->subDTypep());
nodep->refDTypep(defp->subDTypep());
nodep->packagep(packageFor(defp));
}
nodep->iterateChildren(*this);

View File

@ -282,8 +282,8 @@ private:
int width = max(vup->c()->width(), max(nodep->expr1p()->width(), nodep->expr2p()->width()));
int mwidth = max(vup->c()->widthMin(), max(nodep->expr1p()->widthMin(), nodep->expr2p()->widthMin()));
nodep->dtypeSetLogicSized(width,mwidth,
((nodep->expr1p()->isSigned() && nodep->expr2p()->isSigned())
? AstNumeric::SIGNED : AstNumeric::UNSIGNED));
((nodep->expr1p()->isSigned() && nodep->expr2p()->isSigned())
? AstNumeric::SIGNED : AstNumeric::UNSIGNED));
}
if (vup->c()->final()) {
// Final width known, so make sure children recompute & check their sizes