llvm-gbz80 icon indicating copy to clipboard operation
llvm-gbz80 copied to clipboard

Fix commutation

Open Bevinsky opened this issue 6 years ago • 0 comments

Case example:

U8 sum8_2(U8 *p) {
  U8 s = 0;
  do {
    s += *p;
  } while (*p++ != 0);
  return s;
}

This has an issue with commutation where it's clear that we want to commute the ADD8r in the loop after regalloc, but not before (when twoaddr commutation is done).

It's possible that if we can solve the regalloc issue with clobbering A, it might make this better, but we should definitely improve commutation as well.

Bevinsky avatar Oct 14 '18 14:10 Bevinsky