z88dk forums

z80 Development Kit

You are not logged in.

#1 2016-01-22 05:43:53

alvin
Administrator
Registered: 2007-07-16
Posts: 1522

Improved SDCC Compiles

A patch has been applied to z88dk's version of sdcc to make the peephole optimizer able to exactly determine register reference in instructions.  In the current sdcc, hex constants and label names can sometimes be erroneously searched for register names which can affect whether peephole rules are applied or not.  A fix in sdcc itself probably won't come until after its next release.

You can update your zsdcc executable in the usual way:  http://www.z88dk.org/wiki/doku.php?id=temp:front#sdcc1

Also included in that package is an updated rules set.  This rules set is regularly improved as we check the quality of code generated for test programs.  The readme describes where it should be copied to.

Offline

 

#2 2016-01-23 06:17:24

alvin
Administrator
Registered: 2007-07-16
Posts: 1522

Re: Improved SDCC Compiles

A code generation error in sdcc was discovered and is being fixed with new peephole rules.

The error affects code in the form "a = (b->c, b);" with "--reserve-regs-iy" applied on the compile line.

Grab an updated version of the peephole rules from the package above to fix the problem.  In general it's a good idea to download the package periodically to apply updates that fix issues as they are discovered.

Offline

 

#3 2016-01-27 20:40:00

alvin
Administrator
Registered: 2007-07-16
Posts: 1522

Re: Improved SDCC Compiles

sdcc has introduced a preserves_reg() decoration for functions implemented in assembly language.  This decoration informs the compiler which registers remain unchanged by called functions.

Starting with the Jan 28 build, all functions in the new c lib will have a preserves_reg() attribute attached for sdcc.  The result is being tested and, at minimum, it is expected that new code patterns might show up in the generated code that are not served by the current peephole set.  In other words, code may sometimes be a bit bigger and a bit slower until the peephole rules have been revisited with the test set.  At worst, bugs may have been introduced.

The Jan 27 build can be used as the last before this change.

Offline

 

#4 2016-01-31 23:40:59

alvin
Administrator
Registered: 2007-07-16
Posts: 1522

Re: Improved SDCC Compiles

Preserves_regs() has been added to all library functions and test compiles seem to be fine; changes are available in the Feb 1 build.

In addition to the usual update of files in http://z88dk.cvs.sourceforge.net/viewvc … _patch.zip , the header files need updating so that preserves_regs() appears with the function prototypes.  You can do that by updating your current install via the nightly build or by copying the header files out of the nightly build from dir z88dk/include/_DEVELOPMENT/sdcc/.  sdcc will still work without updating the headers.

Also introduced are a few intrinsics in "intrinsic.h" as described in the wiki http://www.z88dk.org/wiki/doku.php?id=libnew:intrinsic .  Inlined assembly normally interferes with sdcc's peephole optimization so intrinsics for selected z80 instruction have been introduced to allow inlining asm without affecting optimization.  This is especially useful for commonly inlined instructions like "di", "ei", "halt" and so on.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson