Should we CSE result-op (if result-op is not c_expr) ?

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

Reply via email to