From 15f79deb6cf094bc83de7ade9e272b1ebfd4f640 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 25 Aug 2001 23:26:12 +0000 Subject: [PATCH] fix for bug-453196 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1170 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCcse.c | 81 +++++++++++++++++++++++++------------------------- src/SDCCcse.h | 2 +- src/SDCCloop.c | 2 +- 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 8787bd48..ac5e66af 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -848,55 +848,56 @@ algebraicOpts (iCode * ic) /* updateSpillLocation - keeps track of register spill location */ /*-----------------------------------------------------------------*/ void -updateSpillLocation (iCode * ic) +updateSpillLocation (iCode * ic, int induction) { - sym_link *setype; + sym_link *setype; - if (POINTER_SET (ic)) - return; - - if (ic->nosupdate) - return; + if (POINTER_SET (ic)) + return; - /* for the form true_symbol := iTempNN */ - if (ASSIGN_ITEMP_TO_SYM (ic) - && !SPIL_LOC (IC_RIGHT (ic))) - { + if (ic->nosupdate) + return; - setype = getSpec (operandType (IC_RESULT (ic))); - - if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc && - !IS_VOLATILE (setype) && - !IN_FARSPACE (SPEC_OCLS (setype)) && - /* PENDING */ - !TARGET_IS_Z80 && - !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) - - SPIL_LOC (IC_RIGHT (ic)) = - IC_RESULT (ic)->operand.symOperand; - } + /* for the form true_symbol := iTempNN */ + if (ASSIGN_ITEMP_TO_SYM (ic) && + !SPIL_LOC (IC_RIGHT (ic))) { - if (ASSIGN_ITEMP_TO_ITEMP (ic) && - !SPIL_LOC (IC_RIGHT (ic)) && - !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) && - OP_SYMBOL (IC_RESULT (ic))->isreqv) - { + setype = getSpec (operandType (IC_RESULT (ic))); - setype = getSpec (operandType (IC_RESULT (ic))); + if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc && + !IS_VOLATILE (setype) && + !IN_FARSPACE (SPEC_OCLS (setype)) && + !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) - if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc && - !IS_VOLATILE (setype) && - !IN_FARSPACE (SPEC_OCLS (setype)) && - /* PENDING */ - !TARGET_IS_Z80 && - !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) + SPIL_LOC (IC_RIGHT (ic)) = + IC_RESULT (ic)->operand.symOperand; + } - SPIL_LOC (IC_RIGHT (ic)) = - SPIL_LOC (IC_RESULT (ic)); - } + if (ASSIGN_ITEMP_TO_ITEMP (ic)) { + + if (!SPIL_LOC (IC_RIGHT (ic)) && + !bitVectBitsInCommon (OP_DEFS (IC_RIGHT (ic)), OP_USES (IC_RESULT (ic))) && + OP_SYMBOL (IC_RESULT (ic))->isreqv) { + + setype = getSpec (operandType (IC_RESULT (ic))); + + if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc && + !IS_VOLATILE (setype) && + !IN_FARSPACE (SPEC_OCLS (setype)) && + !OTHERS_PARM (OP_SYMBOL (IC_RESULT (ic)))) + + SPIL_LOC (IC_RIGHT (ic)) = + SPIL_LOC (IC_RESULT (ic)); + } + /* special case for inductions */ + if (induction && + OP_SYMBOL(IC_RIGHT(ic))->isreqv && + !SPIL_LOC(IC_RESULT(ic))) { + SPIL_LOC (IC_RESULT (ic)) = SPIL_LOC (IC_RIGHT (ic)); + } + } } - /*-----------------------------------------------------------------*/ /* setUsesDef - sets the uses def bitvector for a given operand */ /*-----------------------------------------------------------------*/ @@ -1400,7 +1401,7 @@ cseBBlock (eBBlock * ebb, int computeOnly, { /* update the spill location for this */ - updateSpillLocation (ic); + updateSpillLocation (ic,1); if (POINTER_SET (ic) && !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype))) diff --git a/src/SDCCcse.h b/src/SDCCcse.h index 51bfb41c..5eaf9cf2 100644 --- a/src/SDCCcse.h +++ b/src/SDCCcse.h @@ -54,7 +54,7 @@ int cseBBlock (eBBlock *, int, eBBlock **, int); int cseAllBlocks (eBBlock **, int); void ifxOptimize (iCode *, set *, int, eBBlock *, int *, eBBlock **, int); void unsetDefsAndUses (iCode *); -void updateSpillLocation (iCode * ic); +void updateSpillLocation (iCode * ic,int); void setUsesDefs (operand *, bitVect *, bitVect *, bitVect **); void replaceAllSymBySym (iCode *, operand *, operand *, bitVect **); #endif diff --git a/src/SDCCloop.c b/src/SDCCloop.c index a50bac49..fc928630 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -46,7 +46,7 @@ newInduction (operand * sym, unsigned int op, ip->op = op; ip->cval = constVal; ip->ic = ic; - + updateSpillLocation(ic,1); return ip; } -- 2.30.2