[qfcc] Move return save temp into call block

This fixes func-expr after the assignment rewrite. Now all tests pass
when not optimizing (something not quite right in assignchain when
optimizing).
This commit is contained in:
Bill Currie 2020-03-14 01:24:13 +09:00
parent 57134e01cd
commit b1459ac816
2 changed files with 9 additions and 2 deletions

View file

@ -1843,6 +1843,9 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params)
if (e->type == ex_compound) { if (e->type == ex_compound) {
e = expr_file_line (initialized_temp_expr (arg_types[i], e), e); e = expr_file_line (initialized_temp_expr (arg_types[i], e), e);
} }
// FIXME this is target-specific info and should not be in the
// expression tree
// That, or always use a temp, since it should get optimized out
if (has_function_call (e)) { if (has_function_call (e)) {
expr_t *cast = cast_expr (arg_types[i], convert_vector (e)); expr_t *cast = cast_expr (arg_types[i], convert_vector (e));
expr_t *tmp = new_temp_def_expr (arg_types[i]); expr_t *tmp = new_temp_def_expr (arg_types[i]);

View file

@ -924,10 +924,14 @@ binary_expr (int op, expr_t *e1, expr_t *e2)
convert_name (e1); convert_name (e1);
e1 = convert_vector (e1); e1 = convert_vector (e1);
// FIXME this is target-specific info and should not be in the
// expression tree
if (e1->type == ex_block && e1->e.block.is_call if (e1->type == ex_block && e1->e.block.is_call
&& has_function_call (e2) && e1->e.block.result) { && has_function_call (e2) && e1->e.block.result) {
e = new_temp_def_expr (get_type (e1->e.block.result)); expr_t *tmp = new_temp_def_expr (get_type (e1->e.block.result));
e1 = assign_expr (e, e1); e = assign_expr (tmp, e1->e.block.result);
append_expr (e1, e);
e1->e.block.result = tmp;
} }
if (e1->type == ex_error) if (e1->type == ex_error)
return e1; return e1;