I'm obvkously doing something stupid here; but I'm at a loss to figure it out.
Porting to a machine where most instructions set some condition codes and
before hoisting, we have
(insn 1205 1204 1206 65 (set (reg:CC_ZN 24 *cc)
(compare:CC_ZN (reg:SI 843)
(reg:SI 844)))
../../../../../uberbaum/newlib/libc/stdio/vfprintf.c:1046 83 {*cmpsi_zn}
(expr_list:REG_EQUAL (compare:CC_ZN (reg:SI 843)
(const_int 0 [0]))
(expr_list:REG_DEAD (reg:SI 844)
(nil))))
(jump_insn 1206 1205 1207 65 (set (pc)
(if_then_else (eq (reg:CC_ZN 24 *cc)
(const_int 0 [0]))
(label_ref 1215)
(pc))) ../../../../../uberbaum/newlib/libc/stdio/vfprintf.c:1046 86
{branch_insn}
(expr_list:REG_DEAD (reg:CC_ZN 24 *cc)
(nil))
-> 1215)
But after the hoist pass runs, we've inserted a (set (reg:1884) (plus (reg
674) (const_int 4)))
between the CC set and use.
(insn 1203 1202 1205 62 (clobber (reg:CC 24 *cc))
../../../../../uberbaum/newlib/libc/stdio/vfprintf.c:1046 -1
(expr_list:REG_UNUSED (reg:CC 24 *cc)
(nil)))
(insn 1205 1203 6262 62 (set (reg:CC_ZN 24 *cc)
(compare:CC_ZN (reg:SI 843)
(const_int 0 [0])))
../../../../../uberbaum/newlib/libc/stdio/vfprintf.c:1046 83 {*cmpsi_zn}
(expr_list:REG_EQUAL (compare:CC_ZN (reg:SI 843)
(const_int 0 [0]))
(expr_list:REG_DEAD (reg:SI 844)
(nil))))
(insn 6262 1205 1206 62 (set (reg/f:SI 1884 [ ap ])
(plus:SI (reg/v/f:SI 674 [ ap ])
(const_int 4 [0x4]))) 10 {*addsi}
(nil))
(jump_insn 1206 6262 1207 62 (set (pc)
(if_then_else (eq (reg:CC_ZN 24 *cc)
(const_int 0 [0]))
(label_ref 1215)
(pc))) ../../../../../uberbaum/newlib/libc/stdio/vfprintf.c:1046 86
{branch_insn}
(expr_list:REG_DEAD (reg:CC_ZN 24 *cc)
(nil))
-> 1215)
and this is a problem because that will codegen as a
move $rtemp,src
addi $rtemp,4
and both of those instructions end up setting condition codes, breaking the
dependency with the compare that actually sets the CCs..
I've looked at a number of the other CCmode ports, but can't see how they
prevent this from occurring.
Do I need to do something like change my define_expand for addsi3 to be
something like
[ (parallel [ (clobber:CCmode (reg:CCmode CCREG))
(set:SI (match_operand:SI 0 "" "")
(plus:SI (match_operand::SI 1 "" "" )
(match_operand:SI 2 ""
"")))])]
So that there's an explicitly stated dependency that would prevent motioning
before the use in the jump_insn?
But I don't see this construct used in other ports that have CCmode registers
as opposed to cc0
I'm porting of 4.6.1 - is there any better documentation of CCmode ports or a
reference port with