Internals: Dump array bounds in tree file.

This commit is contained in:
Wilson Snyder 2013-01-13 14:30:56 -05:00
parent 191af2e87b
commit dfc11da2ce
2 changed files with 13 additions and 0 deletions

View File

@ -1551,6 +1551,9 @@ public:
MemberNameMap::const_iterator it = m_members.find(name);
return (it==m_members.end()) ? NULL : it->second;
}
int lsb() const { return 0; }
int msb() const { return dtypep()->width()-1; } // Packed classes look like arrays
int msbMaxSelect() const { return msb(); }
};
struct AstNodeArrayDType : public AstNodeDType {
@ -1563,6 +1566,8 @@ private:
public:
AstNodeArrayDType(FileLine* fl) : AstNodeDType(fl) {}
ASTNODE_BASE_FUNCS(NodeArrayDType)
virtual void dump(ostream& str);
virtual void dumpSmall(ostream& str);
virtual bool broken() const { return !((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists())
|| (!m_refDTypep && childDTypep())); }
virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) {

View File

@ -748,6 +748,14 @@ void AstNodeDType::dumpSmall(ostream& str) {
if (!widthSized()) str<<"/"<<widthMin();
str<<")";
}
void AstNodeArrayDType::dumpSmall(ostream& str) {
this->AstNodeDType::dumpSmall(str);
str<<"["<<msb()<<":"<<lsb()<<"]";
}
void AstNodeArrayDType::dump(ostream& str) {
this->AstNodeDType::dump(str);
str<<" ["<<msb()<<":"<<lsb()<<"]";
}
void AstNodeModule::dump(ostream& str) {
this->AstNode::dump(str);
str<<" L"<<level();