Hi Robert,
gcc/
* regrename.c (create_new_chain): Initialize terminated_dead,
renamed and tied_chain.
(find_best_rename_reg): Pick and check register from the tied chain.
(regrename_do_replace): Mark head as renamed.
(scan_rtx_reg): Tie chains in move insns. Set terminate_dead flag.
* regrename.h (struct du_head): Add tied_chain, renamed and
terminated_dead members.
Thanks - this looks a lot better already. You didn't say how it was
bootstrapped and tested; please include this information for future
submissions. For a patch like this, some data on the improvement you got
would also be appreciated.
I'd still like to investigate the possibility of further simplification:
+ {
+ /* Find the input chain. */
+ for (i = c->id - 1; id_to_chain.iterate (i, &head); i--)
+ if (head->last && head->last->insn == insn
+ && head->terminated_dead)
+ {
+ gcc_assert (head->regno == REGNO (recog_data.operand[1]));
+ c->tied_chain = head;
+ head->tied_chain = c;
+
+ if (dump_file)
+ fprintf (dump_file, "Tying chain %s (%d) with %s (%d)\n",
+ reg_names[c->regno], c->id,
+ reg_names[head->regno], head->id);
+ /* Once tied, we're done. */
+ break;
+ }
+ }
+ }
+
This looks like it's a little more complicated than necessary. Couldn't
you add a static var "terminated_this_insn" which gets initialized to
NULL and set when a reg dies, and then you check this here rather than
having a loop? That would also eliminate the new "terminated_dead" field.
Other than that I'm pretty happy with this.
Bernd