I found locations, where inefficient code has been generated.
This always occurs, if a variable need to be incremented or decremented, e.g.
"ev++;".
The generated code increments the memory using registers, but then decrements the registers again. That is useful for comparisons based on that variable, e. g.
"if (ev++) ..."
but wastes time (and space) if only increment is needed. The generated is e. g.
Code: Select all
; debug_delay_calls++;
C_LINE 211,"MidiPlayer.c"
C_LINE 211,"MidiPlayer.c"
ld hl,(_debug_delay_calls)
inc hl
ld (_debug_delay_calls),hl
dec hl
So I did some optimations by using the generated assembler code in my C program (getting more and more ugly) and optimized it by hand.
Is there any compiler option available to avoid this?
Siggi