diff options
| author | gingerBill <bill@gingerbill.org> | 2022-11-25 23:57:55 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-11-25 23:57:55 +0000 |
| commit | d88b052d2d9aa8fa012be314bd29d7ae311fc941 (patch) | |
| tree | 09869f936f3c08d7731006d2c7e28b0be48b556d /src/check_expr.cpp | |
| parent | 615eccb6d193e9eb2575cfb28b1366c648296c31 (diff) | |
Naïve optimization of named _split_ multiple return valued when `defer` is never used
This is a naïve optimization but it helps a lot in the general case where callee temporary stack variables
are not allocated to represent the named return values by using that specific memory.
In the future, try to check if a specific named return value is ever used a `defer` within a procedure or not,
or is ever passed to a nested procedure call (e.g. possibly escapes).
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index c7585b51c..9846199f8 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6763,6 +6763,9 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call, Ast *pr if (initial_entity != nullptr && initial_entity->kind == Entity_Procedure) { if (initial_entity->Procedure.deferred_procedure.entity != nullptr) { call->viral_state_flags |= ViralStateFlag_ContainsDeferredProcedure; + if (c->decl) { + c->decl->defer_used += 1; + } } } |