Internals: Use VN_AS instead of static_cast. Fix some wrong types. (#4561)
This commit is contained in:
parent
bba3487dc4
commit
25dde58297
|
|
@ -160,14 +160,14 @@ public:
|
|||
if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
const AstNodeArrayDType* const asamep = VN_DBG_AS(samep, NodeArrayDType);
|
||||
return (hi() == asamep->hi() && subDTypep() == asamep->subDTypep()
|
||||
&& rangenp()->sameTree(asamep->rangenp()));
|
||||
} // HashedDT doesn't recurse, so need to check children
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
return (asamep && type() == samep->type() && hi() == asamep->hi()
|
||||
&& rangenp()->sameTree(asamep->rangenp())
|
||||
if (type() != samep->type()) return false;
|
||||
const AstNodeArrayDType* const asamep = VN_DBG_AS(samep, NodeArrayDType);
|
||||
return (hi() == asamep->hi() && rangenp()->sameTree(asamep->rangenp())
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp()));
|
||||
}
|
||||
AstNodeDType* getChildDTypep() const override { return childDTypep(); }
|
||||
|
|
@ -314,14 +314,15 @@ public:
|
|||
if (m_keyDTypep && m_keyDTypep->clonep()) m_keyDTypep = m_keyDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstAssocArrayDType* const asamep = static_cast<const AstAssocArrayDType*>(samep);
|
||||
const AstAssocArrayDType* const asamep = VN_DBG_AS(samep, AssocArrayDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
if (!asamep->keyDTypep()) return false;
|
||||
return (subDTypep() == asamep->subDTypep() && keyDTypep() == asamep->keyDTypep());
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstAssocArrayDType* const asamep = static_cast<const AstAssocArrayDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstAssocArrayDType* const asamep = VN_DBG_AS(samep, AssocArrayDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
string prettyDTypeName() const override;
|
||||
|
|
@ -507,7 +508,7 @@ public:
|
|||
public:
|
||||
ASTGEN_MEMBERS_AstCDType;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstCDType* const asamep = static_cast<const AstCDType*>(samep);
|
||||
const AstCDType* const asamep = VN_DBG_AS(samep, CDType);
|
||||
return m_name == asamep->m_name;
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override { return same(samep); }
|
||||
|
|
@ -547,7 +548,7 @@ public:
|
|||
const char* broken() const override;
|
||||
void cloneRelink() override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstClassRefDType* const asamep = static_cast<const AstClassRefDType*>(samep);
|
||||
const AstClassRefDType* const asamep = VN_DBG_AS(samep, ClassRefDType);
|
||||
return (m_classp == asamep->m_classp && m_classOrPackagep == asamep->m_classOrPackagep);
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
|
|
@ -596,7 +597,7 @@ public:
|
|||
if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstConstDType* const sp = static_cast<const AstConstDType*>(samep);
|
||||
const AstConstDType* const sp = VN_DBG_AS(samep, ConstDType);
|
||||
return (m_refDTypep == sp->m_refDTypep);
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
|
|
@ -645,7 +646,7 @@ public:
|
|||
ASTGEN_MEMBERS_AstDefImplicitDType;
|
||||
int uniqueNum() const { return m_uniqueNum; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstDefImplicitDType* const sp = static_cast<const AstDefImplicitDType*>(samep);
|
||||
const AstDefImplicitDType* const sp = VN_DBG_AS(samep, DefImplicitDType);
|
||||
return uniqueNum() == sp->uniqueNum();
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
|
|
@ -696,13 +697,14 @@ public:
|
|||
if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstAssocArrayDType* const asamep = static_cast<const AstAssocArrayDType*>(samep);
|
||||
const AstDynArrayDType* const asamep = VN_DBG_AS(samep, DynArrayDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
return subDTypep() == asamep->subDTypep();
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstAssocArrayDType* const asamep = static_cast<const AstAssocArrayDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstDynArrayDType* const asamep = VN_DBG_AS(samep, DynArrayDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
string prettyDTypeName() const override;
|
||||
|
|
@ -787,7 +789,7 @@ public:
|
|||
}
|
||||
int uniqueNum() const { return m_uniqueNum; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstEnumDType* const sp = static_cast<const AstEnumDType*>(samep);
|
||||
const AstEnumDType* const sp = VN_DBG_AS(samep, EnumDType);
|
||||
return uniqueNum() == sp->uniqueNum();
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override { return this == samep; }
|
||||
|
|
@ -982,9 +984,9 @@ public:
|
|||
AstNodeDType* skipRefToConstp() const override { return subDTypep()->skipRefToConstp(); }
|
||||
AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); }
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstParamTypeDType* const sp = static_cast<const AstParamTypeDType*>(samep);
|
||||
return type() == samep->type() && sp
|
||||
&& this->subDTypep()->skipRefp()->similarDType(sp->subDTypep()->skipRefp());
|
||||
if (type() != samep->type()) return false;
|
||||
const AstParamTypeDType* const sp = VN_DBG_AS(samep, ParamTypeDType);
|
||||
return this->subDTypep()->skipRefp()->similarDType(sp->subDTypep()->skipRefp());
|
||||
}
|
||||
int widthAlignBytes() const override { return dtypep()->widthAlignBytes(); }
|
||||
int widthTotalBytes() const override { return dtypep()->widthTotalBytes(); }
|
||||
|
|
@ -1055,13 +1057,14 @@ public:
|
|||
if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstQueueDType* const asamep = static_cast<const AstQueueDType*>(samep);
|
||||
const AstQueueDType* const asamep = VN_DBG_AS(samep, QueueDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
return (subDTypep() == asamep->subDTypep());
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstQueueDType* const asamep = static_cast<const AstQueueDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstQueueDType* const asamep = VN_DBG_AS(samep, QueueDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
void dumpSmall(std::ostream& str) const override;
|
||||
|
|
@ -1119,7 +1122,7 @@ public:
|
|||
const char* broken() const override;
|
||||
void cloneRelink() override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstRefDType* const asamep = static_cast<const AstRefDType*>(samep);
|
||||
const AstRefDType* const asamep = VN_DBG_AS(samep, RefDType);
|
||||
return (m_typedefp == asamep->m_typedefp && m_refDTypep == asamep->m_refDTypep
|
||||
&& m_name == asamep->m_name && m_classOrPackagep == asamep->m_classOrPackagep);
|
||||
}
|
||||
|
|
@ -1197,13 +1200,14 @@ public:
|
|||
if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep();
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
const AstSampleQueueDType* const asamep = VN_DBG_AS(samep, SampleQueueDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
return (subDTypep() == asamep->subDTypep());
|
||||
}
|
||||
bool similarDType(const AstNodeDType* samep) const override {
|
||||
const AstSampleQueueDType* const asamep = static_cast<const AstSampleQueueDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstSampleQueueDType* const asamep = VN_DBG_AS(samep, SampleQueueDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
void dumpSmall(std::ostream& str) const override;
|
||||
|
|
@ -1396,7 +1400,7 @@ public:
|
|||
ASTGEN_MEMBERS_AstUnpackArrayDType;
|
||||
string prettyDTypeName() const override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstUnpackArrayDType* const sp = static_cast<const AstUnpackArrayDType*>(samep);
|
||||
const AstUnpackArrayDType* const sp = VN_DBG_AS(samep, UnpackArrayDType);
|
||||
return m_isCompound == sp->m_isCompound;
|
||||
}
|
||||
// Outer dimension comes first. The first element is this node.
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ public:
|
|||
const char* broken() const override;
|
||||
int instrCount() const override { return INSTR_COUNT_CALL; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstNodeCCall* const asamep = static_cast<const AstNodeCCall*>(samep);
|
||||
const AstNodeCCall* const asamep = VN_DBG_AS(samep, NodeCCall);
|
||||
return (funcp() == asamep->funcp() && argTypes() == asamep->argTypes());
|
||||
}
|
||||
bool isGateOptimizable() const override { return false; }
|
||||
|
|
@ -640,7 +640,7 @@ public:
|
|||
string name() const override VL_MT_STABLE { return m_name; } // * = Var name
|
||||
void name(const string& name) override { m_name = name; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstCMethodHard* asamep = static_cast<const AstCMethodHard*>(samep);
|
||||
const AstCMethodHard* const asamep = VN_DBG_AS(samep, CMethodHard);
|
||||
return (m_name == asamep->m_name);
|
||||
}
|
||||
bool isPure() override { return m_pure; }
|
||||
|
|
@ -772,7 +772,7 @@ public:
|
|||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
return (m_classOrPackageNodep
|
||||
== static_cast<const AstClassOrPackageRef*>(samep)->m_classOrPackageNodep);
|
||||
== VN_DBG_AS(samep, ClassOrPackageRef)->m_classOrPackageNodep);
|
||||
}
|
||||
void dump(std::ostream& str = std::cout) const override;
|
||||
string name() const override VL_MT_STABLE { return m_name; } // * = Var name
|
||||
|
|
@ -1043,7 +1043,7 @@ public:
|
|||
string emitC() override { V3ERROR_NA_RETURN(""); }
|
||||
bool cleanOut() const override { return true; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstConst* const sp = static_cast<const AstConst*>(samep);
|
||||
const AstConst* const sp = VN_DBG_AS(samep, Const);
|
||||
return num().isCaseEq(sp->num());
|
||||
}
|
||||
void cloneRelink() override { m_num.nodep(this); }
|
||||
|
|
@ -1139,7 +1139,7 @@ public:
|
|||
const char* broken() const override;
|
||||
void cloneRelink() override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstEnumItemRef* const sp = static_cast<const AstEnumItemRef*>(samep);
|
||||
const AstEnumItemRef* const sp = VN_DBG_AS(samep, EnumItemRef);
|
||||
return itemp() == sp->itemp();
|
||||
}
|
||||
AstEnumItem* itemp() const VL_MT_STABLE { return m_itemp; }
|
||||
|
|
@ -1297,7 +1297,7 @@ public:
|
|||
bool isOutputter() override { return true; } // SPECIAL: makes output
|
||||
bool cleanOut() const override { return false; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return text() == static_cast<const AstFScanF*>(samep)->text();
|
||||
return text() == VN_DBG_AS(samep, FScanF)->text();
|
||||
}
|
||||
string text() const { return m_text; } // * = Text to display
|
||||
void text(const string& text) { m_text = text; }
|
||||
|
|
@ -1426,7 +1426,7 @@ public:
|
|||
bool same(const AstNode* samep) const override {
|
||||
// Only works if exact same children, instead should override comparison
|
||||
// of children list, and instead use map-vs-map key/value compare
|
||||
return m_map == static_cast<const AstInitArray*>(samep)->m_map;
|
||||
return m_map == VN_DBG_AS(samep, InitArray)->m_map;
|
||||
}
|
||||
void addValuep(AstNodeExpr* newp) { addIndexValuep(m_map.size(), newp); }
|
||||
const KeyItemMap& map() const { return m_map; }
|
||||
|
|
@ -1582,7 +1582,7 @@ public:
|
|||
void dump(std::ostream& str) const override;
|
||||
string name() const override VL_MT_STABLE { return m_name; } // * = Var name
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstParseRef* const asamep = static_cast<const AstParseRef*>(samep);
|
||||
const AstParseRef* const asamep = VN_DBG_AS(samep, ParseRef);
|
||||
return (expect() == asamep->expect() && m_name == asamep->m_name);
|
||||
}
|
||||
void name(const string& name) override { m_name = name; }
|
||||
|
|
@ -1777,7 +1777,7 @@ public:
|
|||
string name() const override VL_MT_STABLE { return m_text; }
|
||||
int instrCount() const override { return INSTR_COUNT_PLI; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return text() == static_cast<const AstSFormatF*>(samep)->text();
|
||||
return text() == VN_DBG_AS(samep, SFormatF)->text();
|
||||
}
|
||||
string verilogKwd() const override { return "$sformatf"; }
|
||||
string text() const { return m_text; } // * = Text to display
|
||||
|
|
@ -1819,7 +1819,7 @@ public:
|
|||
bool isOutputter() override { return true; } // SPECIAL: makes output
|
||||
bool cleanOut() const override { return false; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return text() == static_cast<const AstSScanF*>(samep)->text();
|
||||
return text() == VN_DBG_AS(samep, SScanF)->text();
|
||||
}
|
||||
string text() const { return m_text; } // * = Text to display
|
||||
void text(const string& text) { m_text = text; }
|
||||
|
|
@ -1859,8 +1859,8 @@ public:
|
|||
}
|
||||
ASTGEN_MEMBERS_AstScopeName;
|
||||
bool same(const AstNode* samep) const override {
|
||||
return (m_dpiExport == static_cast<const AstScopeName*>(samep)->m_dpiExport
|
||||
&& m_forFormat == static_cast<const AstScopeName*>(samep)->m_forFormat);
|
||||
const AstScopeName* const sp = VN_DBG_AS(samep, ScopeName);
|
||||
return (m_dpiExport == sp->m_dpiExport && m_forFormat == sp->m_forFormat);
|
||||
}
|
||||
string emitVerilog() override { return ""; }
|
||||
string emitC() override { V3ERROR_NA_RETURN(""); }
|
||||
|
|
@ -2003,7 +2003,7 @@ public:
|
|||
return VN_IS(fromp()->dtypep()->skipRefp(), StructDType);
|
||||
}
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstStructSel* const sp = static_cast<const AstStructSel*>(samep);
|
||||
const AstStructSel* const sp = VN_DBG_AS(samep, StructSel);
|
||||
return m_name == sp->m_name;
|
||||
}
|
||||
int instrCount() const override { return widthInstrs(); }
|
||||
|
|
@ -4749,7 +4749,7 @@ public:
|
|||
bool cleanLhs() const override { return true; }
|
||||
bool sizeMattersLhs() const override { return false; } // Special cased in V3Cast
|
||||
bool same(const AstNode* samep) const override {
|
||||
return size() == static_cast<const AstCCast*>(samep)->size();
|
||||
return size() == VN_DBG_AS(samep, CCast)->size();
|
||||
}
|
||||
void dump(std::ostream& str = std::cout) const override;
|
||||
//
|
||||
|
|
@ -5543,7 +5543,7 @@ public:
|
|||
bool cleanOut() const override { return true; }
|
||||
int instrCount() const override { return widthInstrs(); }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstVarXRef* asamep = static_cast<const AstVarXRef*>(samep);
|
||||
const AstVarXRef* asamep = VN_DBG_AS(samep, VarXRef);
|
||||
return (selfPointer() == asamep->selfPointer() && varp() == asamep->varp()
|
||||
&& name() == asamep->name() && dotted() == asamep->dotted());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ public:
|
|||
bool isOutputter() override { return true; }
|
||||
bool isUnlikely() const override { return true; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return isHex() == static_cast<const AstNodeReadWriteMem*>(samep)->isHex();
|
||||
return isHex() == VN_DBG_AS(samep, NodeReadWriteMem)->isHex();
|
||||
}
|
||||
bool isHex() const { return m_isHex; }
|
||||
virtual const char* cFuncPrefixp() const = 0;
|
||||
|
|
@ -503,7 +503,7 @@ public:
|
|||
ASTGEN_MEMBERS_AstNodeText;
|
||||
void dump(std::ostream& str = std::cout) const override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstNodeText* asamep = static_cast<const AstNodeText*>(samep);
|
||||
const AstNodeText* asamep = VN_DBG_AS(samep, NodeText);
|
||||
return text() == asamep->text();
|
||||
}
|
||||
const string& text() const VL_MT_SAFE { return m_text; }
|
||||
|
|
@ -645,7 +645,7 @@ public:
|
|||
bool maybePointedTo() const override { return true; }
|
||||
void dump(std::ostream& str = std::cout) const override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstCFunc* const asamep = static_cast<const AstCFunc*>(samep);
|
||||
const AstCFunc* const asamep = VN_DBG_AS(samep, CFunc);
|
||||
return ((isTrace() == asamep->isTrace()) && (rtnTypeVoid() == asamep->rtnTypeVoid())
|
||||
&& (argTypes() == asamep->argTypes()) && (baseCtors() == asamep->baseCtors())
|
||||
&& isLoose() == asamep->isLoose()
|
||||
|
|
@ -1013,7 +1013,7 @@ public:
|
|||
bool isOutputter() override { return true; } // SPECIAL: $display makes output
|
||||
bool isUnlikely() const override { return true; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return displayType() == static_cast<const AstElabDisplay*>(samep)->displayType();
|
||||
return displayType() == VN_DBG_AS(samep, ElabDisplay)->displayType();
|
||||
}
|
||||
int instrCount() const override { return INSTR_COUNT_PLI; }
|
||||
VDisplayType displayType() const { return m_displayType; }
|
||||
|
|
@ -1347,7 +1347,7 @@ public:
|
|||
VPragmaType pragType() const { return m_pragType; } // *=type of the pragma
|
||||
bool isPredictOptimizable() const override { return false; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return pragType() == static_cast<const AstPragma*>(samep)->pragType();
|
||||
return pragType() == VN_DBG_AS(samep, Pragma)->pragType();
|
||||
}
|
||||
};
|
||||
class AstPropSpec final : public AstNode {
|
||||
|
|
@ -1382,7 +1382,7 @@ public:
|
|||
}
|
||||
ASTGEN_MEMBERS_AstPull;
|
||||
bool same(const AstNode* samep) const override {
|
||||
return direction() == static_cast<const AstPull*>(samep)->direction();
|
||||
return direction() == VN_DBG_AS(samep, Pull)->direction();
|
||||
}
|
||||
uint32_t direction() const { return (uint32_t)m_direction; }
|
||||
};
|
||||
|
|
@ -1462,7 +1462,7 @@ public:
|
|||
ASTGEN_MEMBERS_AstSenItem;
|
||||
void dump(std::ostream& str) const override;
|
||||
bool same(const AstNode* samep) const override {
|
||||
return edgeType() == static_cast<const AstSenItem*>(samep)->edgeType();
|
||||
return edgeType() == VN_DBG_AS(samep, SenItem)->edgeType();
|
||||
}
|
||||
VEdgeType edgeType() const { return m_edgeType; }
|
||||
void edgeType(VEdgeType type) {
|
||||
|
|
@ -2611,7 +2611,7 @@ public:
|
|||
void hier(const string& flag) { m_hier = flag; }
|
||||
void comment(const string& flag) { m_text = flag; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
const AstCoverDecl* const asamep = static_cast<const AstCoverDecl*>(samep);
|
||||
const AstCoverDecl* const asamep = VN_DBG_AS(samep, CoverDecl);
|
||||
return (fileline() == asamep->fileline() && linescov() == asamep->linescov()
|
||||
&& hier() == asamep->hier() && comment() == asamep->comment());
|
||||
}
|
||||
|
|
@ -2640,7 +2640,7 @@ public:
|
|||
void dump(std::ostream& str) const override;
|
||||
int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return declp() == static_cast<const AstCoverInc*>(samep)->declp();
|
||||
return declp() == VN_DBG_AS(samep, CoverInc)->declp();
|
||||
}
|
||||
bool isGateOptimizable() const override { return false; }
|
||||
bool isPredictOptimizable() const override { return false; }
|
||||
|
|
@ -2747,7 +2747,7 @@ public:
|
|||
bool isOutputter() override { return true; } // SPECIAL: $display makes output
|
||||
bool isUnlikely() const override { return true; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return displayType() == static_cast<const AstDisplay*>(samep)->displayType();
|
||||
return displayType() == VN_DBG_AS(samep, Display)->displayType();
|
||||
}
|
||||
int instrCount() const override { return INSTR_COUNT_PLI; }
|
||||
VDisplayType displayType() const { return m_displayType; }
|
||||
|
|
@ -2924,7 +2924,7 @@ public:
|
|||
void dump(std::ostream& str) const override;
|
||||
int instrCount() const override { return INSTR_COUNT_BRANCH; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return labelp() == static_cast<const AstJumpGo*>(samep)->labelp();
|
||||
return labelp() == VN_DBG_AS(samep, JumpGo)->labelp();
|
||||
}
|
||||
bool isGateOptimizable() const override { return false; }
|
||||
bool isBrancher() const override {
|
||||
|
|
@ -2955,7 +2955,7 @@ public:
|
|||
void dump(std::ostream& str) const override;
|
||||
int instrCount() const override { return 0; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return blockp() == static_cast<const AstJumpLabel*>(samep)->blockp();
|
||||
return blockp() == VN_DBG_AS(samep, JumpLabel)->blockp();
|
||||
}
|
||||
AstJumpBlock* blockp() const { return m_blockp; }
|
||||
};
|
||||
|
|
@ -2974,7 +2974,7 @@ public:
|
|||
bool isOutputter() override { return true; } // Though deleted before opt
|
||||
int instrCount() const override { return INSTR_COUNT_PLI; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return m_off == static_cast<const AstMonitorOff*>(samep)->m_off;
|
||||
return m_off == VN_DBG_AS(samep, MonitorOff)->m_off;
|
||||
}
|
||||
bool off() const { return m_off; }
|
||||
};
|
||||
|
|
@ -3253,7 +3253,7 @@ public:
|
|||
int instrCount() const override { return 10 + 2 * INSTR_COUNT_LD; }
|
||||
bool hasDType() const override { return true; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return declp() == static_cast<const AstTraceInc*>(samep)->declp();
|
||||
return declp() == VN_DBG_AS(samep, TraceInc)->declp();
|
||||
}
|
||||
bool isGateOptimizable() const override { return false; }
|
||||
bool isPredictOptimizable() const override { return false; }
|
||||
|
|
@ -3463,7 +3463,7 @@ public:
|
|||
ASTGEN_MEMBERS_AstCase;
|
||||
string verilogKwd() const override { return casez() ? "casez" : casex() ? "casex" : "case"; }
|
||||
bool same(const AstNode* samep) const override {
|
||||
return m_casex == static_cast<const AstCase*>(samep)->m_casex;
|
||||
return m_casex == VN_DBG_AS(samep, Case)->m_casex;
|
||||
}
|
||||
bool casex() const { return m_casex == VCaseType::CT_CASEX; }
|
||||
bool casez() const { return m_casex == VCaseType::CT_CASEZ; }
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ int AstBasicDType::widthTotalBytes() const {
|
|||
}
|
||||
|
||||
bool AstBasicDType::same(const AstNode* samep) const {
|
||||
const AstBasicDType* const sp = static_cast<const AstBasicDType*>(samep);
|
||||
const AstBasicDType* const sp = VN_DBG_AS(samep, BasicDType);
|
||||
if (!(m == sp->m) || numeric() != sp->numeric()) return false;
|
||||
if (!rangep() && !sp->rangep()) return true;
|
||||
return rangep() && rangep()->sameTree(sp->rangep());
|
||||
|
|
@ -1703,7 +1703,7 @@ AstNodeUOrStructDType* AstMemberDType::getChildStructp() const {
|
|||
}
|
||||
|
||||
bool AstMemberSel::same(const AstNode* samep) const {
|
||||
const AstMemberSel* const sp = static_cast<const AstMemberSel*>(samep);
|
||||
const AstMemberSel* const sp = VN_DBG_AS(samep, MemberSel);
|
||||
return sp != nullptr && access() == sp->access() && fromp()->same(sp->fromp())
|
||||
&& name() == sp->name() && varp()->same(sp->varp());
|
||||
}
|
||||
|
|
@ -2061,13 +2061,14 @@ void AstWildcardArrayDType::dumpSmall(std::ostream& str) const {
|
|||
str << "[*]";
|
||||
}
|
||||
bool AstWildcardArrayDType::same(const AstNode* samep) const {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
const AstWildcardArrayDType* const asamep = VN_DBG_AS(samep, WildcardArrayDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
return (subDTypep() == asamep->subDTypep());
|
||||
}
|
||||
bool AstWildcardArrayDType::similarDType(const AstNodeDType* samep) const {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstWildcardArrayDType* const asamep = VN_DBG_AS(samep, WildcardArrayDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
void AstSampleQueueDType::dumpSmall(std::ostream& str) const {
|
||||
|
|
@ -2079,13 +2080,14 @@ void AstUnsizedArrayDType::dumpSmall(std::ostream& str) const {
|
|||
str << "[]";
|
||||
}
|
||||
bool AstUnsizedArrayDType::same(const AstNode* samep) const {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
const AstUnsizedArrayDType* const asamep = VN_DBG_AS(samep, UnsizedArrayDType);
|
||||
if (!asamep->subDTypep()) return false;
|
||||
return (subDTypep() == asamep->subDTypep());
|
||||
}
|
||||
bool AstUnsizedArrayDType::similarDType(const AstNodeDType* samep) const {
|
||||
const AstNodeArrayDType* const asamep = static_cast<const AstNodeArrayDType*>(samep);
|
||||
return type() == samep->type() && asamep->subDTypep()
|
||||
if (type() != samep->type()) return false;
|
||||
const AstUnsizedArrayDType* const asamep = VN_DBG_AS(samep, UnsizedArrayDType);
|
||||
return asamep->subDTypep()
|
||||
&& subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp());
|
||||
}
|
||||
void AstEmptyQueueDType::dumpSmall(std::ostream& str) const {
|
||||
|
|
@ -2112,7 +2114,7 @@ void AstVarScope::dump(std::ostream& str) const {
|
|||
}
|
||||
}
|
||||
bool AstVarScope::same(const AstNode* samep) const {
|
||||
const AstVarScope* const asamep = static_cast<const AstVarScope*>(samep);
|
||||
const AstVarScope* const asamep = VN_DBG_AS(samep, VarScope);
|
||||
return varp()->same(asamep->varp()) && scopep()->same(asamep->scopep());
|
||||
}
|
||||
void AstNodeVarRef::dump(std::ostream& str) const {
|
||||
|
|
@ -2146,9 +2148,7 @@ const char* AstVarRef::broken() const {
|
|||
BROKEN_RTN(!varp());
|
||||
return AstNodeVarRef::broken();
|
||||
}
|
||||
bool AstVarRef::same(const AstNode* samep) const {
|
||||
return same(static_cast<const AstVarRef*>(samep));
|
||||
}
|
||||
bool AstVarRef::same(const AstNode* samep) const { return same(VN_DBG_AS(samep, VarRef)); }
|
||||
int AstVarRef::instrCount() const {
|
||||
// Account for the target of hard-coded method calls as just an address computation
|
||||
if (const AstCMethodHard* const callp = VN_CAST(backp(), CMethodHard)) {
|
||||
|
|
@ -2189,7 +2189,7 @@ void AstVar::dump(std::ostream& str) const {
|
|||
str << " " << varType();
|
||||
}
|
||||
bool AstVar::same(const AstNode* samep) const {
|
||||
const AstVar* const asamep = static_cast<const AstVar*>(samep);
|
||||
const AstVar* const asamep = VN_DBG_AS(samep, Var);
|
||||
return name() == asamep->name() && varType() == asamep->varType();
|
||||
}
|
||||
void AstScope::dump(std::ostream& str) const {
|
||||
|
|
@ -2199,7 +2199,7 @@ void AstScope::dump(std::ostream& str) const {
|
|||
str << " [modp=" << reinterpret_cast<const void*>(modp()) << "]";
|
||||
}
|
||||
bool AstScope::same(const AstNode* samep) const {
|
||||
const AstScope* const asamep = static_cast<const AstScope*>(samep);
|
||||
const AstScope* const asamep = VN_DBG_AS(samep, Scope);
|
||||
return name() == asamep->name()
|
||||
&& ((!aboveScopep() && !asamep->aboveScopep())
|
||||
|| (aboveScopep() && asamep->aboveScopep()
|
||||
|
|
|
|||
Loading…
Reference in New Issue