More refdtype handling

This commit is contained in:
Todd Strader 2020-03-31 12:24:36 -04:00
parent e17f6ed030
commit fd175de17e
2 changed files with 11 additions and 10 deletions

View File

@ -2210,6 +2210,7 @@ public:
virtual bool matchingArrayType(const AstNodeArrayDType* matchp) const = 0;
virtual bool matching(const AstNodeDType* typep) const {
const AstNodeArrayDType* arrayp = VN_CAST_CONST(typep, NodeArrayDType);
if (!arrayp) return typep->matching(this);
return arrayp && matchingArrayType(arrayp) && declRange() == arrayp->declRange()
&& subDTypep()->matching(arrayp->subDTypep());
}

View File

@ -453,6 +453,7 @@ public:
virtual int widthTotalBytes() const { return subDTypep()->widthTotalBytes(); }
virtual bool matching(const AstNodeDType* typep) const {
const AstAssocArrayDType* arrayp = VN_CAST_CONST(typep, AssocArrayDType);
if (!arrayp) return typep->matching(this);
return arrayp && subDTypep()->matching(arrayp->subDTypep())
&& keyDTypep()->matching(arrayp->keyDTypep());
}
@ -508,6 +509,7 @@ public:
virtual int widthTotalBytes() const { return subDTypep()->widthTotalBytes(); }
virtual bool matching(const AstNodeDType* typep) const {
const AstDynArrayDType* arrayp = VN_CAST_CONST(typep, DynArrayDType);
if (!arrayp) return typep->matching(this);
return arrayp && subDTypep()->matching(arrayp->subDTypep());
}
};
@ -615,6 +617,7 @@ public:
virtual int widthTotalBytes() const { return subDTypep()->widthTotalBytes(); }
virtual bool matching(const AstNodeDType* typep) const {
const AstUnsizedArrayDType* arrayp = VN_CAST_CONST(typep, UnsizedArrayDType);
if (!arrayp) return typep->matching(this);
return arrayp && subDTypep()->matching(arrayp->subDTypep());
}
};
@ -696,16 +699,12 @@ public:
return m == sp->m; }
virtual bool matching(const AstNodeDType* typep) const {
const AstBasicDType* matchp = VN_CAST_CONST(typep, BasicDType);
if (!matchp) {
return typep->matching(this);
} else if (isSigned() == matchp->isSigned()
&& (same(matchp) ||
(isIntNumeric() && matchp->isIntNumeric()
&& isFourstate() == matchp->isFourstate()
&& nrange() == matchp->nrange()))) {
return true;
}
return false;
if (!matchp) return typep->matching(this);
return isSigned() == matchp->isSigned()
&& (same(matchp) ||
(isIntNumeric() && matchp->isIntNumeric()
&& isFourstate() == matchp->isFourstate()
&& nrange() == matchp->nrange()));
}
virtual bool similarDType(AstNodeDType* samep) const {
return type()==samep->type() && same(samep); }
@ -940,6 +939,7 @@ public:
virtual int widthTotalBytes() const { return subDTypep()->widthTotalBytes(); }
virtual bool matching(const AstNodeDType* typep) const {
const AstQueueDType* queuep = VN_CAST_CONST(typep, QueueDType);
if (!queuep) return typep->matching(this);
return queuep && subDTypep()->matching(typep);
}
};