[qfcc] Implement the actual return from inline

It's just a jump to a label at the end of the block, but it's enough for
now as it takes care of the assumption that the return is the last
expression in the inlined function.
This commit is contained in:
Bill Currie 2024-12-12 11:19:24 +09:00
parent 626680f22f
commit 74637fffbc
2 changed files with 11 additions and 2 deletions

View file

@ -305,8 +305,8 @@ build_inline_call (symbol_t *fsym, const type_t *ftype,
}
append_expr (call, expr);
func->return_label = nullptr;//new_label_expr ();
//append_expr (call, func->return_label);
func->return_label = new_label_expr ();
append_expr (call, func->return_label);
func->return_imp = inline_return_expr;

View file

@ -1067,6 +1067,14 @@ spirv_uexpr (const expr_t *e, spirvctx_t *ctx)
return id;
}
static unsigned
spirv_label (const expr_t *e, spirvctx_t *ctx)
{
auto label = &e->label;
unsigned id = spirv_label_id (label, ctx);
return spirv_LabelId (id, ctx);
}
static unsigned
spirv_block (const expr_t *e, spirvctx_t *ctx)
{
@ -1722,6 +1730,7 @@ static unsigned
spirv_emit_expr (const expr_t *e, spirvctx_t *ctx)
{
static spirv_expr_f funcs[ex_count] = {
[ex_label] = spirv_label,
[ex_block] = spirv_block,
[ex_expr] = spirv_expr,
[ex_uexpr] = spirv_uexpr,