From: Eric Botcazou <ebotca...@adacore.com> Date: Wed, 06 Feb 2013 11:13:30 +0100
> I think testing crtl->uses_only_leaf_regs is sufficient here (and > while you're at it, you could also test the value of > HAVE_window_save, which can be 0 if -mflat is passed on the SPARC), > so > > #ifdef HAVE_window_save > if (HAVE_window_save && !crtl->uses_only_leaf_regs) > { > > } > #endif Yes, this works perfectly, Jakub any objections? gcc/ 2013-02-06 David S. Miller <da...@davemloft.net> * var-tracking.c (vt_add_function_parameter): Test the presence of HAVE_window_save properly and do not remap argument registers when we have a leaf function. diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 714acb69..0db1562 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -9502,31 +9502,34 @@ vt_add_function_parameter (tree parm) /* DECL_INCOMING_RTL uses the INCOMING_REGNO of parameter registers. If the target machine has an explicit window save instruction, the actual entry value is the corresponding OUTGOING_REGNO instead. */ - if (REG_P (incoming) - && HARD_REGISTER_P (incoming) - && OUTGOING_REGNO (REGNO (incoming)) != REGNO (incoming)) + if (HAVE_window_save && !crtl->uses_only_leaf_regs) { - parm_reg_t p; - p.incoming = incoming; - incoming - = gen_rtx_REG_offset (incoming, GET_MODE (incoming), - OUTGOING_REGNO (REGNO (incoming)), 0); - p.outgoing = incoming; - vec_safe_push (windowed_parm_regs, p); - } - else if (MEM_P (incoming) - && REG_P (XEXP (incoming, 0)) - && HARD_REGISTER_P (XEXP (incoming, 0))) - { - rtx reg = XEXP (incoming, 0); - if (OUTGOING_REGNO (REGNO (reg)) != REGNO (reg)) + if (REG_P (incoming) + && HARD_REGISTER_P (incoming) + && OUTGOING_REGNO (REGNO (incoming)) != REGNO (incoming)) { parm_reg_t p; - p.incoming = reg; - reg = gen_raw_REG (GET_MODE (reg), OUTGOING_REGNO (REGNO (reg))); - p.outgoing = reg; + p.incoming = incoming; + incoming + = gen_rtx_REG_offset (incoming, GET_MODE (incoming), + OUTGOING_REGNO (REGNO (incoming)), 0); + p.outgoing = incoming; vec_safe_push (windowed_parm_regs, p); - incoming = replace_equiv_address_nv (incoming, reg); + } + else if (MEM_P (incoming) + && REG_P (XEXP (incoming, 0)) + && HARD_REGISTER_P (XEXP (incoming, 0))) + { + rtx reg = XEXP (incoming, 0); + if (OUTGOING_REGNO (REGNO (reg)) != REGNO (reg)) + { + parm_reg_t p; + p.incoming = reg; + reg = gen_raw_REG (GET_MODE (reg), OUTGOING_REGNO (REGNO (reg))); + p.outgoing = reg; + vec_safe_push (windowed_parm_regs, p); + incoming = replace_equiv_address_nv (incoming, reg); + } } } #endif