* src/mcs51/gen.c (pushSide, genPcall): fixed bug 1908493
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 8 Mar 2008 12:31:42 +0000 (12:31 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 8 Mar 2008 12:31:42 +0000 (12:31 +0000)
* 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
src/SDCCmain.c
src/mcs51/gen.c

index b1302b643b9d7645040ccc1d6f42db04998075d7..ecf2f9eaa838b91c9f1a218d96d80ceb94b6e934 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-08 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * 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 <rneider AT web.de>
 
        * src/regression/init0.c: new test for initialized arrays of function
@@ -13,7 +19,7 @@
 
 2008-03-05 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
-       * 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 <Frieder.Ferlemann AT web.de>
index fd52d5920beb95903d9167125226e85b8c49c391..ec234ecb2713f200424ec341d73b980ac2b4148b 100644 (file)
@@ -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];
index 005e6c1e2cd91f77fe5bcf25bd1eb29982836dcf..68f8524cc0b5d1c7ddf5f5d951c501d324d32082 100644 (file)
@@ -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));