improved heuristics for spilling
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 22:49:57 +0000 (22:49 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 15 Nov 2001 22:49:57 +0000 (22:49 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1598 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/pic/ralloc.c
src/z80/ralloc.c

index 95c75778a00e2adf6b699b24f5b52c12c2ab9c14..4fc0b827658410779624924f13aee0279c9f7afa 100644 (file)
@@ -1611,8 +1611,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;
+                           }
                        }
                    }
                }
index 93a2915394489d158823ec917d6aa324956c332d..936d8b77f96efb93367ae19cc01074ad7d352e59 100644 (file)
@@ -1143,8 +1143,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)) {
+                                 /* 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;
+                                 }
                              }
                      }
              }