From e4abc3d580c4fb7f63776b4653a710f30e57a265 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 23 Dec 2001 05:02:18 -0800 Subject: [PATCH] calls.c (expand_call): Don't turn off ECF_LIBCALL_BLOCK for an invalid result register... * calls.c (expand_call): Don't turn off ECF_LIBCALL_BLOCK for an invalid result register; do end the sequence properly. (emit_library_call_value_1): Likewise. From-SVN: r48287 --- gcc/ChangeLog | 6 +++ gcc/calls.c | 111 +++++++++++++++++++++++++++++--------------------- 2 files changed, 71 insertions(+), 46 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f1873c0626..3db09bb7839 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2001-12-23 Richard Henderson + + * calls.c (expand_call): Don't turn off ECF_LIBCALL_BLOCK for + an invalid result register; do end the sequence properly. + (emit_library_call_value_1): Likewise. + 2001-12-22 Aldy Hernandez * config/rs6000/rs6000.h (rs6000_builtins): Add vsldoi variants. diff --git a/gcc/calls.c b/gcc/calls.c index 2049bd2f9c8..a6c999c0125 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2937,9 +2937,6 @@ expand_call (exp, target, ignore) valreg = hard_function_value (TREE_TYPE (exp), fndecl, (pass == 0)); } - if (valreg == 0 || GET_CODE (valreg) == PARALLEL) - flags &= ~ECF_LIBCALL_BLOCK; - /* Precompute all register parameters. It isn't safe to compute anything once we have started filling any specific hard regs. */ precompute_register_parameters (num_actuals, args, ®_parm_seen); @@ -3071,32 +3068,45 @@ expand_call (exp, target, ignore) we have no way to move such values into a pseudo register. */ if (pass && (flags & ECF_LIBCALL_BLOCK)) { - rtx note = 0; - rtx temp = gen_reg_rtx (GET_MODE (valreg)); rtx insns; - /* Mark the return value as a pointer if needed. */ - if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE) - mark_reg_pointer (temp, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)))); - - /* Construct an "equal form" for the value which mentions all the - arguments in order as well as the function name. */ - for (i = 0; i < num_actuals; i++) - note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note); - note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note); - - insns = get_insns (); - end_sequence (); - - if (flags & ECF_PURE) - note = gen_rtx_EXPR_LIST (VOIDmode, - gen_rtx_USE (VOIDmode, - gen_rtx_MEM (BLKmode, - gen_rtx_SCRATCH (VOIDmode))), note); - - emit_libcall_block (insns, temp, valreg, note); - - valreg = temp; + if (valreg == 0 || GET_CODE (valreg) == PARALLEL) + { + insns = get_insns (); + end_sequence (); + emit_insns (insns); + } + else + { + rtx note = 0; + rtx temp = gen_reg_rtx (GET_MODE (valreg)); + + /* Mark the return value as a pointer if needed. */ + if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE) + mark_reg_pointer (temp, + TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)))); + + /* Construct an "equal form" for the value which mentions all the + arguments in order as well as the function name. */ + for (i = 0; i < num_actuals; i++) + note = gen_rtx_EXPR_LIST (VOIDmode, + args[i].initial_value, note); + note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note); + + insns = get_insns (); + end_sequence (); + + if (flags & ECF_PURE) + note = gen_rtx_EXPR_LIST (VOIDmode, + gen_rtx_USE (VOIDmode, + gen_rtx_MEM (BLKmode, + gen_rtx_SCRATCH (VOIDmode))), + note); + + emit_libcall_block (insns, temp, valreg, note); + + valreg = temp; + } } else if (pass && (flags & ECF_MALLOC)) { @@ -4021,8 +4031,6 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) NO_DEFER_POP; valreg = (mem_value == 0 && outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX); - if (valreg == 0 || GET_CODE (valreg) == PARALLEL) - flags &= ~ECF_LIBCALL_BLOCK; /* Stack must be properly aligned now. */ if (stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1)) @@ -4078,29 +4086,40 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) we have no way to move such values into a pseudo register. */ if (flags & ECF_LIBCALL_BLOCK) { - rtx note = 0; - rtx temp = gen_reg_rtx (GET_MODE (valreg)); rtx insns; - int i; - /* Construct an "equal form" for the value which mentions all the - arguments in order as well as the function name. */ - for (i = 0; i < nargs; i++) - note = gen_rtx_EXPR_LIST (VOIDmode, argvec[i].value, note); - note = gen_rtx_EXPR_LIST (VOIDmode, fun, note); + if (valreg == 0 || GET_CODE (valreg) == PARALLEL) + { + insns = get_insns (); + end_sequence (); + emit_insns (insns); + } + else + { + rtx note = 0; + rtx temp = gen_reg_rtx (GET_MODE (valreg)); + int i; - insns = get_insns (); - end_sequence (); + /* Construct an "equal form" for the value which mentions all the + arguments in order as well as the function name. */ + for (i = 0; i < nargs; i++) + note = gen_rtx_EXPR_LIST (VOIDmode, argvec[i].value, note); + note = gen_rtx_EXPR_LIST (VOIDmode, fun, note); - if (flags & ECF_PURE) - note = gen_rtx_EXPR_LIST (VOIDmode, - gen_rtx_USE (VOIDmode, - gen_rtx_MEM (BLKmode, - gen_rtx_SCRATCH (VOIDmode))), note); + insns = get_insns (); + end_sequence (); - emit_libcall_block (insns, temp, valreg, note); + if (flags & ECF_PURE) + note = gen_rtx_EXPR_LIST (VOIDmode, + gen_rtx_USE (VOIDmode, + gen_rtx_MEM (BLKmode, + gen_rtx_SCRATCH (VOIDmode))), + note); + + emit_libcall_block (insns, temp, valreg, note); - valreg = temp; + valreg = temp; + } } pop_temp_slots (); -- 2.30.2