Re: rx-elf: sched2 dependency question
DJ Delorie d...@redhat.com writes: In this example, why isn't insn 117 scheduled before insn 115 ? What is the dependency? The only thing they have in common is CC, but both generate a value which is never used. I don't see anything in sched-deps.c which prevents using a register for scheduling dependencies even if there is a REG_UNUSED note. Perhaps this is a bug. Or perhaps I'm missing something. In the debugger you should be able to use sd_debug_lists to dump all the dependency information for the insns. Ian
Re: rx-elf: sched2 dependency question
On 09/27/2010 01:30 PM, DJ Delorie wrote: (insn 115 114 117 15 dj.c:256 (parallel [ (set (reg:SI 12 r12 [139]) (plus:SI (reg:SI 3 r3 [orig:54 pretmp.923 ] [54]) (reg:SI 12 r12 [138]))) (set (reg:CC_ZSC 16 cc) (compare:CC_ZSC (plus:SI (reg:SI 3 r3 [orig:54 pretmp.923 ] [54]) (reg:SI 12 r12 [138])) (const_int 0))) ]) 72 {addsi3} (expr_list:REG_UNUSED (reg:CC_ZSC 16 cc) (nil))) I think it's probably a mistake to have the default ADD instruction SET the flags, rather than CLOBBER them. That said, I suppose it wouldn't hurt to modify sched-deps to treat a SET+REG_UNUSED as a CLOBBER. r~
Re: rx-elf: sched2 dependency question
I think it's probably a mistake to have the default ADD instruction SET the flags, rather than CLOBBER them. How else would we optimize away compares?
Re: rx-elf: sched2 dependency question
On 09/27/2010 03:37 PM, DJ Delorie wrote: I think it's probably a mistake to have the default ADD instruction SET the flags, rather than CLOBBER them. How else would we optimize away compares? By having a separate ADD that looks like your current one. Combine will put them together for you. Compare i386 (define_insn *addmode_1 [(set (match_operand:SWI48 0 nonimmediate_operand =r,rm,r,r) (plus:SWI48 (match_operand:SWI48 1 nonimmediate_operand %0,0,r,r) (match_operand:SWI48 2 general_operand g,ri,0,li))) (clobber (reg:CC FLAGS_REG))] ix86_binary_operator_ok (PLUS, MODEmode, operands) ... (define_insn *addmode_2 [(set (reg FLAGS_REG) (compare (plus:SWI (match_operand:SWI 1 nonimmediate_operand %0,0) (match_operand:SWI 2 general_operand g,ri)) (const_int 0))) (set (match_operand:SWI 0 nonimmediate_operand =r,rm) (plus:SWI (match_dup 1) (match_dup 2)))] ix86_match_ccmode (insn, CCGOCmode) ix86_binary_operator_ok (PLUS, MODEmode, operands) ... r~
Re: rx-elf: sched2 dependency question
Would we have to do that for *all* the math/logic ops, or just add?
Re: rx-elf: sched2 dependency question
On 09/27/2010 04:21 PM, DJ Delorie wrote: Would we have to do that for *all* the math/logic ops, or just add? All of them of course. r~
Re: rx-elf: sched2 dependency question
That said, I suppose it wouldn't hurt to modify sched-deps to treat a SET+REG_UNUSED as a CLOBBER. Early in sched_analyze_reg, check for ref==USE and a REG_UNUSED note, and change ref to CLOBBER? I tried it, it didn't seem to help... Index: sched-deps.c === --- sched-deps.c(revision 164652) +++ sched-deps.c(working copy) @@ -2116,12 +2116,16 @@ sched_analyze_reg (struct deps_desc *dep if (!reload_completed sel_sched_p () (regno = max_reg_num () - 1 || regno = deps-max_reg)) extend_deps_reg_info (deps, regno); maybe_extend_reg_info_p (); + if (ref == SET + find_regno_note (insn, REG_UNUSED, regno)) +ref = CLOBBER; + /* A hard reg in a wide mode may really be multiple registers. If so, mark all of them just like the first. */ if (regno FIRST_PSEUDO_REGISTER) { int i = hard_regno_nregs[regno][mode]; if (ref == SET)