Internals: Use and enforce class final for ~5% performance boost.

This commit is contained in:
Wilson Snyder
2020-11-18 21:32:16 -05:00
parent c0888c1b0f
commit b6ded59c2b
224 changed files with 976 additions and 949 deletions
+7 -7
View File
@@ -232,7 +232,7 @@ struct AstNodeComparator {
}
};
class UnpackRef {
class UnpackRef final {
// m_nodep is called in this context (AstNodeStmt, AstCell, AstNodeFTask, or AstAlways)
AstNode* m_contextp;
AstNode* m_nodep; // ArraySel, SliceSel, ArrayVarRef (entire value)
@@ -283,7 +283,7 @@ public:
}
};
class UnpackRefMap {
class UnpackRefMap final {
public:
typedef std::map<AstVar*, std::set<UnpackRef>, AstNodeComparator> MapType;
typedef MapType::iterator MapIt;
@@ -384,7 +384,7 @@ public:
typedef std::map<AstNodeModule*, RefsInModule, AstNodeComparator> SplitVarRefsMap;
class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl {
class SplitUnpackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
typedef std::set<AstVar*, AstNodeComparator> VarSet;
VarSet m_foundTargetVar;
UnpackRefMap m_refs;
@@ -802,7 +802,7 @@ public:
// Split packed variables
// Split variable
class SplitNewVar {
class SplitNewVar final {
int m_lsb; // LSB in the original bitvector
int m_bitwidth;
AstVar* m_varp; // The LSB of this variable is always 0, not m_lsb
@@ -828,7 +828,7 @@ public:
};
// One Entry instance for an AstVarRef instance
class PackedVarRefEntry {
class PackedVarRefEntry final {
AstNode* m_nodep; // Either AstSel or AstVarRef is expected.
int m_lsb;
int m_bitwidth;
@@ -859,7 +859,7 @@ public:
};
// How a variable is used
class PackedVarRef {
class PackedVarRef final {
struct SortByFirst {
bool operator()(const std::pair<int, bool>& a, const std::pair<int, bool>& b) const {
if (a.first == b.first) return a.second < b.second;
@@ -956,7 +956,7 @@ public:
}
};
class SplitPackedVarVisitor : public AstNVisitor, public SplitVarImpl {
class SplitPackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
typedef std::map<AstVar*, PackedVarRef, AstNodeComparator> PackedVarRefMap;
AstNetlist* m_netp;
AstNodeModule* m_modp; // Current module (just for log)