mirror of
https://github.com/verilator/verilator.git
synced 2026-10-08 02:53:12 +02:00
Internals: Further performance improvement of AstNode type tests, #2138. No functional change intended.
Replace the virtual type() method on AstNode with a non-virtual, inlined accessor to a const member variable m_type. This means that in order to be able to use this for type testing, it needs to be initialized based on the final type of the node. This is achieved by passing the relevant AstType value back through the constructor call chain. Most of the boilerplate involved is auto generated by first feeding V3AstNodes.h through astgen to get V3AstNodes__gen.h, which is then included in V3Ast.h. No client code needs to be aware and there is no functional change intended. Eliminating the virtual function call to fetch the node type identifier results in measured compilation speed improvement of 5-10% as it eliminates up to 20% of all mispredicted branches from the execution.
This commit is contained in:
+1
-1
@@ -168,7 +168,7 @@ AstNodeBiop* AstEqWild::newTyped(FileLine* fl, AstNode* lhsp, AstNode* rhsp) {
|
||||
}
|
||||
|
||||
AstExecGraph::AstExecGraph(FileLine* fileline)
|
||||
: AstNode(fileline) {
|
||||
: AstNode(AstType::atExecGraph, fileline) {
|
||||
m_depGraphp = new V3Graph;
|
||||
}
|
||||
AstExecGraph::~AstExecGraph() {
|
||||
|
||||
Reference in New Issue
Block a user