Internals: Remove extraneous castNode() calls. No functional change.

This commit is contained in:
Wilson Snyder 2016-11-05 10:06:43 -04:00
parent bda4b326ab
commit e52f5f1b63
9 changed files with 116 additions and 117 deletions

View File

@ -205,8 +205,8 @@ private:
// Note: if this ends with an 'else', then we don't need to validate that one of the
// predicates evaluates to true.
AstNode* ohot = ((allow_none || hasDefaultElse)
? (new AstOneHot0(nodep->fileline(), propp))->castNode()
: (new AstOneHot (nodep->fileline(), propp))->castNode());
? static_cast<AstNode*>(new AstOneHot0(nodep->fileline(), propp))
: static_cast<AstNode*>(new AstOneHot (nodep->fileline(), propp)));
AstIf* checkifp = new AstIf (nodep->fileline(),
new AstLogNot (nodep->fileline(), ohot),
newFireAssert(nodep, "'unique if' statement violated"),
@ -254,8 +254,8 @@ private:
}
bool allow_none = has_default || nodep->unique0Pragma();
AstNode* ohot = (allow_none
? (new AstOneHot0(nodep->fileline(), propp))->castNode()
: (new AstOneHot (nodep->fileline(), propp))->castNode());
? static_cast<AstNode*>(new AstOneHot0(nodep->fileline(), propp))
: static_cast<AstNode*>(new AstOneHot (nodep->fileline(), propp)));
AstIf* ifp = new AstIf (nodep->fileline(),
new AstLogNot (nodep->fileline(), ohot),
newFireAssert(nodep, "synthesis parallel_case, but multiple matches found"),

View File

@ -44,8 +44,6 @@ class VFlagChildDType {}; // Used by parser.y to select constructor that sets c
//######################################################################
//######################################################################
class AstType {
public:
#include "V3Ast__gen_types.h" // From ./astgen
@ -1277,7 +1275,6 @@ public:
AstNode* acceptSubtreeReturnEdits(AstNVisitor& v, AstNUser* vup=NULL); // Return edited nodep; see comments in V3Ast.cpp
// CONVERSION
AstNode* castNode() { return this; }
#include "V3Ast__gen_interface.h" // From ./astgen
// Things like:
// AstAlways* castAlways();
@ -1331,7 +1328,7 @@ public:
dtypeFrom(lhsp);
setOp1p(lhsp); }
ASTNODE_BASE_FUNCS(NodeUniop)
AstNode* lhsp() const { return op1p()->castNode(); }
AstNode* lhsp() const { return op1p(); }
void lhsp(AstNode* nodep) { return setOp1p(nodep); }
// METHODS
virtual void numberOperate(V3Number& out, const V3Number& lhs) = 0; // Set out to evaluation of a AstConst'ed lhs
@ -1354,8 +1351,8 @@ public:
ASTNODE_BASE_FUNCS(NodeBiop)
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp)=0; // Clone single node, just get same type back.
// ACCESSORS
AstNode* lhsp() const { return op1p()->castNode(); }
AstNode* rhsp() const { return op2p()->castNode(); }
AstNode* lhsp() const { return op1p(); }
AstNode* rhsp() const { return op2p(); }
void lhsp(AstNode* nodep) { return setOp1p(nodep); }
void rhsp(AstNode* nodep) { return setOp2p(nodep); }
// METHODS
@ -1379,9 +1376,9 @@ public:
: AstNodeMath(fl) {
setOp1p(lhs); setOp2p(rhs); setOp3p(ths); }
ASTNODE_BASE_FUNCS(NodeTriop)
AstNode* lhsp() const { return op1p()->castNode(); }
AstNode* rhsp() const { return op2p()->castNode(); }
AstNode* thsp() const { return op3p()->castNode(); }
AstNode* lhsp() const { return op1p(); }
AstNode* rhsp() const { return op2p(); }
AstNode* thsp() const { return op3p(); }
void lhsp(AstNode* nodep) { return setOp1p(nodep); }
void rhsp(AstNode* nodep) { return setOp2p(nodep); }
void thsp(AstNode* nodep) { return setOp3p(nodep); }
@ -1423,9 +1420,9 @@ public:
ASTNODE_BASE_FUNCS(NodeCond)
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, const V3Number& ths) {
if (lhs.isNeqZero()) out.opAssign(rhs); else out.opAssign(ths); }
AstNode* condp() const { return op1p()->castNode(); } // op1 = Condition
AstNode* expr1p() const { return op2p()->castNode(); } // op2 = If true...
AstNode* expr2p() const { return op3p()->castNode(); } // op3 = If false...
AstNode* condp() const { return op1p(); } // op1 = Condition
AstNode* expr1p() const { return op2p(); } // op2 = If true...
AstNode* expr2p() const { return op3p(); } // op3 = If false...
virtual string emitVerilog() { return "%k(%l %f? %r %k: %t)"; }
virtual string emitC() { return "VL_COND_%nq%lq%rq%tq(%nw,%lw,%rw,%tw, %P, %li, %ri, %ti)"; }
virtual bool cleanOut() { return false; } // clean if e1 & e2 clean
@ -1443,10 +1440,10 @@ public:
: AstNode(fl) {
setOp1p(lhs); setOp2p(rhs); setNOp3p(ths); }
ASTNODE_BASE_FUNCS(NodePreSel)
AstNode* lhsp() const { return op1p()->castNode(); }
AstNode* lhsp() const { return op1p(); }
AstNode* fromp() const { return lhsp(); }
AstNode* rhsp() const { return op2p()->castNode(); }
AstNode* thsp() const { return op3p()->castNode(); }
AstNode* rhsp() const { return op2p(); }
AstNode* thsp() const { return op3p(); }
AstAttrOf* attrp() const { return op4p()->castAttrOf(); }
void lhsp(AstNode* nodep) { return setOp1p(nodep); }
void rhsp(AstNode* nodep) { return setOp2p(nodep); }
@ -1478,8 +1475,8 @@ public:
ASTNODE_BASE_FUNCS(NodeAssign)
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp)=0; // Clone single node, just get same type back.
// So iteration hits the RHS which is "earlier" in execution order, it's op1, not op2
AstNode* rhsp() const { return op1p()->castNode(); } // op1 = Assign from
AstNode* lhsp() const { return op2p()->castNode(); } // op2 = Assign to
AstNode* rhsp() const { return op1p(); } // op1 = Assign from
AstNode* lhsp() const { return op2p(); } // op2 = Assign to
void rhsp(AstNode* np) { setOp1p(np); }
void lhsp(AstNode* np) { setOp2p(np); }
virtual bool hasDType() const { return true; }
@ -1498,10 +1495,10 @@ public:
addNOp1p(initsp); setOp2p(condp); addNOp3p(incsp); addNOp4p(bodysp);
}
ASTNODE_BASE_FUNCS(NodeFor)
AstNode* initsp() const { return op1p()->castNode(); } // op1= initial statements
AstNode* condp() const { return op2p()->castNode(); } // op2= condition to continue
AstNode* incsp() const { return op3p()->castNode(); } // op3= increment statements
AstNode* bodysp() const { return op4p()->castNode(); } // op4= body of loop
AstNode* initsp() const { return op1p(); } // op1= initial statements
AstNode* condp() const { return op2p(); } // op2= condition to continue
AstNode* incsp() const { return op3p(); } // op3= increment statements
AstNode* bodysp() const { return op4p(); } // op4= body of loop
virtual bool isGateOptimizable() const { return false; }
virtual int instrCount() const { return instrCountBranch(); }
virtual V3Hash sameHash() const { return V3Hash(); }
@ -1540,9 +1537,9 @@ public:
}
ASTNODE_BASE_FUNCS(NodeCase)
virtual int instrCount() const { return instrCountBranch(); }
AstNode* exprp() const { return op1p()->castNode(); } // op1 = case condition <expression>
AstNode* exprp() const { return op1p(); } // op1 = case condition <expression>
AstCaseItem* itemsp() const { return op2p()->castCaseItem(); } // op2 = list of case expressions
AstNode* notParallelp() const { return op3p()->castNode(); } // op3 = assertion code for non-full case's
AstNode* notParallelp() const { return op3p(); } // op3 = assertion code for non-full case's
void addItemsp(AstNode* nodep) { addOp2p(nodep); }
void addNotParallelp(AstNode* nodep) { setOp3p(nodep); }
};
@ -1771,9 +1768,9 @@ public:
AstNodeSel(FileLine* fl, AstNode* fromp, AstNode* bitp)
:AstNodeBiop(fl, fromp, bitp) {}
ASTNODE_BASE_FUNCS(NodeSel)
AstNode* fromp() const { return op1p()->castNode(); } // op1 = Extracting what (NULL=TBD during parsing)
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)
void fromp(AstNode* nodep) { setOp1p(nodep); }
AstNode* bitp() const { return op2p()->castNode(); } // op2 = Msb selection expression
AstNode* bitp() const { return op2p(); } // op2 = Msb selection expression
void bitp(AstNode* nodep) { setOp2p(nodep); }
int bitConst() const;
virtual bool hasDType() const { return true; }
@ -1825,11 +1822,11 @@ public:
string cname() const { return m_cname; }
void cname(const string& cname) { m_cname = cname; }
// op1 = Output variable (functions only, NULL for tasks)
AstNode* fvarp() const { return op1p()->castNode(); }
AstNode* fvarp() const { return op1p(); }
void addFvarp(AstNode* nodep) { addNOp1p(nodep); }
bool isFunction() const { return fvarp()!=NULL; }
// op3 = Statements/Ports/Vars
AstNode* stmtsp() const { return op3p()->castNode(); } // op3 = List of statements
AstNode* stmtsp() const { return op3p(); } // op3 = List of statements
void addStmtsp(AstNode* nodep) { addNOp3p(nodep); }
// op4 = scope name
AstScopeName* scopeNamep() const { return op4p()->castScopeName(); }
@ -1892,7 +1889,7 @@ public:
// op1 = namep
AstNode* namep() const { return op1p(); }
// op2 = Pin interconnection list
AstNode* pinsp() const { return op2p()->castNode(); }
AstNode* pinsp() const { return op2p(); }
void addPinsp(AstNode* nodep) { addOp2p(nodep); }
// op3 = scope tracking
AstScopeName* scopeNamep() const { return op3p()->castScopeName(); }
@ -1924,7 +1921,7 @@ public:
virtual void dump(ostream& str);
virtual bool maybePointedTo() const { return true; }
virtual string name() const { return m_name; }
AstNode* stmtsp() const { return op2p()->castNode(); } // op2 = List of statements
AstNode* stmtsp() const { return op2p(); } // op2 = List of statements
AstActive* activesp() const { return op3p()->castActive(); } // op3 = List of i/sblocks
// METHODS
void addInlinesp(AstNode* nodep) { addOp1p(nodep); }

