On 06/09/12 09:33, Bin Cheng wrote:
>>>
>>> Yes, it may be feasible to rewrite the instruction in machine reorg
>>> pass, rather than peephole2. But that need bigger change in ARM back
> end.
>>> Hi Ramana, Richard, what's your opinion on this?
>>>
>>> Thanks very much.
>>>
>>>
>>
>> I side with Richard on this one. The mid-end should only have to deal
> with
>> RTL that's in canonical form.
>>
> So how about rewrite mov insn into sub in machine reorg pass and remove the
> current peeophole2 codes?
>
> Thanks
>
>
I think you should keep a peephole that transforms
X := Y
cbranch (cmp (Y, 0) tgt)
into
X := Y
cbranch (cmp (X, 0) tgt)
since that gives you a dataflow dependency between the two patterns that
is easier to track.
Once you've got that the mdreorg can track the dataflow and transform
the mov into a sub.
R.