From a67ba04c37f08ae20cb368e79fb82e44a8e0fe2f Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Mon, 1 Jun 2020 17:49:42 +0100 Subject: [PATCH] Remove dead code and some unused parameters Found with CLion inspections --- src/V3Active.cpp | 1 - src/V3ActiveTop.cpp | 2 +- src/V3CCtors.cpp | 1 - src/V3CUse.cpp | 2 +- src/V3CUse.h | 2 +- src/V3Clock.cpp | 3 --- src/V3Combine.cpp | 1 - src/V3Coverage.cpp | 2 -- src/V3Dead.cpp | 2 -- src/V3EmitV.cpp | 21 ------------------- src/V3EmitV.h | 1 - src/V3EmitXml.cpp | 3 --- src/V3Expand.cpp | 11 ---------- src/V3FileLine.h | 2 -- src/V3Inst.cpp | 2 -- src/V3LinkLevel.cpp | 2 -- src/V3LinkParse.cpp | 4 ---- src/V3Order.cpp | 15 ++------------ src/V3OrderGraph.h | 49 ++++----------------------------------------- src/V3SenTree.h | 2 +- src/V3Stats.cpp | 1 - src/V3SymTable.h | 1 - src/Verilator.cpp | 2 +- src/VlcOptions.h | 2 -- src/VlcTop.h | 1 - 25 files changed, 11 insertions(+), 124 deletions(-) diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 13689cb9f..eb24b00d7 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -50,7 +50,6 @@ protected: class ActiveNamer : public ActiveBaseVisitor { private: - typedef std::map ActiveNameMap; // STATE AstScope* m_scopep; // Current scope to add statement to AstActive* m_iActivep; // For current scope, the IActive we're building diff --git a/src/V3ActiveTop.cpp b/src/V3ActiveTop.cpp index 4a5f8ffe7..933ba26fa 100644 --- a/src/V3ActiveTop.cpp +++ b/src/V3ActiveTop.cpp @@ -89,7 +89,7 @@ private: } // Move the SENTREE for each active up to the global level. // This way we'll easily see what clock domains are identical - AstSenTree* wantp = m_finder.getSenTree(nodep->fileline(), sensesp); + AstSenTree* wantp = m_finder.getSenTree(sensesp); UINFO(4, " lookdone\n"); if (wantp != sensesp) { // Move the active's contents to the other active diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index 483894a52..a08f0dd5b 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -46,7 +46,6 @@ private: int m_funcNum; // Function number being built public: - AstCFunc* builtFuncp() const { return m_tlFuncp; } void add(AstNode* nodep) { if (v3Global.opt.outputSplitCFuncs() && v3Global.opt.outputSplitCFuncs() < m_numStmts) { m_funcp = NULL; diff --git a/src/V3CUse.cpp b/src/V3CUse.cpp index fe1f6f073..82a20e7a5 100644 --- a/src/V3CUse.cpp +++ b/src/V3CUse.cpp @@ -218,7 +218,7 @@ public: //###################################################################### // Class class functions -void V3CUse::cUseAll(AstNetlist* nodep) { +void V3CUse::cUseAll() { UINFO(2, __FUNCTION__ << ": " << endl); // Call visitor separately for each module, so visitor state is cleared for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; diff --git a/src/V3CUse.h b/src/V3CUse.h index f0d87aeae..ffae09a46 100644 --- a/src/V3CUse.h +++ b/src/V3CUse.h @@ -27,7 +27,7 @@ class V3CUse { public: - static void cUseAll(AstNetlist* nodep); + static void cUseAll(); }; #endif // Guard diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index c590a52f8..331701260 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -47,9 +47,6 @@ private: // AstVarScope::user1p() -> AstVarScope*. Temporary signal that was created. AstUser1InUse m_inuser1; - // TYPES - enum { DOUBLE_OR_RATE = 10 }; // How many | per ||, Determined experimentally as best - // STATE AstNodeModule* m_modp; // Current module AstTopScope* m_topScopep; // Current top scope diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 5d667f1d5..45d009a8f 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -185,7 +185,6 @@ private: CombineState m_state; // Major state AstNodeModule* m_modp; // Current module AstCFunc* m_funcp; // Current function - V3Hash m_lowerHash; // Hash of the statement we're building CombCallVisitor m_call; // Tracking of function call users int m_modNFuncs; // Number of functions made AstNode* m_walkLast1p; // Final node that is the same in duplicate list diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index 11bfaa140..ccbd365cb 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -87,8 +87,6 @@ private: bool m_inToggleOff; // In function/task etc VarNameMap m_varnames; // Uniquification of inserted variable names string m_beginHier; // AstBegin hier name for user coverage points - typedef vl_unordered_map NameMap; - NameMap m_varNames; // Variable names made for uniq HandleLines m_handleLines; // All line numbers for a given m_stateHandle // METHODS diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 62f1536ca..d43e011ee 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -95,7 +95,6 @@ private: AssignMap m_assignMap; // List of all simple assignments for each variable bool m_elimUserVars; // Allow removal of user's vars bool m_elimDTypes; // Allow removal of DTypes - bool m_elimScopes; // Allow removal of Scopes bool m_elimCells; // Allow removal of Cells bool m_sideEffect; // Side effects discovered in assign RHS @@ -443,7 +442,6 @@ public: m_elimCells = elimCells; m_elimUserVars = elimUserVars; m_elimDTypes = elimDTypes; - m_elimScopes = elimScopes; m_sideEffect = false; // Prepare to remove some datatypes nodep->typeTablep()->clearCache(); diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index d53f14eb8..19b6c7ec8 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -801,27 +801,6 @@ public: //###################################################################### // EmitV class functions -void V3EmitV::emitv() { - UINFO(2, __FUNCTION__ << ": " << endl); - if (true) { - // All-in-one file - V3OutVFile of(v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + "__Vout.v"); - of.putsHeader(); - of.puts("# DESCR" - "IPTION: Verilator output: Verilog representation of internal tree for debug\n"); - EmitVFileVisitor visitor(v3Global.rootp(), &of); - } else { - // Process each module in turn - for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; - modp = VN_CAST(modp->nextp(), NodeModule)) { - V3OutVFile of(v3Global.opt.makeDir() + "/" + EmitCBaseVisitor::prefixNameProtect(modp) - + "__Vout.v"); - of.putsHeader(); - EmitVFileVisitor visitor(modp, &of); - } - } -} - void V3EmitV::verilogForTree(AstNode* nodep, std::ostream& os) { EmitVStreamVisitor(nodep, os); } void V3EmitV::verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, diff --git a/src/V3EmitV.h b/src/V3EmitV.h index 12dc38509..5ccf5c9b8 100644 --- a/src/V3EmitV.h +++ b/src/V3EmitV.h @@ -27,7 +27,6 @@ class V3EmitV { public: - static void emitv(); static void verilogForTree(AstNode* nodep, std::ostream& os = std::cout); static void verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth, AstSenTree* domainp, bool user3mark); diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index 2ba9d98a8..5c91a4625 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -43,9 +43,6 @@ class EmitXmlFileVisitor : public AstNVisitor { // Outfile methods V3OutFile* ofp() const { return m_ofp; } virtual void puts(const string& str) { ofp()->puts(str); } - virtual void putbs(const string& str) { ofp()->putbs(str); } - virtual void putfs(AstNode*, const string& str) { putbs(str); } - virtual void putqs(AstNode*, const string& str) { putbs(str); } virtual void putsNoTracking(const string& str) { ofp()->putsNoTracking(str); } virtual void putsQuoted(const string& str) { // Quote \ and " for use inside C programs diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 4430a25eb..f3e47f857 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -317,17 +317,6 @@ private: VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep); } } - bool expandWide(AstNodeAssign* nodep, AstExtend* rhsp) { - UINFO(8, " Wordize ASSIGN(EXTEND) " << nodep << endl); - int w = 0; - for (w = 0; w < rhsp->lhsp()->widthWords(); w++) { - addWordAssign(nodep, w, newAstWordSelClone(rhsp->lhsp(), w)); - } - for (; w < nodep->widthWords(); w++) { - addWordAssign(nodep, w, new AstConst(rhsp->fileline(), AstConst::SizedEData(), 0)); - } - return true; - } virtual void visit(AstSel* nodep) VL_OVERRIDE { if (nodep->user1SetOnce()) return; // Process once diff --git a/src/V3FileLine.h b/src/V3FileLine.h index 2a5e2e1ad..582056e06 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -40,7 +40,6 @@ class FileLine; class FileLineSingleton { // TYPES typedef std::map FileNameNumMap; - typedef std::map FileLangNumMap; // MEMBERS FileNameNumMap m_namemap; // filenameno for each filename std::deque m_names; // filename text for each filenameno @@ -270,7 +269,6 @@ public: } private: - void v3errorEndFatalGuts(std::ostringstream& str); string warnContext(bool secondary) const; }; std::ostream& operator<<(std::ostream& os, FileLine* fileline); diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index 2b4d71ca8..17343944d 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -203,8 +203,6 @@ private: int m_instSelNum; // Current instantiation count 0..N-1 InstDeModVarVisitor m_deModVars; // State of variables for current cell module - typedef std::map VarNameMap; - VL_DEBUG_FUNC; // Declare debug() // VISITORS diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index e0049d6ef..8c0fe88ec 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -46,8 +46,6 @@ void V3LinkLevel::modSortByLevel() { // level() was computed for us in V3LinkCells - typedef std::vector ModVec; - ModVec mods; // Modules ModVec tops; // Top level modules for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index b8cdb6da0..8fb47dc64 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -52,8 +52,6 @@ private: ImplTypedefMap m_implTypedef; // Created typedefs for each FileLineSet m_filelines; // Filelines that have been seen bool m_inAlways; // Inside an always - bool m_inGenerate; // Inside a generate - bool m_needStart; // Need start marker on lower AstParse AstNodeModule* m_valueModp; // If set, move AstVar->valuep() initial values to this module AstNodeModule* m_modp; // Current module AstNodeFTask* m_ftaskp; // Current task @@ -535,8 +533,6 @@ public: m_ftaskp = NULL; m_dtypep = NULL; m_inAlways = false; - m_inGenerate = false; - m_needStart = false; m_valueModp = NULL; iterate(rootp); } diff --git a/src/V3Order.cpp b/src/V3Order.cpp index c833abe50..fc6c9e4dc 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -103,8 +103,6 @@ #include VL_INCLUDE_UNORDERED_MAP #include VL_INCLUDE_UNORDERED_SET -class OrderMoveDomScope; - static bool domainsExclusive(const AstSenTree* fromp, const AstSenTree* top); //###################################################################### @@ -665,9 +663,7 @@ private: SenTreeFinder m_finder; // Find global sentree's and add them AstSenTree* m_comboDomainp; // Combo activation tree AstSenTree* m_deleteDomainp; // Delete this from tree - AstSenTree* m_settleDomainp; // Initial activation tree OrderInputsVertex* m_inputsVxp; // Top level vertex all inputs point from - OrderSettleVertex* m_settleVxp; // Top level vertex all settlement vertexes point from OrderLogicVertex* m_logicVxp; // Current statement being tracked, NULL=ignored AstTopScope* m_topScopep; // Current top scope being processed AstScope* m_scopetopp; // Scope under TOPSCOPE @@ -976,13 +972,8 @@ private: AstSenTree* combp = new AstSenTree(nodep->fileline(), // Gets cloned() so ok if goes out of scope new AstSenItem(nodep->fileline(), AstSenItem::Combo())); - m_comboDomainp = m_finder.getSenTree(nodep->fileline(), combp); + m_comboDomainp = m_finder.getSenTree(combp); pushDeletep(combp); // Cleanup when done - AstSenTree* settlep - = new AstSenTree(nodep->fileline(), // Gets cloned() so ok if goes out of scope - new AstSenItem(nodep->fileline(), AstSenItem::Settle())); - m_settleDomainp = m_finder.getSenTree(nodep->fileline(), settlep); - pushDeletep(settlep); // Cleanup when done // Fake AstSenTree we set domainp to indicate needs deletion m_deleteDomainp = new AstSenTree(nodep->fileline(), new AstSenItem(nodep->fileline(), AstSenItem::Settle())); @@ -1242,8 +1233,6 @@ public: m_inPre = m_inPost = false; m_comboDomainp = NULL; m_deleteDomainp = NULL; - m_settleDomainp = NULL; - m_settleVxp = NULL; m_inputsVxp = NULL; m_activeSenVxp = NULL; m_logicVxp = NULL; @@ -1549,7 +1538,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) { newtree2p = NULL; // Below edit may replace it V3Const::constifyExpensiveEdit(newtreep); // Remove duplicates newtreep->multi(true); // Comment that it was made from 2 clock domains - domainp = m_finder.getSenTree(domainp->fileline(), newtreep); + domainp = m_finder.getSenTree(newtreep); if (ddebug) { // LCOV_EXCL_START UINFO(0, " dnew =" << newtreep << endl); newtreep->dumpTree(cout); diff --git a/src/V3OrderGraph.h b/src/V3OrderGraph.h index dcaafc789..fc81aaf44 100644 --- a/src/V3OrderGraph.h +++ b/src/V3OrderGraph.h @@ -20,7 +20,6 @@ // MTaskMoveVertex // OrderEitherVertex // OrderInputsVertex -// OrderSettleVertex // OrderLogicVertex // OrderVarVertex // OrderVarStdVertex @@ -57,7 +56,6 @@ class OrderMoveDomScope; enum OrderWeights { WEIGHT_INPUT = 1, // Low weight just so dot graph looks nice WEIGHT_COMBO = 1, // Breakable combo logic - WEIGHT_LOOPBE = 1, // Connection to loop begin/end WEIGHT_POST = 2, // Post-delayed used var WEIGHT_PRE = 3, // Breakable pre-delayed used var WEIGHT_MEDIUM = 8, // Medium weight just so dot graph looks nice @@ -68,7 +66,6 @@ struct OrderVEdgeType { enum en { VERTEX_UNKNOWN = 0, VERTEX_INPUTS, - VERTEX_SETTLE, VERTEX_LOGIC, VERTEX_VARSTD, VERTEX_VARPRE, @@ -77,7 +74,6 @@ struct OrderVEdgeType { VERTEX_VARSETTLE, VERTEX_MOVE, EDGE_STD, - EDGE_CHANGEDET, EDGE_COMBOCUT, EDGE_PRECUT, EDGE_POSTCUT, @@ -85,10 +81,10 @@ struct OrderVEdgeType { }; const char* ascii() const { static const char* const names[] - = {"%E-vedge", "VERTEX_INPUTS", "VERTEX_SETTLE", "VERTEX_LOGIC", - "VERTEX_VARSTD", "VERTEX_VARPRE", "VERTEX_VARPOST", "VERTEX_VARPORD", - "VERTEX_VARSETTLE", "VERTEX_MOVE", "EDGE_STD", "EDGE_CHANGEDET", - "EDGE_COMBOCUT", "EDGE_PRECUT", "EDGE_POSTCUT", "_ENUM_END"}; + = {"%E-vedge", "VERTEX_INPUTS", "VERTEX_LOGIC", "VERTEX_VARSTD", + "VERTEX_VARPRE", "VERTEX_VARPOST", "VERTEX_VARPORD", "VERTEX_VARSETTLE", + "VERTEX_MOVE", "EDGE_STD", "EDGE_COMBOCUT", "EDGE_PRECUT", + "EDGE_POSTCUT", "_ENUM_END"}; return names[m_e]; } enum en m_e; @@ -122,15 +118,6 @@ public: virtual void loopsVertexCb(V3GraphVertex* vertexp); }; -//! Graph for UNOPTFLAT loops -class UnoptflatGraph : public OrderGraph { -public: - UnoptflatGraph() {} - virtual ~UnoptflatGraph() {} - // Methods - virtual void loopsVertexCb(V3GraphVertex* vertexp); -}; - //###################################################################### // Vertex types @@ -185,24 +172,6 @@ public: virtual bool domainMatters() { return false; } }; -class OrderSettleVertex : public OrderEitherVertex { - OrderSettleVertex(V3Graph* graphp, const OrderSettleVertex& old) - : OrderEitherVertex(graphp, old) {} - -public: - OrderSettleVertex(V3Graph* graphp, AstSenTree* domainp) - : OrderEitherVertex(graphp, NULL, domainp) {} - virtual ~OrderSettleVertex() {} - virtual OrderSettleVertex* clone(V3Graph* graphp) const { - return new OrderSettleVertex(graphp, *this); - } - virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_SETTLE; } - virtual string name() const { return "*SETTLE*"; } - virtual string dotColor() const { return "green"; } - virtual string dotName() const { return ""; } - virtual bool domainMatters() { return true; } -}; - class OrderLogicVertex : public OrderEitherVertex { AstNode* m_nodep; @@ -422,7 +391,6 @@ class MTaskMoveVertex : public V3GraphVertex { protected: friend class OrderVisitor; - friend class MTaskMoveVertexMaker; public: MTaskMoveVertex(V3Graph* graphp, OrderLogicVertex* logicp, const OrderEitherVertex* varp, @@ -487,17 +455,11 @@ public: // When ordering combo blocks with stronglyConnected, follow edges not // involving pre/pos variables virtual bool followComboConnected() const { return true; } - virtual bool followSequentConnected() const { return true; } static bool followComboConnected(const V3GraphEdge* edgep) { const OrderEdge* oedgep = dynamic_cast(edgep); if (!oedgep) v3fatalSrc("Following edge of non-OrderEdge type"); return (oedgep->followComboConnected()); } - static bool followSequentConnected(const V3GraphEdge* edgep) { - const OrderEdge* oedgep = dynamic_cast(edgep); - if (!oedgep) v3fatalSrc("Following edge of non-OrderEdge type"); - return (oedgep->followSequentConnected()); - } }; class OrderComboCutEdge : public OrderEdge { @@ -519,7 +481,6 @@ public: } virtual string dotColor() const { return "yellowGreen"; } virtual bool followComboConnected() const { return true; } - virtual bool followSequentConnected() const { return true; } }; class OrderPostCutEdge : public OrderEdge { @@ -541,7 +502,6 @@ public: } virtual string dotColor() const { return "PaleGreen"; } virtual bool followComboConnected() const { return false; } - virtual bool followSequentConnected() const { return true; } }; class OrderPreCutEdge : public OrderEdge { @@ -563,7 +523,6 @@ public: virtual ~OrderPreCutEdge() {} virtual string dotColor() const { return "khaki"; } virtual bool followComboConnected() const { return false; } - virtual bool followSequentConnected() const { return false; } }; #endif // Guard diff --git a/src/V3SenTree.h b/src/V3SenTree.h index 50002f7d4..deca31018 100644 --- a/src/V3SenTree.h +++ b/src/V3SenTree.h @@ -128,7 +128,7 @@ public: m_topscopep = NULL; m_trees.clear(); } - AstSenTree* getSenTree(FileLine* fl, AstSenTree* sensesp) { + AstSenTree* getSenTree(AstSenTree* sensesp) { // Return a global sentree that matches given sense list. AstSenTree* treep = m_trees.find(sensesp); // Not found, form a new one diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index e9741ac8d..c5d8e1d8c 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -43,7 +43,6 @@ private: bool m_fast; AstCFunc* m_cfuncp; // Current CFUNC - VDouble0 m_statInstrLong; // Instruction count bool m_counting; // Currently counting double m_instrs; // Current instr count (for determining branch direction) bool m_tracingCall; // Iterating into a CCall to a CFunc diff --git a/src/V3SymTable.h b/src/V3SymTable.h index d5430ea39..9906d9d23 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -36,7 +36,6 @@ class VSymEnt; //###################################################################### // Symbol table -typedef std::set VSymMap; typedef std::set VSymConstMap; class VSymEnt { diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 02fe2b38e..1ef486096 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -454,7 +454,7 @@ static void process() { if (!v3Global.opt.lintOnly() && !v3Global.opt.xmlOnly() && !v3Global.opt.dpiHdrOnly()) { // Create AstCUse to determine what class forward declarations/#includes needed in C // Must be before V3EmitC - V3CUse::cUseAll(v3Global.rootp()); + V3CUse::cUseAll(); // emitcInlines is first, as it may set needHInlines which other emitters read V3EmitC::emitcInlines(); diff --git a/src/VlcOptions.h b/src/VlcOptions.h index e0382766a..74e8c6380 100644 --- a/src/VlcOptions.h +++ b/src/VlcOptions.h @@ -29,7 +29,6 @@ //###################################################################### // V3Options - Command line options -typedef std::vector VlStringList; typedef std::set VlStringSet; class VlcOptions { @@ -59,7 +58,6 @@ public: m_unlink = false; } ~VlcOptions() {} - void setDebugMode(int level); // METHODS void parseOptsList(int argc, char** argv); diff --git a/src/VlcTop.h b/src/VlcTop.h index d0583ca54..f54725fcf 100644 --- a/src/VlcTop.h +++ b/src/VlcTop.h @@ -39,7 +39,6 @@ private: VlcSources m_sources; //< List of all source files to annotate // METHODS - void createDir(const string& dirname); void annotateCalc(); void annotateCalcNeeded(); void annotateOutputFiles(const string& dirname);