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_stmt.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_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 9cacb4a35..502eed57e 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2018,6 +2018,9 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { ctx->in_defer = true; check_stmt(ctx, ds->stmt, 0); ctx->in_defer = out_in_defer; + if (ctx->decl) { + ctx->decl->defer_used += 1; + } } case_end; |