View File

@ -126,8 +126,8 @@ public:
setOp2p(new AstConst(fl,range.hi())); setOp3p(new AstConst(fl,range.lo()));
}
ASTNODE_NODE_FUNCS(Range)
AstNode* msbp() const { return op2p()->castNode(); } // op2 = Msb expression
AstNode* lsbp() const { return op3p()->castNode(); } // op3 = Lsb expression
AstNode* msbp() const { return op2p(); } // op2 = Msb expression
AstNode* lsbp() const { return op3p(); } // op3 = Lsb expression
AstNode* leftp() const { return littleEndian()?lsbp():msbp(); } // How to show a declaration
AstNode* rightp() const { return littleEndian()?msbp():lsbp(); }
int msbConst() const { AstConst* constp=msbp()->castConst(); return (constp?constp->toSInt():0); }
@ -210,7 +210,7 @@ public:
void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); }
AstNodeDType* subDTypep() const { return dtypep() ? dtypep() : childDTypep(); }
void addAttrsp(AstNode* nodep) { addNOp4p(nodep); }
AstNode* attrsp() const { return op4p()->castNode(); } // op4 = Attributes during early parse
AstNode* attrsp() const { return op4p(); } // op4 = Attributes during early parse
// METHODS
virtual string name() const { return m_name; }
virtual bool maybePointedTo() const { return true; }
@ -891,9 +891,9 @@ public:
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode*) const { return true; }
virtual int instrCount() const { return widthInstrs()*(lsbp()->castConst()?3:10); }
AstNode* fromp() const { return op1p()->castNode(); } // op1 = Extracting what (NULL=TBD during parsing)
AstNode* lsbp() const { return op2p()->castNode(); } // op2 = Msb selection expression
AstNode* widthp() const { return op3p()->castNode(); } // op3 = Width
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)
AstNode* lsbp() const { return op2p(); } // op2 = Msb selection expression
AstNode* widthp() const { return op3p(); } // op3 = Width
int widthConst() const { return widthp()->castConst()->toSInt(); }
int lsbConst() const { return lsbp()->castConst()->toSInt(); }
int msbConst() const { return lsbConst()+widthConst()-1; }
@ -930,7 +930,7 @@ public:
virtual bool cleanOut() { return false; }
virtual bool same(AstNode* samep) const { return true; } // dtype comparison does it all for us
virtual int instrCount() const { return widthInstrs(); }
AstNode* fromp() const { return op1p()->castNode(); } // op1 = Extracting what (NULL=TBD during parsing)
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)
void fromp(AstNode* nodep) { setOp1p(nodep); }
};
@ -954,9 +954,9 @@ public:
ASTNODE_NODE_FUNCS(MethodSel)
virtual string name() const { return m_name; } // * = Var name
virtual void name(const string& name) { m_name = name; }
AstNode* fromp() const { return op1p()->castNode(); } // op1 = Extracting what (NULL=TBD during parsing)
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)
void fromp(AstNode* nodep) { setOp1p(nodep); }
AstNode* pinsp() const { return op2p()->castNode(); } // op2 = Pin interconnection list
AstNode* pinsp() const { return op2p(); } // op2 = Pin interconnection list
void addPinsp(AstNode* nodep) { addOp2p(nodep); }
};
@ -1072,10 +1072,10 @@ public:
AstNodeDType* childDTypep() const { return op1p()->castNodeDType(); } // op1 = Range of variable
AstNodeDType* dtypeSkipRefp() const { return subDTypep()->skipRefp(); }
AstBasicDType* basicp() const { return subDTypep()->basicp(); } // (Slow) recurse down to find basic data type (Note don't need virtual - AstVar isn't a NodeDType)
AstNode* valuep() const { return op3p()->castNode(); } // op3 = Initial value that never changes (static const)
AstNode* valuep() const { return op3p(); } // op3 = Initial value that never changes (static const)
void valuep(AstNode* nodep) { setOp3p(nodep); } // It's valuep, not constp, as may be more complicated than an AstConst
void addAttrsp(AstNode* nodep) { addNOp4p(nodep); }
AstNode* attrsp() const { return op4p()->castNode(); } // op4 = Attributes during early parse
AstNode* attrsp() const { return op4p(); } // op4 = Attributes during early parse
void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); }
AstNodeDType* subDTypep() const { return dtypep() ? dtypep() : childDTypep(); }
void attrClockEn(bool flag) { m_attrClockEn = flag; }
@ -1209,7 +1209,7 @@ public:
virtual bool cleanRhs() { return true; }
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode*) const { return true; }
AstNode* rhsp() const { return op1p()->castNode(); } // op1 = Assign from
AstNode* rhsp() const { return op1p(); } // op1 = Assign from
string path() const { return m_path; }
};
@ -1222,7 +1222,7 @@ public:
addNOp1p(exprsp);
}
ASTNODE_NODE_FUNCS(Implicit)
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Assign from
AstNode* exprsp() const { return op1p(); } // op1 = Assign from
};
class AstScope : public AstNode {
@ -1250,11 +1250,11 @@ public:
string nameVlSym() const { return (((string)"vlSymsp->") + nameDotless()); }
AstNodeModule* modp() const { return m_modp; }
void addVarp(AstNode* nodep) { addOp1p(nodep); }
AstNode* varsp() const { return op1p()->castNode(); } // op1 = AstVarScope's
AstNode* varsp() const { return op1p(); } // op1 = AstVarScope's
void addActivep(AstNode* nodep) { addOp2p(nodep); }
AstNode* blocksp() const { return op2p()->castNode(); } // op2 = Block names
AstNode* blocksp() const { return op2p(); } // op2 = Block names
void addFinalClkp(AstNode* nodep) { addOp3p(nodep); }
AstNode* finalClksp() const { return op3p()->castNode(); } // op3 = Final assigns for clock correction
AstNode* finalClksp() const { return op3p(); } // op3 = Final assigns for clock correction
AstScope* aboveScopep() const { return m_aboveScopep; }
AstCell* aboveCellp() const { return m_aboveCellp; }
bool isTop() const { return aboveScopep()==NULL; } // At top of hierarchy
@ -1270,7 +1270,7 @@ public:
:AstNode(fl)
{addNOp2p(ascopep);}
ASTNODE_NODE_FUNCS(TopScope)
AstNode* stmtsp() const { return op1p()->castNode(); }
AstNode* stmtsp() const { return op1p(); }
void addStmtsp(AstNode* nodep) { addOp1p(nodep); }
AstScope* scopep() const { return op2p()->castScope(); } // op1 = AstVarScope's
};
@ -1420,7 +1420,7 @@ public:
bool dotStar() const { return name() == ".*"; } // Special fake name for .* connections until linked
int pinNum() const { return m_pinNum; }
void exprp(AstNode* nodep) { addOp1p(nodep); }
AstNode* exprp() const { return op1p()->castNode(); } // op1 = Expression connected to pin, NULL if unconnected
AstNode* exprp() const { return op1p(); } // op1 = Expression connected to pin, NULL if unconnected
AstVar* modVarp() const { return m_modVarp; } // [After Link] Pointer to variable
void modVarp(AstVar* nodep) { m_modVarp=nodep; }
AstParamTypeDType* modPTypep() const { return m_modPTypep; } // [After Link] Pointer to variable
@ -1446,7 +1446,7 @@ public:
virtual void name(const string& name) { m_name = name; }
virtual V3Hash sameHash() const { return V3Hash(); }
void exprp(AstNode* nodep) { addOp1p(nodep); }
AstNode* exprp() const { return op1p()->castNode(); } // op1 = Expression connected to pin, NULL if unconnected
AstNode* exprp() const { return op1p(); } // op1 = Expression connected to pin, NULL if unconnected
bool emptyConnectNoNext() const { return !exprp() && name()=="" && !nextp(); }
};
@ -1713,7 +1713,7 @@ public:
ASTNODE_NODE_FUNCS(Port)
virtual string name() const { return m_name; } // * = Port name
int pinNum() const { return m_pinNum; } // * = Pin number, for order based instantiation
AstNode* exprp() const { return op1p()->castNode(); } // op1 = Expression connected to port
AstNode* exprp() const { return op1p(); } // op1 = Expression connected to port
};
//######################################################################
@ -1729,7 +1729,7 @@ public:
}
ASTNODE_NODE_FUNCS(Generate)
// op1 = Statements
AstNode* stmtsp() const { return op1p()->castNode(); } // op1 = List of statements
AstNode* stmtsp() const { return op1p(); } // op1 = List of statements
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
};
@ -1922,7 +1922,7 @@ public:
ASTNODE_NODE_FUNCS(SenGate)
virtual string emitVerilog() { return "(%l) %f&& (%r)"; }
AstSenItem* sensesp() const { return op1p()->castSenItem(); }
AstNode* rhsp() const { return op2p()->castNode(); }
AstNode* rhsp() const { return op2p(); }
void sensesp(AstSenItem* nodep) { addOp1p(nodep); }
void rhsp(AstNode* nodep) { setOp2p(nodep); }
//
@ -1969,7 +1969,7 @@ public:
//
virtual void dump(ostream& str);
AstSenTree* sensesp() const { return op1p()->castSenTree(); } // op1 = Sensitivity list
AstNode* bodysp() const { return op2p()->castNode(); } // op2 = Statements to evaluate
AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate
void addStmtp(AstNode* nodep) { addOp2p(nodep); }
VAlwaysKwd keyword() const { return m_keyword; }
// Special accessors
@ -1989,7 +1989,7 @@ public:
virtual bool same(AstNode* samep) const { return true; }
//
AstSenTree* sensesp() const { return op1p()->castSenTree(); } // op1 = Sensitivity list
AstNode* bodysp() const { return op2p()->castNode(); } // op2 = Statements to evaluate
AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate
void addStmtp(AstNode* nodep) { addOp2p(nodep); }
// Special accessors
bool isJustOneBodyStmt() const { return bodysp() && !bodysp()->nextp(); }
@ -2004,7 +2004,7 @@ public:
}
ASTNODE_NODE_FUNCS(AlwaysPost)
//
AstNode* bodysp() const { return op2p()->castNode(); } // op2 = Statements to evaluate
AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate
void addBodysp(AstNode* newp) { addOp2p(newp); }
};
@ -2079,7 +2079,7 @@ public:
virtual bool same(AstNode* samep) const {
return direction()==samep->castPull()->direction(); }
void lhsp(AstNode* np) { setOp1p(np); }
AstNode* lhsp() const { return op1p()->castNode(); } // op1 = Assign to
AstNode* lhsp() const { return op1p(); } // op1 = Assign to
uint32_t direction() const { return (uint32_t) m_direction; }
};
@ -2303,8 +2303,8 @@ public:
}
ASTNODE_NODE_FUNCS(CaseItem)
virtual int instrCount() const { return widthInstrs()+instrCountBranch(); }
AstNode* condsp() const { return op1p()->castNode(); } // op1= list of possible matching expressions
AstNode* bodysp() const { return op2p()->castNode(); } // op2= what to do
AstNode* condsp() const { return op1p(); } // op1= list of possible matching expressions
AstNode* bodysp() const { return op2p(); } // op2= what to do
void condsp(AstNode* nodep) { setOp1p(nodep); }
void addBodysp(AstNode* newp) { addOp2p(newp); }
bool isDefault() const { return condsp()==NULL; }
@ -2330,7 +2330,7 @@ public:
virtual bool same(AstNode* samep) const { return text()==samep->castSFormatF()->text(); }
virtual string verilogKwd() const { return "$sformatf"; }
void exprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output
string text() const { return m_text; } // * = Text to display
void text(const string& text) { m_text=text; }
AstScopeName* scopeNamep() const { return op2p()->castScopeName(); }
@ -2417,7 +2417,7 @@ public:
virtual bool isPure() const { return false; } // Though deleted before opt
virtual bool isOutputter() const { return true; } // Though deleted before opt
virtual int instrCount() const { return instrCountPli(); }
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output
void exprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output
};
@ -2511,7 +2511,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(text()); }
virtual bool same(AstNode* samep) const {
return text()==samep->castFScanF()->text(); }
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output
void exprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output
string text() const { return m_text; } // * = Text to display
void text(const string& text) { m_text=text; }
@ -2544,7 +2544,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(text()); }
virtual bool same(AstNode* samep) const {
return text()==samep->castSScanF()->text(); }
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output
void exprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output
string text() const { return m_text; } // * = Text to display
void text(const string& text) { m_text=text; }
@ -2571,10 +2571,10 @@ public:
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return isHex()==samep->castReadMem()->isHex(); }
bool isHex() const { return m_isHex; }
AstNode* filenamep() const { return op1p()->castNode(); }
AstNode* memp() const { return op2p()->castNode(); }
AstNode* lsbp() const { return op3p()->castNode(); }
AstNode* msbp() const { return op4p()->castNode(); }
AstNode* filenamep() const { return op1p(); }
AstNode* memp() const { return op2p(); }
AstNode* lsbp() const { return op3p(); }
AstNode* msbp() const { return op4p(); }
};
class AstSystemT : public AstNodeStmt {
@ -2639,7 +2639,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(text()); }
virtual bool same(AstNode* samep) const {
return text()==samep->castValuePlusArgs()->text(); }
AstNode* exprsp() const { return op1p()->castNode(); } // op1 = Expressions to output
AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output
void exprsp(AstNode* nodep) { setOp1p(nodep); } // op1 = Expressions to output
string text() const { return m_text; } // * = Text to display
void text(const string& text) { m_text=text; }
@ -2685,9 +2685,9 @@ public:
setOp1p(arrayp); addNOp2p(varsp); addNOp4p(bodysp);
}
ASTNODE_NODE_FUNCS(Foreach)
AstNode* arrayp() const { return op1p()->castNode(); } // op1= array
AstNode* varsp() const { return op2p()->castNode(); } // op2= variable index list
AstNode* bodysp() const { return op4p()->castNode(); } // op4= body of loop
AstNode* arrayp() const { return op1p(); } // op1= array
AstNode* varsp() const { return op2p(); } // op2= variable index list
AstNode* bodysp() const { return op4p(); } // op4= body of loop
virtual bool isGateOptimizable() const { return false; }
virtual int instrCount() const { return instrCountBranch(); }
virtual V3Hash sameHash() const { return V3Hash(); }
@ -2701,8 +2701,8 @@ public:
setOp2p(countp); addNOp3p(bodysp);
}
ASTNODE_NODE_FUNCS(Repeat)
AstNode* countp() const { return op2p()->castNode(); } // op2= condition to continue
AstNode* bodysp() const { return op3p()->castNode(); } // op3= body of loop
AstNode* countp() const { return op2p(); } // op2= condition to continue
AstNode* bodysp() const { return op3p(); } // op3= body of loop
virtual bool isGateOptimizable() const { return false; } // Not releavant - converted to FOR
virtual int instrCount() const { return instrCountBranch(); }
virtual V3Hash sameHash() const { return V3Hash(); }
@ -2716,10 +2716,10 @@ public:
setOp2p(condp); addNOp3p(bodysp); addNOp4p(incsp);
}
ASTNODE_NODE_FUNCS(While)
AstNode* precondsp() const { return op1p()->castNode(); } // op1= prepare statements for condition (exec every loop)
AstNode* condp() const { return op2p()->castNode(); } // op2= condition to continue
AstNode* bodysp() const { return op3p()->castNode(); } // op3= body of loop
AstNode* incsp() const { return op4p()->castNode(); } // op4= increment (if from a FOR loop)
AstNode* precondsp() const { return op1p(); } // op1= prepare statements for condition (exec every loop)
AstNode* condp() const { return op2p(); } // op2= condition to continue
AstNode* bodysp() const { return op3p(); } // op3= body of loop
AstNode* incsp() const { return op4p(); } // op4= increment (if from a FOR loop)
void addPrecondsp(AstNode* newp) { addOp1p(newp); }
void addBodysp(AstNode* newp) { addOp3p(newp); }
void addIncsp(AstNode* newp) { addOp4p(newp); }
@ -2821,7 +2821,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return true; }
// op1 = Statements
AstNode* stmtsp() const { return op1p()->castNode(); } // op1 = List of statements
AstNode* stmtsp() const { return op1p(); } // op1 = List of statements
void addStmtsp(AstNode* nodep) { addNOp1p(nodep); }
int labelNum() const { return m_labelNum; }
void labelNum(int flag) { m_labelNum=flag; }
@ -2861,7 +2861,7 @@ public:
}
ASTNODE_NODE_FUNCS(UntilStable)
AstVarRef* stablesp() const { return op2p()->castVarRef(); } // op2= list of variables that must become stable
AstNode* bodysp() const { return op3p()->castNode(); } // op3= body of loop
AstNode* bodysp() const { return op3p(); } // op3= body of loop
void addStablesp(AstVarRef* newp) { addOp2p(newp); }
void addBodysp(AstNode* newp) { addOp3p(newp); }
virtual bool isGateOptimizable() const { return false; } // Not relevant
@ -2936,7 +2936,7 @@ public:
virtual string name() const { return m_name; } // * = Block name
virtual void name(const string& name) { m_name = name; }
// op1 = Statements
AstNode* stmtsp() const { return op1p()->castNode(); } // op1 = List of statements
AstNode* stmtsp() const { return op1p(); } // op1 = List of statements
void addStmtsp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* genforp() const { return op2p(); } // op2 = GENFOR, if applicable,
// might NOT be a GenFor, as loop unrolling replaces with Begin
@ -2953,7 +2953,7 @@ public:
addNOp1p(bodysp);
}
ASTNODE_NODE_FUNCS(Initial)
AstNode* bodysp() const { return op1p()->castNode(); } // op1 = Expressions to evaluate
AstNode* bodysp() const { return op1p(); } // op1 = Expressions to evaluate
// Special accessors
bool isJustOneBodyStmt() const { return bodysp() && !bodysp()->nextp(); }
};
@ -2965,7 +2965,7 @@ public:
addNOp1p(bodysp);
}
ASTNODE_NODE_FUNCS(Final)
AstNode* bodysp() const { return op1p()->castNode(); } // op1 = Expressions to evaluate
AstNode* bodysp() const { return op1p(); } // op1 = Expressions to evaluate
};
class AstInside : public AstNodeMath {
@ -2976,8 +2976,8 @@ public:
dtypeSetLogicBool();
}
ASTNODE_NODE_FUNCS(Inside)
AstNode* exprp() const { return op1p()->castNode(); } // op1 = LHS expression to compare with
AstNode* itemsp() const { return op2p()->castNode(); } // op2 = RHS, possibly a list of expr or AstInsideRange
AstNode* exprp() const { return op1p(); } // op1 = LHS expression to compare with
AstNode* itemsp() const { return op2p(); } // op2 = RHS, possibly a list of expr or AstInsideRange
virtual string emitVerilog() { return "%l inside { %r }"; }
virtual string emitC() { V3ERROR_NA; return ""; }
virtual bool cleanOut() { return false; } // NA
@ -2990,8 +2990,8 @@ public:
addOp1p(lhsp); addOp2p(rhsp);
}
ASTNODE_NODE_FUNCS(InsideRange)
AstNode* lhsp() const { return op1p()->castNode(); } // op1 = LHS
AstNode* rhsp() const { return op2p()->castNode(); } // op2 = RHS
AstNode* lhsp() const { return op1p(); } // op1 = LHS
AstNode* rhsp() const { return op2p(); } // op2 = RHS
virtual string emitVerilog() { return "[%l:%r]"; }
virtual string emitC() { V3ERROR_NA; return ""; }
virtual bool cleanOut() { return false; } // NA
@ -3012,9 +3012,9 @@ public:
addNOp1p(defaultp);
}
ASTNODE_NODE_FUNCS(InitArray)
AstNode* defaultp() const { return op1p()->castNode(); } // op1 = Default if sparse
AstNode* defaultp() const { return op1p(); } // op1 = Default if sparse
void defaultp(AstNode* newp) { setOp1p(newp); }
AstNode* initsp() const { return op2p()->castNode(); } // op2 = Initial value expressions
AstNode* initsp() const { return op2p(); } // op2 = Initial value expressions
void addValuep(AstNode* newp) { addIndexValuep(m_indices.size(), newp); }
void addIndexValuep(uint32_t index, AstNode* newp) {
// Must insert in sorted order
@ -3147,11 +3147,11 @@ public:
virtual bool isOutputter() const { return true; }
// but isPure() true
// op1 = Statements before the value
AstNode* precondsp() const { return op1p()->castNode(); } // op1= prepare statements for condition (exec every loop)
AstNode* precondsp() const { return op1p(); } // op1= prepare statements for condition (exec every loop)
void addPrecondsp(AstNode* newp) { addOp1p(newp); }
// op2 = Value to trace
AstTraceDecl* declp() const { return m_declp; } // Where defined
AstNode* valuep() const { return op2p()->castNode(); }
AstNode* valuep() const { return op2p(); }
};
class AstActive : public AstNode {
@ -3185,7 +3185,7 @@ public:
void sensesStorep(AstSenTree* nodep) { addOp1p(nodep); }
AstSenTree* sensesStorep() const { return op1p()->castSenTree(); }
// op2 = Combo logic
AstNode* stmtsp() const { return op2p()->castNode(); }
AstNode* stmtsp() const { return op2p(); }
void addStmtsp(AstNode* nodep) { addOp2p(nodep); }
// METHODS
bool hasInitial() const { return m_sensesp->hasInitial(); }
@ -3326,7 +3326,7 @@ public:
virtual bool cleanOut() { return false; }
virtual string emitVerilog() { V3ERROR_NA; return ""; } // Implemented specially
virtual string emitC() { V3ERROR_NA; return ""; }
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
AstNode* bodysp() const { return op1p(); } // op1= expressions to print
virtual bool isPure() const { return false; } // SPECIAL: User may order w/other sigs
virtual bool isOutputter() const { return true; }
virtual bool isGateOptimizable() const { return false; }
@ -5008,7 +5008,7 @@ public:
addNOp1p(exprsp);
}
ASTNODE_NODE_FUNCS(UCStmt)
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
AstNode* bodysp() const { return op1p(); } // op1= expressions to print
virtual bool isGateOptimizable() const { return false; }
virtual bool isPredictOptimizable() const { return false; }
virtual bool isPure() const { return false; }
@ -5151,13 +5151,13 @@ public:
void dpiImport(bool flag) { m_dpiImport = flag; }
//
// If adding node accessors, see below emptyBody
AstNode* argsp() const { return op1p()->castNode(); }
AstNode* argsp() const { return op1p(); }
void addArgsp(AstNode* nodep) { addOp1p(nodep); }
AstNode* initsp() const { return op2p()->castNode(); }
AstNode* initsp() const { return op2p(); }
void addInitsp(AstNode* nodep) { addOp2p(nodep); }
AstNode* stmtsp() const { return op3p()->castNode(); }
AstNode* stmtsp() const { return op3p(); }
void addStmtsp(AstNode* nodep) { addOp3p(nodep); }
AstNode* finalsp() const { return op4p()->castNode(); }
AstNode* finalsp() const { return op4p(); }
void addFinalsp(AstNode* nodep) { addOp4p(nodep); }
// Special methods
bool emptyBody() const { return argsp()==NULL && initsp()==NULL && stmtsp()==NULL && finalsp()==NULL; }
@ -5196,7 +5196,7 @@ public:
virtual bool same(AstNode* samep) const {
return (funcp()==samep->castCCall()->funcp()
&& argTypes()==samep->castCCall()->argTypes()); }
AstNode* exprsp() const { return op1p()->castNode(); } // op1= expressions to print
AstNode* exprsp() const { return op1p(); } // op1= expressions to print
virtual bool isGateOptimizable() const { return false; }
virtual bool isPredictOptimizable() const { return false; }
virtual bool isPure() const { return funcp()->pure(); }
@ -5207,7 +5207,7 @@ public:
void argTypes(const string& str) { m_argTypes = str; }
string argTypes() const { return m_argTypes; }
//
AstNode* argsp() const { return op1p()->castNode(); }
AstNode* argsp() const { return op1p(); }
void addArgsp(AstNode* nodep) { addOp1p(nodep); }
};
@ -5252,7 +5252,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
AstNode* bodysp() const { return op1p(); } // op1= expressions to print
};
@ -5288,7 +5288,7 @@ public:
virtual V3Hash sameHash() const { return V3Hash(); }
virtual bool same(AstNode* samep) const { return true; }
void addBodysp(AstNode* nodep) { addNOp1p(nodep); }
AstNode* bodysp() const { return op1p()->castNode(); } // op1= expressions to print
AstNode* bodysp() const { return op1p(); } // op1= expressions to print
};
//######################################################################

