From 2b7de736e0cf8462af6677b920d673a3f1bbbf08 Mon Sep 17 00:00:00 2001 From: johanknol Date: Sat, 17 Nov 2001 16:17:16 +0000 Subject: [PATCH] prelimanary fix for bug #480076 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1610 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/mcs51/ralloc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 5d679226..0eb8a3b8 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1400,7 +1400,7 @@ rematStr (symbol * sym) /* regTypeNum - computes the type & number of registers required */ /*-----------------------------------------------------------------*/ static void -regTypeNum () +regTypeNum (eBBlock *ebbs) { symbol *sym; int k; @@ -1452,7 +1452,6 @@ regTypeNum () !IS_CAST_ICODE(OP_SYMBOL (IC_LEFT (ic))->rematiCode) && DCL_TYPE (aggrToPtr (sym->type, FALSE)) == POINTER) { - /* create a psuedo symbol & force a spil */ symbol *psym = newSymbol (rematStr (OP_SYMBOL (IC_LEFT (ic))), 1); psym->type = sym->type; @@ -1460,6 +1459,16 @@ regTypeNum () strcpy (psym->rname, psym->name); sym->isspilt = 1; sym->usl.spillLoc = psym; +#if 0 // an alternative fix for bug #480076 + /* now this is a useless assignment to itself */ + remiCodeFromeBBlock (ebbs, ic); +#else + /* now this really is an assignment to itself, make it so; + it will be optimized out later */ + ic->op='='; + IC_RIGHT(ic)=IC_RESULT(ic); + IC_LEFT(ic)=NULL; +#endif continue; } @@ -2527,7 +2536,7 @@ mcs51_assignRegisters (eBBlock ** ebbs, int count) /* first determine for each live range the number of registers & the type of registers required for each */ - regTypeNum (); + regTypeNum (*ebbs); /* and serially allocate registers */ serialRegAssign (ebbs, count); -- 2.47.2