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).
This commit is contained in:
gingerBill
2022-11-25 23:57:55 +00:00
parent 615eccb6d1
commit d88b052d2d
9 changed files with 84 additions and 17 deletions

View File

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