Optimize returns at end of functions.

This commit is contained in:
Wilson Snyder
2019-12-01 17:19:18 -05:00
parent 2076b0219d
commit d65d8fda54
3 changed files with 24 additions and 1 deletions
+9
View File
@@ -94,6 +94,15 @@ void AstNode::init() {
m_user5Cnt = 0;
}
AstNode* AstNode::abovep() const {
// m_headtailp only valid at beginning or end of list
// Avoid supporting at other locations as would require walking
// list which is likely to cause performance issues.
UASSERT_OBJ(!m_nextp || firstAbovep(), this, "abovep() not allowed when in midlist");
const AstNode* firstp = firstAbovep() ? this : m_headtailp;
return firstp->backp();
}
string AstNode::encodeName(const string& namein) {
// Encode signal name raw from parser, then not called again on same signal
string out;