X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Favr%2Fralloc.c;h=9f0ab65b28613f89fce0f1188a9bcc8cab5ad371;hb=32f9d7bd4da99c9837bc529a8d847c7c0d873684;hp=fce0f8024b6719639408598889601acee6eaf825;hpb=3e896c0ba619568082bc9e952265022cad9fe911;p=fw%2Fsdcc diff --git a/src/avr/ralloc.c b/src/avr/ralloc.c index fce0f802..9f0ab65b 100644 --- a/src/avr/ralloc.c +++ b/src/avr/ralloc.c @@ -901,7 +901,8 @@ selectSpil (iCode * ic, eBBlock * ebp, symbol * forSym) /* check if there are any live ranges that not used in the remainder of the block */ if (!_G.blockSpil && - (selectS = + !isiCodeInFunctionCall (ic) && + (selectS = liveRangesWith (lrcs, notUsedInRemaining, ebp, ic))) { sym = leastUsedLR (selectS); if (sym != forSym) { @@ -1163,6 +1164,7 @@ deassignLRs (iCode * ic, eBBlock * ebp) (result = OP_SYMBOL (IC_RESULT (ic))) && /* has a result */ result->liveTo > ic->seq && /* and will live beyond this */ result->liveTo <= ebp->lSeq && /* does not go beyond this block */ + result->liveFrom == ic->seq && /* does not start before here */ result->regType == sym->regType && /* same register types */ result->nRegs && /* which needs registers */ !result->isspilt && /* and does not already have them */ @@ -1363,6 +1365,12 @@ serialRegAssign (eBBlock ** ebbs, int count) int willCS; int j=0; + /* Make sure any spill location is definately allocated */ + if (sym->isspilt && !sym->remat && sym->usl.spillLoc && + !sym->usl.spillLoc->allocreq) { + sym->usl.spillLoc->allocreq++; + } + /* if it does not need or is spilt or is already assigned to registers or will not live beyond this instructions */ @@ -2228,8 +2236,10 @@ setDefaultRegs (eBBlock ** ebbs, int count) /* assignRegisters - assigns registers to each live range as need */ /*-----------------------------------------------------------------*/ void -avr_assignRegisters (eBBlock ** ebbs, int count) +avr_assignRegisters (ebbIndex * ebbi) { + eBBlock ** ebbs = ebbi->bbOrder; + int count = ebbi->count; iCode *ic; int i; @@ -2246,7 +2256,7 @@ avr_assignRegisters (eBBlock ** ebbs, int count) recomputeLiveRanges (ebbs, count); if (options.dump_pack) - dumpEbbsToFileExt (DUMP_PACK, ebbs, count); + dumpEbbsToFileExt (DUMP_PACK, ebbi); /* first determine for each live range the number of registers & the type of registers required for each */ @@ -2279,7 +2289,7 @@ avr_assignRegisters (eBBlock ** ebbs, int count) redoStackOffsets (); if (options.dump_rassgn) - dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count); + dumpEbbsToFileExt (DUMP_RASSGN, ebbi); /* now get back the chain */ ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));