if regrel32 is marked as being outside the procedure frame, and if it has no type info, it seems that compilers generate that case to encode return variables which exist outside a procedure's frame, in which case we can make up the difference by grabbing the return type from the containing procedure type. this does not break existing valid cases, but may not be the fully correct rule.

This commit is contained in:
Ryan Fleury
2024-12-29 13:46:44 -08:00
parent aa42d12d0f
commit be45100964
+10
View File
@@ -2560,6 +2560,16 @@ ASYNC_WORK_DEF(p2r_symbol_stream_convert_work)
} }
} }
// TODO(rjf): is this correct?
// rjf: redirect type, if 0, and if outside frame, to the return type of the
// containing procedure
if(local_kind == RDI_LocalKind_Parameter && regrel32->itype == 0 &&
top_scope_node->scope->symbol != 0 &&
top_scope_node->scope->symbol->type != 0)
{
type = top_scope_node->scope->symbol->type->direct_type;
}
// rjf: build local // rjf: build local
RDIM_Scope *scope = top_scope_node->scope; RDIM_Scope *scope = top_scope_node->scope;
RDIM_Local *local = rdim_scope_push_local(arena, &sym_scopes, scope); RDIM_Local *local = rdim_scope_push_local(arena, &sym_scopes, scope);