Skip to content

Commit

Permalink
[ImportVerilog] Materialize constant calls directly
Browse files Browse the repository at this point in the history
Instead of lowering constant calls to functions and system tasks,
materialize the constant value directly.
  • Loading branch information
fabianschuiki committed Sep 28, 2024
1 parent b861949 commit 6a724e5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Conversion/ImportVerilog/Expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@ struct RvalueExprVisitor {
mlir::emitError(loc, "unsupported class method call");
return {};
}

// Try to materialize constant values directly.
auto constant = context.evaluateConstant(expr);
if (auto value = context.materializeConstant(constant, *expr.type, loc))
return value;

return std::visit(
[&](auto &subroutine) { return visitCall(expr, subroutine); },
expr.subroutine);
Expand Down

0 comments on commit 6a724e5

Please sign in to comment.