this code:
u32 vert_timer;
while (1) {
vert_timer++;
WaitForVBlank();
}
becomes after optimization:
-> vert_timer++;
__local_0:
lda.w vert_timer + 0
sta.b tcc__r0
lda.w vert_timer + 2
sta.b tcc__r1
lda.b tcc__r1h
lda.b tcc__r0
lda.b tcc__r0h
lda.w #1
sta.b tcc__r4
lda.w #0
sta.b tcc__r5
clc
lda.b tcc__r0
adc.b tcc__r4
sta.b tcc__r0
lda.b tcc__r1
adc.b tcc__r5
sta.b tcc__r1
lda.b tcc__r0
sta.w vert_timer + 0
lda.b tcc__r1
sta.w vert_timer + 2
-> call WaitForVBlank
And before optimization:
__local_0:
lda.l vert_timer + 0
sta.b tcc__r0
lda.l vert_timer + 2
sta.b tcc__r1
lda.b tcc__r1
sta.b tcc__r2
lda.b tcc__r1h
sta.b tcc__r2h
lda.b tcc__r0
sta.b tcc__r3
lda.b tcc__r0h
sta.b tcc__r3h
lda.w #1
sta.b tcc__r4
lda.w #0
sta.b tcc__r5
clc
lda.b tcc__r0
adc.b tcc__r4
sta.b tcc__r0
lda.b tcc__r1
adc.b tcc__r5
sta.b tcc__r1
lda.b tcc__r0
sta.l vert_timer + 0
lda.b tcc__r1
sta.l vert_timer + 2
It seems that the part
lda.b tcc__r1
sta.b tcc__r2
lda.b tcc__r1h
sta.b tcc__r2h
lda.b tcc__r0
sta.b tcc__r3
lda.b tcc__r0h
sta.b tcc__r3h
which is useless, is transformed in
lda.b tcc__r1h
lda.b tcc__r0
lda.b tcc__r0h
I don't know where in 816-opt/optimizer.c it is located, but I think we have a way to update the u32 management
this code:
becomes after optimization:
And before optimization:
It seems that the part
which is useless, is transformed in
I don't know where in 816-opt/optimizer.c it is located, but I think we have a way to update the u32 management