Skip to content

Commit

Permalink
Improve V3Premit
Browse files Browse the repository at this point in the history
- Enable creating constant pool entries for RHS of simple
  var = const assignments
- Never extract ArraySel (it's just pointer arithmetic)
- Remove unnecessary AstTraceInc precond child tree
- Always fully recurse expressions (fix transplanted from verilator#4617)
- General cleanup

Overall the patch is performance neutral to slightly positive, but saves
~10% peak Verialtor memory usage due to not creating temporaries (which
are later expanded) for any ArraySels.
  • Loading branch information
gezalore committed Dec 3, 2023
1 parent 5d99534 commit 48384ac
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 191 deletions.
3 changes: 1 addition & 2 deletions src/V3AstNodeOther.h
Original file line number Diff line number Diff line change
Expand Up @@ -3253,8 +3253,7 @@ class AstTraceDecl final : public AstNodeStmt {
};
class AstTraceInc final : public AstNodeStmt {
// Trace point dump
// @astgen op1 := precondsp : List[AstNode] // Statements to emit before this node
// @astgen op2 := valuep : AstNodeExpr // Expression being traced (from decl)
// @astgen op1 := valuep : AstNodeExpr // Expression being traced (from decl)
//
// @astgen ptr := m_declp : AstTraceDecl // Pointer to declaration
const uint32_t m_baseCode; // Trace code base value in function containing this AstTraceInc
Expand Down
1 change: 0 additions & 1 deletion src/V3EmitCImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ class EmitCTrace final : EmitCFunc {
}

void emitTraceChangeOne(AstTraceInc* nodep, int arrayindex) {
iterateAndNextConstNull(nodep->precondsp());
// Note: Both VTraceType::CHANGE and VTraceType::FULL use the 'full' methods
const std::string func = nodep->traceType() == VTraceType::CHANGE ? "chg" : "full";
bool emitWidth = true;
Expand Down
Loading

0 comments on commit 48384ac

Please sign in to comment.