(sdcc) optimizing for code size

New features and project activity between releases
Post Reply
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

(sdcc) optimizing for code size

Post by alvin »

Starting with the May 20 build, using --opt-code-size on the compile line will significantly reduce the size of programs using 64-bit integers.

Normally opt-code-size does two things: every function's preamble calls a subroutine to set up its frame pointer and the compiler chooses to use small code to clear up the stack after function calls. These two things reduce code size by a small amount.

This change now allows us to pursue other code size optimizations. There are still gains to be had with 64-bit integer programs but there is also the possibility to reduce code size of programs containing 32-bit integers in the future.

The windows nightly build and the mac nightly build will come with updated zsdcc binaries. Other users will have to recompile zsdcc using an updated patch to make use of this feature.

Details for compiling zsdcc from source are available from the usual location: http://www.z88dk.org/wiki/doku.php?id=temp:front#sdcc1
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

In the June 4 build, bugfixes affecting --opt-code-size and 64-bit integers when using the sdcc_iy library have been applied. The sdcc_iy library builds with the IX/IY registers swapped in source and this was overlooked when the 64-bit subroutines were written - they continued to index using ix when they should have been indexing from iy when sdcc_iy was selected.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Starting with the August 11 build, --opt-code-size will attempt to reduce binary sizes of programs using many longs and floats. Test compiles have shown a size reduction of 10% in such programs.

The changes require sdcc to be re-built with a new patch, available from the same place: http://www.z88dk.org/wiki/doku.php?id=temp:front#sdcc1
Windows and OS X users can simply download a new nightly build which will include the sdcc binaries.
Post Reply