On Sun, Aug 10, 2014 at 11:33 PM, Prathamesh Kulkarni <bilbotheelffri...@gmail.com> wrote: > Should we CSE result-op (if result-op is not c_expr) ?
I think that's a premature optimization at this point. Richard. > for example: > > match-op1 -> result-op1 > match-op2 -> result-op1 > > we generate code as: > match-op1 > result-op1 > > match-op2 > result-op1 > > instead generate: > match-op1 > goto l1; > > match-op2 > goto l1; > > l1: > result-op1 > > In general, for patterns. > match-op1 -> result-op1, > match-op2 -> result-op2 .. > > generate code as: > match-op1 > goto l1 > > match-op2 > goto l2 > > l1: result-op1 > l2: result-op2 > > We would need to compare AST's for this. Not sure how to do it > for c_expr. Maybe lexicographically compare tokens by > comparing c_expr::code of both c_expr's ? > > Thanks, > Prathamesh