From 52afdbe479c0dfeca5bb872c9935a30e3e4b46dd Mon Sep 17 00:00:00 2001 From: sandeep Date: Thu, 15 Nov 2001 22:49:57 +0000 Subject: [PATCH] improved heuristics for spilling git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1598 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/pic/ralloc.c | 7 +++++-- src/z80/ralloc.c | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) 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; + } } } } -- 2.47.2