From 5bfc307cd6aadf3af01a40e3242ccca56a9dd0a5 Mon Sep 17 00:00:00 2001 From: sandeep Date: Thu, 15 Nov 2001 22:49:21 +0000 Subject: [PATCH] a) fixed genAddrOf bug for parameters 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 | 4 +++- src/mcs51/ralloc.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 1b6b6149..26ffca96 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -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 diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 5f2dd466..df7f6657 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -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; + } } } } -- 2.47.2