[ImportVerilog] Materialize constant calls directly

Instead of lowering constant calls to functions and system tasks,
materialize the constant value directly.
This commit is contained in:
Fabian Schuiki 2024-09-28 14:18:06 -07:00
parent b86194929e
commit 6a724e542b
No known key found for this signature in database
GPG Key ID: C42F5825FC5275E6
1 changed files with 6 additions and 0 deletions

View File

@ -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);