On Apr 27, 2011, at 3:15 PM, cirrus75 wrote:

> 
> Hello Ian,
> 
>  One example is:
> 
> insn X   : "REG_X     = <expression>"
> insn X+1 : "MEM(addr) = REG_X"
> insn X+2 : "REGY:CCmode compare(REG_X, const_int 0)"
> 
> generated by C code (already posted by me some weeks ago):
> ------
> 
> int a, b, c, d;
> 
> int foo()
> {
>  a += b;
> 
>  if(a)
>    c = d;
> }
> 
>  Insns X+2 and X can usually be combined because arithmetic operation
> usually sets condition codes.

I haven't gotten into this much yet, so at the risk of showing off confusion...

I thought that the CCmode stuff allows this to work right without new changes, 
given that the expressions that make up the RTL are written as (parallel ...) 
which set both the output reg and the CCmode reg (based on the expression 
value).  So the rtl for the first insn would have that compare as part of its 
parallel... construct, the second insn (presumably in your example) doesn't 
affect the condition codes register, and the third insn should then be deleted 
since it's redundant.

Doesn't it work like that?  Am I confused about the right way?

        paul


Reply via email to