This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: condition codes, haifa-sched and virtual-stack-vars
Alexandre Oliva <aoliva@redhat.com> writes:
> How about having a pre-reload move pattern that clobbers CC, split
> after reload into one that does not, so that sched2 could put the move
> between compare and branch should it indeed not affect CC?
Alexandre,
I liked your idea best (less invasive than Jeff's idea of
reworking conditional branch patterns), and it works!
In the "movsi" expander, I added this bit:
if (REG_P (src)
&& REGNO (src) >= FIRST_PSEUDO_REGISTER
&& REGNO (src) <= LAST_VIRTUAL_REGISTER)
{
emit_insn (gen_movsi_virtual_reg (dest, src));
return 1;
}
In the md file, *after* the normal movsi insn (so the normal takes
precedence), I added this pattern:
(define_insn_and_split "movsi_virtual_reg"
[(parallel [(set (match_operand:SI 0 "register_operand" "=r")
(match_operand:SI 1 "register_operand" "r"))
(clobber (reg:CC CC_REGNUM))])]
""
"#"
"reload_completed"
[(set (match_dup 0)
(match_dup 1))]
"")
Thanks very much Alexandre & Jeff!
Greg