From 3a720204c2dd05f64f484a39efdb7d9917e21b82 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 4 Aug 2019 08:16:24 -0400 Subject: [PATCH] Internals: Remove m_logicMap as m_detailedMap covers it. No functional change intended. --- src/V3Ast.cpp | 2 +- src/V3Ast.h | 2 +- src/V3AstNodes.cpp | 36 ------------------------------------ src/V3AstNodes.h | 7 +------ src/V3Const.cpp | 2 +- src/V3Gate.cpp | 2 +- 6 files changed, 5 insertions(+), 46 deletions(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index ded1d0fa6..61d45b7e8 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -1139,7 +1139,7 @@ void AstNode::v3errorEnd(std::ostringstream& str) const { void AstNode::dtypeChgSigned(bool flag) { UASSERT_OBJ(dtypep(), this, "No dtype when changing to (un)signed"); dtypeChgWidthSigned(dtypep()->width(), dtypep()->widthMin(), - flag ? AstNumeric::SIGNED : AstNumeric::UNSIGNED); + AstNumeric::fromBool(flag)); } void AstNode::dtypeChgWidth(int width, int widthMin) { UASSERT_OBJ(dtypep(), this, diff --git a/src/V3Ast.h b/src/V3Ast.h index b592c6849..caf7107bc 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1942,7 +1942,7 @@ public: // AstNumeric::NOSIGN overloaded to indicate not packed m_packed = (numericUnpack != AstNumeric::NOSIGN); m_isFourstate = false; // V3Width computes - numeric(numericUnpack.isSigned() ? AstNumeric::SIGNED : AstNumeric::UNSIGNED); + numeric(AstNumeric::fromBool(numericUnpack.isSigned())); } ASTNODE_BASE_FUNCS(NodeClassDType) virtual const char* broken() const; diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 6b3299ac6..8d46ee86b 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -676,12 +676,6 @@ void AstTypeTable::clearCache() { for (int i=0; i < static_cast(AstBasicDTypeKwd::_ENUM_MAX); ++i) { m_basicps[i] = NULL; } - for (int isbit=0; isbit<_IDX0_MAX; ++isbit) { - for (int numer=0; numernextp()) { @@ -718,24 +712,10 @@ AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd) AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, int width, int widthMin, AstNumeric numeric) { - int idx = IDX0_LOGIC; - if (kwd == AstBasicDTypeKwd::LOGIC) idx = IDX0_LOGIC; - else if (kwd == AstBasicDTypeKwd::BIT) idx = IDX0_BIT; - else fl->v3fatalSrc("Bad kwd for findLogicBitDType"); - std::pair widths = make_pair(width, widthMin); - LogicMap& mapr = m_logicMap[idx][static_cast(numeric)]; - LogicMap::const_iterator it = mapr.find(widths); - if (it != mapr.end()) return it->second; - // AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin); - // Because the detailed map doesn't update this map, - // check the detailed map for this same node, and if found update this map - // Also adds this new node to the detailed map AstBasicDType* newp = findInsertSameDType(new1p); if (newp != new1p) new1p->deleteTree(); else addTypesp(newp); - // - mapr.insert(make_pair(widths, newp)); return newp; } @@ -1030,22 +1010,6 @@ void AstTypeTable::dump(std::ostream& str) { subnodep->dump(str); } } - for (int isbit=0; isbit<2; ++isbit) { - for (int issigned=0; issignedsecond; - str<first.first<<"/"<first.second; - str<<"\t\t"< "; - dtypep->dump(str); - } - } - } { DetailedMap& mapr = m_detailedMap; for (DetailedMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 79d256359..7128a467f 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -56,8 +56,7 @@ private: dtypeSetString(); } else { dtypeSetLogicSized(m_num.width(), (m_num.sized() ? 0 : m_num.widthMin()), - m_num.isSigned() ? AstNumeric::SIGNED - : AstNumeric::UNSIGNED); + AstNumeric::fromBool(m_num.isSigned())); } } public: @@ -6066,12 +6065,8 @@ public: class AstTypeTable : public AstNode { // Container for hash of standard data types // Children: NODEDTYPEs - typedef std::map,AstBasicDType*> LogicMap; AstBasicDType* m_basicps[AstBasicDTypeKwd::_ENUM_MAX]; // - enum { IDX0_LOGIC, IDX0_BIT, _IDX0_MAX }; - LogicMap m_logicMap[_IDX0_MAX][AstNumeric::_ENUM_MAX]; // uses above IDX enums - // typedef std::map DetailedMap; DetailedMap m_detailedMap; public: diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 6a55ed0df..31176c822 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -833,7 +833,7 @@ private: // use the lhs to replace the parent concat lp->lhsp()->replaceWith(newlp); lp->rhsp()->replaceWith(newrp); - lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), AstNumeric::fromBool(true)); + lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), AstNumeric::SIGNED); UINFO(5, "merged "<< nodep <unlinkFrBack()->deleteTree(); VL_DANGLING(rp); nodep->replaceWith(lp->unlinkFrBack()); nodep->deleteTree(); VL_DANGLING(nodep); diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 617c47fb4..48124de7b 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -1330,7 +1330,7 @@ private: oldrhsp->deleteTree(); VL_DANGLING(oldrhsp); m_assignp->dtypeChgWidthSigned(m_assignp->width()+assignp->width(), m_assignp->width()+assignp->width(), - AstNumeric::fromBool(true)); + AstNumeric::SIGNED); // don't need to delete, will be handled //assignp->unlinkFrBack(); assignp->deleteTree(); VL_DANGLING(assignp);