diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 64c25e494..cef18db50 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -2553,9 +2553,6 @@ public: AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable AstScope* scopep() const { return m_scopep; } // Pointer to scope it's under void scopep(AstScope* nodep) { m_scopep = nodep; } - // op1 = Calculation of value of variable, nullptr=complicated - AstNode* valuep() const { return op1p(); } - void valuep(AstNode* valuep) { addOp1p(valuep); } bool isCircular() const { return m_circular; } void circular(bool flag) { m_circular = flag; } bool isTrace() const { return m_trace; } diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 726bbbfa8..a4c72d5d4 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -408,7 +408,6 @@ private: void consumedMark(); void consumedMarkRecurse(GateEitherVertex* vertexp); void consumedMove(); - void replaceAssigns(); void dedupe(); void mergeAssigns(); void decomposeClkVectors(); @@ -445,7 +444,6 @@ private: m_graph.dumpDotFilePrefixed("gate_opt"); // Rewrite assignments consumedMove(); - replaceAssigns(); } virtual void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); @@ -654,14 +652,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) { while (V3GraphEdge* const edgep = vvertexp->inBeginp()) { VL_DO_DANGLING(edgep->unlinkDelete(), edgep); } - // Clone tree so we remember it for tracing, and keep the pointer - // to the "ALWAYS" part of the tree as part of this statement - // That way if a later signal optimization that - // retained a pointer to the always can - // optimize it further - VL_DO_DANGLING(vvertexp->varScp()->valuep(logicp->unlinkFrBack()), logicp); - // Mark the vertex so we don't mark it as being - // unconsumed in the next step + // Mark the vertex so we don't mark it as being unconsumed in the next step vvertexp->user(true); logicVertexp->user(true); } @@ -693,45 +684,6 @@ bool GateVisitor::elimLogicOkOutputs(GateLogicVertex* consumeVertexp, return true; } -void GateVisitor::replaceAssigns() { - for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp = itp->verticesNextp()) { - if (const GateVarVertex* const vvertexp = dynamic_cast(itp)) { - // Take the Comments/assigns that were moved to the VarScope and change them to a - // simple value assignment - const AstVarScope* const vscp = vvertexp->varScp(); - if (vscp->valuep() && !VN_IS(vscp->valuep(), NodeMath)) { - // if (debug() > 9) vscp->dumpTree(cout, "-vscPre: "); - while (AstNode* delp = VN_CAST(vscp->valuep(), Comment)) { - VL_DO_DANGLING(delp->unlinkFrBack()->deleteTree(), delp); - } - if (AstInitial* const delp = VN_CAST(vscp->valuep(), Initial)) { - AstNode* const bodyp = delp->bodysp(); - bodyp->unlinkFrBackWithNext(); - delp->replaceWith(bodyp); - VL_DO_DANGLING(delp->deleteTree(), delp); - } - if (AstAlways* const delp = VN_CAST(vscp->valuep(), Always)) { - AstNode* const bodyp = delp->bodysp(); - bodyp->unlinkFrBackWithNext(); - delp->replaceWith(bodyp); - VL_DO_DANGLING(delp->deleteTree(), delp); - } - if (AstNodeAssign* const delp = VN_CAST(vscp->valuep(), NodeAssign)) { - AstNode* const rhsp = delp->rhsp(); - rhsp->unlinkFrBack(); - delp->replaceWith(rhsp); - VL_DO_DANGLING(delp->deleteTree(), delp); - } - // if (debug() > 9) {vscp->dumpTree(cout, "-vscDone: "); cout<valuep(), NodeMath) || vscp->valuep()->nextp()) { - vscp->dumpTree(std::cerr, "vscStrange: "); - vscp->v3fatalSrc("Value of varscope not mathematical"); - } - } - } - } -} - //---------------------------------------------------------------------- void GateVisitor::consumedMark() { @@ -1132,11 +1084,6 @@ private: while (V3GraphEdge* const inedgep = vvertexp->inBeginp()) { VL_DO_DANGLING(inedgep->unlinkDelete(), inedgep); } - // replaceAssigns() does the deleteTree on lvertexNodep in a later step - AstNode* lvertexNodep = lvertexp->nodep(); - lvertexNodep->unlinkFrBack(); - vvertexp->varScp()->valuep(lvertexNodep); - lvertexNodep = nullptr; vvertexp->user(true); lvertexp->user(true); } @@ -1527,16 +1474,5 @@ void GateVisitor::decomposeClkVectors() { void V3Gate::gateAll(AstNetlist* nodep) { UINFO(2, __FUNCTION__ << ": " << endl); { const GateVisitor visitor{nodep}; } // Destruct before checking - - nodep->foreach([](AstVarScope* nodep) { - if (AstNodeAssign* const assp = VN_CAST(nodep->valuep(), NodeAssign)) { - UINFO(5, " Removeassign " << assp << endl); - AstNode* const valuep = assp->rhsp(); - valuep->unlinkFrBack(); - assp->replaceWith(valuep); - VL_DO_DANGLING(assp->deleteTree(), assp); - } - }); - V3Global::dumpCheckGlobalTree("gate", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3); } diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 6fc9a8726..4a596e434 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -280,11 +280,7 @@ private: addIgnore(ignoreReasonp); } else { ++m_statSigs; - if (AstNode* const valuep = m_traVscp->valuep()) { - m_traValuep = valuep->cloneTree(false); - } else { - m_traValuep = new AstVarRef{m_traVscp->fileline(), m_traVscp, VAccess::READ}; - } + m_traValuep = new AstVarRef{m_traVscp->fileline(), m_traVscp, VAccess::READ}; // Recurse into data type of the signal. The visit methods will add AstTraceDecls. iterate(m_traVscp->varp()->dtypep()->skipRefToEnump()); // Cleanup