llvm-gbz80
llvm-gbz80 copied to clipboard
Fix commutation
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.