View File

@ -808,8 +808,8 @@ private:
// like a AstExtend{$rhsp}, but we need to set the width correctly from base node
arg0p->unlinkFrBack();
AstNode* newp = (nodep->castExtendS()
? (new AstExtendS(nodep->fileline(), arg0p))->castNode()
: (new AstExtend (nodep->fileline(), arg0p))->castNode());
? static_cast<AstNode*>(new AstExtendS(nodep->fileline(), arg0p))
: static_cast<AstNode*>(new AstExtend (nodep->fileline(), arg0p)));
newp->dtypeFrom(nodep);
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
}

View File

@ -390,8 +390,8 @@ private:
static AstNode* extendOrSel(FileLine* fl, AstNode* rhsp, AstNode* cmpWidthp) {
if (cmpWidthp->width() > rhsp->width()) {
rhsp = (rhsp->isSigned()
? (new AstExtendS(fl, rhsp))->castNode()
: (new AstExtend (fl, rhsp))->castNode());
? static_cast<AstNode*>(new AstExtendS(fl, rhsp))
: static_cast<AstNode*>(new AstExtend (fl, rhsp)));
rhsp->dtypeFrom(cmpWidthp); // Need proper widthMin, which may differ from AstSel created above
} else if (cmpWidthp->width() < rhsp->width()) {
rhsp = new AstSel (fl, rhsp, 0, cmpWidthp->width());

View File

@ -320,7 +320,7 @@ private:
}
}
}
virtual void visit(AstConcat* nodep, AstNUser* wp) {
virtual void visit(AstConcat* nodep, AstNUser*) {
if (m_inAss) {
nodep->lhsp()->iterateAndNext(*this);
int lw = m_childClkWidth;
@ -329,7 +329,7 @@ private:
m_childClkWidth = lw + rw; // Pass up
}
}
virtual void visit(AstNodeSel* nodep, AstNUser* wp) {
virtual void visit(AstNodeSel* nodep, AstNUser*) {
if (m_inAss) {
nodep->iterateChildren(*this);
// Pass up result width

View File

@ -715,7 +715,7 @@ private:
if (!m_params) { badNodeType(nodep); return; }
}
virtual void visit(AstSFormatF *nodep, AstNUser *) {
virtual void visit(AstSFormatF *nodep, AstNUser*) {
if (jumpingOver(nodep)) return;
nodep->iterateChildren(*this);
if (m_params) {
@ -759,7 +759,7 @@ private:
}
}
virtual void visit(AstDisplay *nodep, AstNUser *) {
virtual void visit(AstDisplay *nodep, AstNUser*) {
if (jumpingOver(nodep)) return;
nodep->iterateChildren(*this);
if (m_params) {

View File

@ -133,10 +133,12 @@ private:
prep->replaceWith(new AstVarRef(fl, varp, true));
AstNode* newp = new AstIf(fl, condp,
(needDly
? ((new AstAssignDly(fl, prep,
new AstVarRef(fl, varp, false)))->castNode())
: ((new AstAssign (fl, prep,
new AstVarRef(fl, varp, false)))->castNode())),
? static_cast<AstNode*>
(new AstAssignDly(fl, prep,
new AstVarRef(fl, varp, false)))
: static_cast<AstNode*>
(new AstAssign (fl, prep,
new AstVarRef(fl, varp, false)))),
NULL);
if (debug()>=9) newp->dumpTree(cout," _new: ");
abovep->addNextStmt(newp,abovep);

View File

@ -2809,8 +2809,8 @@ private:
default: nodep->v3fatalSrc("bad case");
}
AstNode* newp = (doSigned
? (new AstExtendS(nodep->fileline(), nodep))->castNode()
: (new AstExtend (nodep->fileline(), nodep))->castNode());
? static_cast<AstNode*>(new AstExtendS(nodep->fileline(), nodep))
: static_cast<AstNode*>(new AstExtend (nodep->fileline(), nodep)));
linker.relink(newp);
nodep=newp;
}