Out-of-order update of new_spill_reg_store[]
Bernd Schmidt
bernds@codesourcery.com
Mon Oct 17 14:32:00 GMT 2011
> gcc/
> * reload1.c (reload_regs_reach_end_p): Replace with...
> (reload_reg_rtx_reaches_end_p): ...this function.
> (new_spill_reg_store): Update commentary.
> (emit_input_reload_insns): Don't clear new_spill_reg_store here.
> (emit_output_reload_insns): Check reload_reg_rtx_reaches_end_p
> before setting new_spill_reg_store.
> (emit_reload_insns): Use a separate loop to clear new_spill_reg_store.
> Use reload_reg_rtx_reaches_end_p instead of reload_regs_reach_end_p.
> Also use reload_reg_rtx_reaches_end_p when recording inheritance
> information for non-spill reload registers.
Just an update to say that based on our discussion I think the general
approach is OK, but I'm still trying to figure out what exactly this
piece of code is doing, and whether the changes to it make sense:
> @@ -8329,30 +8329,33 @@ emit_reload_insns (struct insn_chain *ch
> the storing insn so that we may delete this insn with
> delete_output_reload. */
> src_reg = reload_reg_rtx_for_output[r];
> -
> - /* If this is an optional reload, try to find the source reg
> - from an input reload. */
> - if (! src_reg)
> + if (src_reg
> + && reload_reg_rtx_reaches_end_p (src_reg, r))
> + store_insn = new_spill_reg_store[REGNO (src_reg)];
> + else
> {
> + /* If this is an optional reload, try to find the
> + source reg from an input reload. */
> rtx set = single_set (insn);
> if (set && SET_DEST (set) == rld[r].out)
> {
> int k;
> + rtx cand;
>
> src_reg = SET_SRC (set);
> store_insn = insn;
> for (k = 0; k < n_reloads; k++)
> - {
> - if (rld[k].in == src_reg)
> - {
> - src_reg = reload_reg_rtx_for_input[k];
> - break;
> - }
> - }
> + if (rld[k].in == src_reg)
> + {
> + cand = reload_reg_rtx_for_input[k];
> + if (reload_reg_rtx_reaches_end_p (cand, k))
> + {
> + src_reg = cand;
> + break;
> + }
> + }
> }
> }
> - else
> - store_insn = new_spill_reg_store[REGNO (src_reg)];
> if (src_reg && REG_P (src_reg)
> && REGNO (src_reg) < FIRST_PSEUDO_REGISTER)
> {
Bernd
More information about the Gcc-patches
mailing list