From: sandeep Date: Thu, 15 Nov 2001 22:49:57 +0000 (+0000) Subject: improved heuristics for spilling X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=52afdbe479c0dfeca5bb872c9935a30e3e4b46dd;p=fw%2Fsdcc improved heuristics for spilling git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1598 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/pic/ralloc.c b/src/pic/ralloc.c index 95c75778..4fc0b827 100644 --- a/src/pic/ralloc.c +++ b/src/pic/ralloc.c @@ -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; + } } } } diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index 93a29153..936d8b77 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -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; + } } } }