]> git.gag.com Git - fw/sdcc/commitdiff
a) fixed genAddrOf bug for parameters
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 22:49:21 +0000 (22:49 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 22:49:21 +0000 (22:49 +0000)
b) improved heuristics for spilling

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1597 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/gen.c
src/mcs51/ralloc.c

index 1b6b61499ff88ed42d3f0011bce5ae6cd241f959..26ffca96098a23ace98bfdecba87f9d0a797d3a7 100644 (file)
@@ -8180,7 +8180,9 @@ genAddrOf (iCode * ic)
       if (sym->stack)
        {
          emitcode ("mov", "a,_bp");
-         emitcode ("add", "a,#0x%02x", ((char) sym->stack & 0xff));
+         emitcode ("add", "a,#0x%02x", ((sym->stack < 0) ?
+                                        ((char) (sym->stack - _G.nRegsSaved)) :
+                                        ((char) sym->stack)) & 0xff);
          aopPut (AOP (IC_RESULT (ic)), "a", 0);
        }
       else
index 5f2dd4669c3fd0ca379fbf861eef3eb6abe7c1fc..df7f665775d98d95faaf7228c35e920680b5dc7c 100644 (file)
@@ -1158,8 +1158,11 @@ serialRegAssign (eBBlock ** ebbs, int count)
                        /* if none of the liveRanges have a spillLocation then better
                           to spill this one than anything else already assigned to registers */
                        if (liveRangesWith(spillable,noSpilLoc,ebbs[i],ic)) {
-                           spillThis (sym);
-                           continue;
+                           /* if this is local to this block then we might find a block spil */
+                           if (!(sym->liveFrom >= ebbs[i]->fSeq && sym->liveTo <= ebbs[i]->lSeq)) {
+                               spillThis (sym);
+                               continue;
+                           }
                        }
                    }
                }