X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCcse.c;h=fb96762c03899966b3a6846f7861ce34f1456e97;hb=2817542c3072299402d4a58a77541779c1baa1b6;hp=456db5121be50cd3eef6a068f2285b2999c3e201;hpb=a8bd79f0b8619a3d1773c58c623888d2e2fe7c22;p=fw%2Fsdcc diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 456db512..fb96762c 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 (!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 (!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 */ /*-----------------------------------------------------------------*/ @@ -1123,7 +1124,7 @@ constFold (iCode * ic, set * cseSet) if (IS_ITEMP (IC_RESULT (ic))) { SPIL_LOC (IC_RESULT (ic)) = NULL; - IC_RESULT (ic)->noSpilLoc = 1; + OP_SYMBOL(IC_RESULT (ic))->noSpilLoc = 1; } @@ -1400,7 +1401,7 @@ cseBBlock (eBBlock * ebb, int computeOnly, { /* update the spill location for this */ - updateSpillLocation (ic); + updateSpillLocation (ic,0); if (POINTER_SET (ic) && !(IS_BITFIELD (OP_SYMBOL (IC_RESULT (ic))->etype)))