From eaa91096bbf4af190d0da62f7d85b353d6f67e67 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Sat, 8 Mar 2008 12:31:42 +0000 Subject: [PATCH] * src/mcs51/gen.c (pushSide, genPcall): fixed bug 1908493 * src/SDCCmain.c (preProcess): removed -DSDCC_PARMS_IN_BANK1 because it is already set in ds390/main.c and mcs51/main.c git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5075 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 +++++++- src/SDCCmain.c | 4 ---- src/mcs51/gen.c | 34 ++++++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1302b64..ecf2f9ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-08 Maarten Brock + + * src/mcs51/gen.c (pushSide, genPcall): fixed bug 1908493 + * src/SDCCmain.c (preProcess): removed -DSDCC_PARMS_IN_BANK1 because it is + already set in ds390/main.c and mcs51/main.c + 2008-03-07 Raphael Neider * src/regression/init0.c: new test for initialized arrays of function @@ -13,7 +19,7 @@ 2008-03-05 Jesus Calvino-Fraga - * support/librarian/sdcclib.c:Added feature request 1908061: + * support/librarian/sdcclib.c:Added feature request 1908061: Synchronise sdcclib commands with ar. 2008-03-04 Frieder Ferlemann diff --git a/src/SDCCmain.c b/src/SDCCmain.c index fd52d592..ec234ecb 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -2022,10 +2022,6 @@ preProcess (char **envp) if (options.float_rent) addSet(&preArgvSet, Safe_strdup("-DSDCC_FLOAT_REENT")); - /* set macro corresponding to compiler option */ - if (options.parms_in_bank1) - addSet(&preArgvSet, Safe_strdup("-DSDCC_PARMS_IN_BANK1")); - /* add SDCC version number */ { char buf[20]; diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 005e6c1e..68f8524c 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -1042,7 +1042,7 @@ aopOp (operand * op, iCode * ic, bool result) /*-----------------------------------------------------------------*/ /* freeAsmop - free up the asmop given to an operand */ -/*----------------------------------------------------------------*/ +/*-----------------------------------------------------------------*/ static void freeAsmop (operand * op, asmop * aaop, iCode * ic, bool pop) { @@ -2420,9 +2420,29 @@ unsaveRegisters (iCode * ic) /* pushSide - */ /*-----------------------------------------------------------------*/ static void -pushSide (operand * oper, int size) +pushSide (operand * oper, int size, iCode * ic) { int offset = 0; + int nPushed = _G.r0Pushed + _G.r1Pushed; + + aopOp (oper, ic, FALSE); + + if (nPushed != _G.r0Pushed + _G.r1Pushed) + { + while (offset < size) + { + char *l = aopGet (oper, offset, FALSE, TRUE); + emitcode ("mov", "%s,%s", fReturn[offset++], l); + } + freeAsmop (oper, NULL, ic, TRUE); + offset = 0; + while (offset < size) + { + emitcode ("push", "%s", fReturn[offset++]); + } + return; + } + while (size--) { char *l = aopGet (oper, offset++, FALSE, TRUE); @@ -2438,6 +2458,8 @@ pushSide (operand * oper, int size) emitcode ("push", "%s", l); } } + + freeAsmop (oper, NULL, ic, TRUE); } /*-----------------------------------------------------------------*/ @@ -3148,13 +3170,9 @@ genPcall (iCode * ic) emitcode ("push", "acc"); /* now push the calling address */ - aopOp (IC_LEFT (ic), ic, FALSE); - - pushSide (IC_LEFT (ic), FPTRSIZE); - - freeAsmop (IC_LEFT (ic), NULL, ic, TRUE); + pushSide (IC_LEFT (ic), FPTRSIZE, ic); - /* if send set is not empty the assign */ + /* if send set is not empty then assign */ if (_G.sendSet) { genSend(reverseSet(_G.sendSet)); -- 2.30.2