Paolo Bonzini schrieb:
> On 10/22/2010 01:16 PM, Georg Lay wrote:
>> Then the first insn gets split after reload and before peephole2:
>>
>> (insn 22 8 23 2 peep2.c:5 (set (reg:SI 15 d15)
>> (and:SI (reg:SI 4 d4 [ x ])
>> (const_int -98305 [0xfffe7fff]))) 143
>> {*and3_zeroes.insert.{SI}.ic}
>> (nil))
>>
>> (insn 23 22 21 2 peep2.c:5 (set (reg:SI 15 d15)
>> (xor:SI (reg:SI 15 d15)
>> (reg:SI 4 d4 [ x ]))) 39 {*xorsi3} (nil))
>>
>> (insn 21 23 10 2 peep2.c:5 (set (reg:SI 4 d4)
>> (reg:SI 15 d15)) 2 {*movsi_insn} (nil))
>>
>> (call_insn/j 10 21 11 2 peep2.c:5 (parallel [
>> (set (reg:SI 2 d2)
>> (call (mem:HI (symbol_ref:SI ("f") [flags
>> 0x41]<function_decl
>> 0xb76b3280 f>) [0 S2 A16])
>> (const_int 0 [0x0])))
>> (use (const_int 1 [0x1]))
>> ]) 92 {call_value_insn} (nil)
>> (expr_list:REG_DEP_TRUE (use (reg:SI 4 d4))
>> (nil)))
>> ;; End of basic block 2 -> ( 1)
>> ;; lr out 2 [d2] 26 [SP] 27 [a11]
>> ;; live out 2 [d2] 26 [SP] 27 [a11]
>> ;; Succ edge EXIT [100.0%] (ab,sibcall)
>>
>> (barrier 11 10 20)
>>
>> D15, is not marked as dead
>
> True. It should have had a REG_DEAD note. Are you using 4.6 (which
> scans forwards in peephole2 and requires REG_DEAD notes) or 4.5 (which
> scans backwards)? If the latter, the absence of the note could be a red
> herring, because 4.5 didn't need REG_DEAD notes so it didn't compute them.
It is a target port of 4.5.1. I just skimmed peep2_reg_dead_p and it looks
backward. So this function will never see that D15 dies and report D15 as alive.
> What's your definition of CALL_USED_REGISTERS,
> CALL_REALLY_USED_REGISTERS, EPILOGUE_USES? Is d15 in any of them?
D15 is not an element of any of them. D15 is call-saved and will get restored in
the RET-instruction of the callee which is tail-called in this particular case.
But even if f is not being tail-called D15 is not reported as dead. In that case
the insns after the call are (D2 is the return register, returning 1+f(...))
(insn 17 12 20 2 peep2.c:11 (set (reg/i:SI 2 d2)
(plus:SI (reg:SI 2 d2)
(const_int 1 [0x1]))) 6 {*addsi3} (nil))
(insn 20 17 28 2 peep2.c:11 (use (reg/i:SI 2 d2)) -1 (nil))
(jump_insn 29 28 30 2 peep2.c:11 (return) -1 (nil))
(barrier 30 29 23)
As far as 4.6 is concerned, I have not tried it yet. I do not know how stable
the releases are and how much work it is to switch from 4.5 to 4.6.
Georg Lay