X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fmcs51%2Fralloc.c;h=2a627aade38fade32b735d965faa979edbcdd4f7;hb=05e1b5ab697301a5fc525957cee1a9c7837f99c4;hp=d4d3ad42160229eccca7d57a03a6a7e27a63adb7;hpb=9e3df070c8022aa20b3761a9d213a185eb27ed99;p=fw%2Fsdcc diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index d4d3ad42..2a627aad 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -578,6 +578,7 @@ createStackSpil (symbol * sym) /*-----------------------------------------------------------------*/ /* isSpiltOnStack - returns true if the spil location is on stack */ +/* or otherwise needs a pointer register */ /*-----------------------------------------------------------------*/ static bool isSpiltOnStack (symbol * sym) @@ -596,6 +597,9 @@ isSpiltOnStack (symbol * sym) if (!sym->usl.spillLoc) return FALSE; + if (sym->usl.spillLoc->onStack || sym->usl.spillLoc->iaccess) + return TRUE; + etype = getSpec (sym->usl.spillLoc->type); if (IN_STACK (etype)) return TRUE; @@ -664,7 +668,7 @@ selectSpil (iCode * ic, eBBlock * ebp, symbol * forSym) selectS = liveRangesWith (lrcs, bitType, ebp, ic); for (sym = setFirstItem (selectS); sym; sym = setNextItem (selectS)) - { + { bitVectUnSetBit (lrcs, sym->key); } } @@ -1506,6 +1510,10 @@ static void fillGaps() if (!sym->spillA || !sym->clashes || sym->remat) continue ; + /* if spilt in direct space the original rname is lost */ + if (sym->usl.spillLoc && (IN_DIRSPACE (SPEC_OCLS (sym->usl.spillLoc->etype)))) + continue; + /* find the liveRanges this one clashes with, that are still assigned to registers & mark the registers as used*/ for ( i = 0 ; i < sym->clashes->size ; i ++) { @@ -3007,6 +3015,7 @@ packRegisters (eBBlock ** ebpp, int blockno) IS_SYMOP (IC_RIGHT (ic)) && OP_SYMBOL (IC_RIGHT (ic))->remat && !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) && + !isOperandGlobal(IC_RESULT(ic)) && /* due to bug 1618050 */ bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1) { OP_SYMBOL (IC_RESULT (ic))->remat = @@ -3221,7 +3230,7 @@ packRegisters (eBBlock ** ebpp, int blockno) /* pack registers for accumulator use, when the result of an arithmetic or bit wise operation has only one use, that use is immediately following - the defintion and the using iCode has only one + the definition and the using iCode has only one operand or has two operands but one is literal & the result of that operation is not on stack then we can leave the result of this operation in acc:b