From: SourceForge.net <no...@so...> - 2012-06-29 21:05:59
|
Bugs item #3538844, was opened at 2012-06-28 16:33 Message generated for change (Comment added) made by chastai You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3538844&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: z80 port Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: https://www.google.com/accounts () Assigned to: Philipp Klaus Krause (spth) Summary: --reserve-regs-iy not working Initial Comment: Generated assembly still appears to use IY even when --reserve-regs-iy is passed. Command: sdcc -mz80 --reserve-regs-iy -L ./sdcc/lib/z80 main.c Version: 3.2.0 #7971 (Jun 26 2012) (Mac OS X i386) Here is part of the generated main.asm: ;main.c:2: return 8 - (a / 8); ld iy,#2 add iy,sp ld d,0 (iy) bit 7, d jr Z,00103$ ld a,d add a, #0x07 ld d,a ---------------------------------------------------------------------- Comment By: Christophe Staïesse (chastai) Date: 2012-06-29 14:05 Message: Thanks for the fix! It works better but there is still at least a case where IY is used : After some experiments, I've noticed that IY is used to clean up the stack when calling a function where -the sum of the sizes of the parameters are at least 9 bytes (i.e. f(int,int,int,int,char) or f(long long, char), ...) -the return type is integer -the return value is used by the callee. example : extern f(char a, char b, char c, char d, char e, char f, char g, char h, char i); main() { f(1,2,3,4,5,6,7,8,9); /* the return value in HL is ignored -> HL is selected to clean up the call stack */ return f(1,2,3,4,5,6,7,8,9); /* the return value in HL is used -> IY is selected to clean up the stack */ } In the library this bug affects _divslonglong.c, _divulonglong.c, _rlslonglong. Christophe. ---------------------------------------------------------------------- Comment By: Philipp Klaus Krause (spth) Date: 2012-06-29 01:47 Message: I thought I had fixed this when I fixed #3536902 . Unfortunately, it seems there's no time left before the release, but I'll fix it after that. The fix is simple: Change line 1472 in src/z80/alloc2.cc from "if(IS_GB)" to "if(IS_GB || IY_RESERVED)". Philipp P.S.:The fix is only sufficient for functions that have at most 126 bytes of parameters and at most 127 bytes of local variables. Other functions will still use iy. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3538844&group_id=599 |