Internals: Rename MethodCall. No functional change.

This commit is contained in:
Wilson Snyder 2020-01-18 14:11:05 -05:00
parent 835f668aaa
commit 18e837336a
5 changed files with 29 additions and 29 deletions

View File

@ -1366,7 +1366,7 @@ public:
void addPinsp(AstNode* nodep) { addOp2p(nodep); }
};
class AstCMethodCall : public AstNodeStmt {
class AstCMethodHard : public AstNodeStmt {
// A reference to a "C" hardocded member task (or function)
// PARENTS: stmt/math
// Not all calls are statments vs math. AstNodeStmt needs isStatement() to deal.
@ -1374,7 +1374,7 @@ private:
string m_name; // Name of method
bool m_pure; // Pure optimizable
public:
AstCMethodCall(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name,
AstCMethodHard(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name,
AstNode* pinsp)
: AstNodeStmt(fl, false)
, m_name(name)
@ -1383,19 +1383,19 @@ public:
dtypep(NULL); // V3Width will resolve
addNOp2p(pinsp);
}
AstCMethodCall(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp)
AstCMethodHard(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp)
: AstNodeStmt(fl, false)
, m_name(name) {
setOp1p(fromp);
addNOp2p(pinsp);
}
ASTNODE_NODE_FUNCS(CMethodCall)
ASTNODE_NODE_FUNCS(CMethodHard)
virtual string name() const { return m_name; } // * = Var name
virtual bool hasDType() const { return true; }
virtual void name(const string& name) { m_name = name; }
virtual V3Hash sameHash() const { return V3Hash(m_name); }
virtual bool same(const AstNode* samep) const {
const AstCMethodCall* asamep = static_cast<const AstCMethodCall*>(samep);
const AstCMethodHard* asamep = static_cast<const AstCMethodHard*>(samep);
return (m_name == asamep->m_name); }
virtual bool isPure() const { return m_pure; }
void pure(bool flag) { m_pure = flag; }

View File

@ -282,7 +282,7 @@ private:
insureCleanAndNext(nodep->argsp());
setClean(nodep, true);
}
virtual void visit(AstCMethodCall* nodep) {
virtual void visit(AstCMethodHard* nodep) {
iterateChildren(nodep);
insureCleanAndNext(nodep->pinsp());
setClean(nodep, true);

View File

@ -192,7 +192,7 @@ public:
} else if (nodep->isWide()
&& VN_IS(nodep->lhsp(), VarRef)
&& !VN_IS(nodep->rhsp(), CMath)
&& !VN_IS(nodep->rhsp(), CMethodCall)
&& !VN_IS(nodep->rhsp(), CMethodHard)
&& !VN_IS(nodep->rhsp(), VarRef)
&& !VN_IS(nodep->rhsp(), AssocSel)
&& !VN_IS(nodep->rhsp(), ArraySel)) {
@ -257,7 +257,7 @@ public:
puts(");\n");
}
}
virtual void visit(AstCMethodCall* nodep) {
virtual void visit(AstCMethodHard* nodep) {
iterate(nodep->fromp());
puts(".");
puts(nodep->nameProtect());

View File

@ -1081,7 +1081,7 @@ private:
if (VN_IS(nodep->fromp()->dtypep(), QueueDType)) {
switch (nodep->attrType()) {
case AstAttrType::DIM_SIZE: {
AstNode* newp = new AstCMethodCall(
AstNode* newp = new AstCMethodHard(
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", NULL);
newp->dtypeSetSigned32();
newp->didWidth(true);
@ -1097,7 +1097,7 @@ private:
}
case AstAttrType::DIM_RIGHT:
case AstAttrType::DIM_HIGH: {
AstNode* sizep = new AstCMethodCall(
AstNode* sizep = new AstCMethodHard(
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", NULL);
sizep->dtypeSetSigned32();
sizep->didWidth(true);
@ -1788,7 +1788,7 @@ private:
return false;
}
virtual void visit(AstCMethodCall* nodep) {
virtual void visit(AstCMethodHard* nodep) {
// Never created before V3Width, so no need to redo it
UASSERT_OBJ(nodep->dtypep(), nodep, "CMETHODCALLs should have already been sized");
}
@ -1936,11 +1936,11 @@ private:
}
}
void methodCallAssoc(AstMethodCall* nodep, AstAssocArrayDType* adtypep) {
AstCMethodCall* newp = NULL;
AstCMethodHard* newp = NULL;
if (nodep->name() == "num" // function int num()
|| nodep->name() == "size") {
methodOkArguments(nodep, 0, 0);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"size", NULL); // So don't need num()
newp->dtypeSetSigned32();
@ -1952,7 +1952,7 @@ private:
|| nodep->name() == "prev") {
methodOkArguments(nodep, 1, 1);
AstNode* index_exprp = methodCallAssocIndexExpr(nodep, adtypep);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
nodep->name(), // first/last/next/prev
index_exprp->unlinkFrBack());
@ -1963,7 +1963,7 @@ private:
// IEEE really should have made this a "bit" return
methodOkArguments(nodep, 1, 1);
AstNode* index_exprp = methodCallAssocIndexExpr(nodep, adtypep);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"exists", index_exprp->unlinkFrBack());
newp->dtypeSetSigned32();
@ -1974,14 +1974,14 @@ private:
methodOkArguments(nodep, 0, 1);
methodCallLValue(nodep, nodep->fromp(), true);
if (!nodep->pinsp()) {
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"clear", NULL);
newp->protect(false);
newp->makeStatement();
} else {
AstNode* index_exprp = methodCallAssocIndexExpr(nodep, adtypep);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"erase",
index_exprp->unlinkFrBack());
@ -2013,11 +2013,11 @@ private:
}
}
void methodCallQueue(AstMethodCall* nodep, AstQueueDType* adtypep) {
AstCMethodCall* newp = NULL;
AstCMethodHard* newp = NULL;
if (nodep->name() == "at") { // Created internally for []
methodOkArguments(nodep, 1, 1);
methodCallLValue(nodep, nodep->fromp(), true);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"at", NULL);
newp->dtypeFrom(adtypep->subDTypep());
@ -2026,7 +2026,7 @@ private:
} else if (nodep->name() == "num" // function int num()
|| nodep->name() == "size") {
methodOkArguments(nodep, 0, 0);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"size", NULL);
newp->dtypeSetSigned32();
@ -2036,7 +2036,7 @@ private:
methodOkArguments(nodep, 0, 1);
methodCallLValue(nodep, nodep->fromp(), true);
if (!nodep->pinsp()) {
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"clear", NULL);
newp->protect(false);
@ -2044,7 +2044,7 @@ private:
} else {
AstNode* index_exprp = methodCallQueueIndexExpr(nodep);
if (index_exprp->isZero()) { // delete(0) is a pop_front
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"pop_front", NULL);
newp->dtypeFrom(adtypep->subDTypep());
@ -2053,7 +2053,7 @@ private:
newp->makeStatement();
} else {
nodep->v3error("Unsupported: Queue .delete(index) method, as is O(n) complexity and slow.");
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"erase", index_exprp->unlinkFrBack());
newp->protect(false);
@ -2067,14 +2067,14 @@ private:
AstArg* argp = VN_CAST(nodep->pinsp()->nextp(), Arg);
iterateCheckTyped(nodep, "insert value", argp->exprp(), adtypep->subDTypep(), BOTH);
if (index_exprp->isZero()) { // insert(0, ...) is a push_front
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
"push_front", argp->exprp()->unlinkFrBack());
newp->protect(false);
newp->makeStatement();
} else {
nodep->v3error("Unsupported: Queue .insert method, as is O(n) complexity and slow.");
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
nodep->name(),
index_exprp->unlinkFrBack());
@ -2086,7 +2086,7 @@ private:
|| nodep->name() == "pop_back") {
methodOkArguments(nodep, 0, 0);
methodCallLValue(nodep, nodep->fromp(), true);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
nodep->name(), NULL);
newp->dtypeFrom(adtypep->subDTypep());
@ -2101,7 +2101,7 @@ private:
methodCallLValue(nodep, nodep->fromp(), true);
AstArg* argp = VN_CAST(nodep->pinsp(), Arg);
iterateCheckTyped(nodep, "push value", argp->exprp(), adtypep->subDTypep(), BOTH);
newp = new AstCMethodCall(nodep->fileline(),
newp = new AstCMethodHard(nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
nodep->name(), argp->exprp()->unlinkFrBack());
newp->protect(false);
@ -2737,7 +2737,7 @@ private:
newFormat += "%@";
AstNRelinker handle;
argp->unlinkFrBack(&handle);
AstCMethodCall* newp = new AstCMethodCall(
AstCMethodHard* newp = new AstCMethodHard(
nodep->fileline(), argp, "to_string", NULL);
newp->dtypeSetString();
newp->pure(true);

View File

@ -262,7 +262,7 @@ private:
else if (AstQueueDType* adtypep = VN_CAST(ddtypep, QueueDType)) {
// SELBIT(array, index) -> CMETHODCALL(queue, "at", index)
AstNode* subp = rhsp;
AstCMethodCall* newp = new AstCMethodCall(nodep->fileline(),
AstCMethodHard* newp = new AstCMethodHard(nodep->fileline(),
fromp, "at", subp);
newp->dtypeFrom(adtypep->subDTypep()); // Need to strip off queue reference
if (debug()>=9) newp->dumpTree(cout, "--SELBTq: ");