X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fhc08%2Fralloc.c;h=2c40c925ee4f206d5a715b4582a9200467adb2c1;hb=aa0ca082f440cf7b9cf126faf97e03fbbf0c0bc2;hp=fdb71ba6422a3db1db57868927702abad57ecd63;hpb=7860ea6460151466a37ba9471227ff59d7c95ab6;p=fw%2Fsdcc diff --git a/src/hc08/ralloc.c b/src/hc08/ralloc.c index fdb71ba6..2c40c925 100644 --- a/src/hc08/ralloc.c +++ b/src/hc08/ralloc.c @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------ - SDCCralloc.c - source file for register allocation. (8051) specific + SDCCralloc.c - source file for register allocation. 68HC08 specific Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998) @@ -655,7 +655,7 @@ spillThis (symbol * sym) if (!(sym->remat || sym->usl.spillLoc)) createStackSpil (sym); - /* mark it has spilt & put it in the spilt set */ + /* mark it as spilt & put it in the spilt set */ sym->isspilt = sym->spillA = 1; _G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key); @@ -738,7 +738,9 @@ 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 = liveRangesWith (lrcs, notUsedInRemaining, ebp, ic))) + if (!_G.blockSpil && + !isiCodeInFunctionCall (ic) && + (selectS = liveRangesWith (lrcs, notUsedInRemaining, ebp, ic))) { sym = leastUsedLR (selectS); if (sym != forSym) @@ -1263,7 +1265,13 @@ serialRegAssign (eBBlock ** ebbs, int count) int j; int ptrRegSet = 0; - /* if it does not need or is spilt + /* 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 */ if (!sym->nRegs || @@ -1414,7 +1422,7 @@ static void fillGaps() if (getenv("DISABLE_FILL_GAPS")) return; - /* look for livernages that was spilt by the allocator */ + /* look for liveranges that were spilt by the allocator */ for (sym = hTabFirstItem(liveRanges,&key) ; sym ; sym = hTabNextItem(liveRanges,&key)) { @@ -1945,7 +1953,6 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) return 0; } - /* if the true symbol is defined in far space or on stack then we should not since this will increase register pressure */ #if 0 @@ -2020,16 +2027,18 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) return 0; /* did not find */ /* if assignment then check that right is not a bit */ - if (ASSIGNMENT (dic) && !POINTER_SET (dic)) + if (ASSIGNMENT (ic) && !POINTER_SET (ic)) { - sym_link *etype = operandType (IC_RIGHT (dic)); + sym_link *etype = operandType (IC_RESULT (dic)); if (IS_BITFIELD (etype)) { /* if result is a bit too then it's ok */ - etype = operandType (IC_RESULT (dic)); + etype = operandType (IC_RESULT (ic)); if (!IS_BITFIELD (etype)) - return 0; - } + { + return 0; + } + } } /* if the result is on stack or iaccess then it must be the same atleast one of the operands */ @@ -3047,8 +3056,10 @@ packRegisters (eBBlock ** ebpp, int blockno) /* assignRegisters - assigns registers to each live range as need */ /*-----------------------------------------------------------------*/ void -hc08_assignRegisters (eBBlock ** ebbs, int count) +hc08_assignRegisters (ebbIndex * ebbi) { + eBBlock ** ebbs = ebbi->bbOrder; + int count = ebbi->count; iCode *ic; int i; @@ -3075,7 +3086,7 @@ hc08_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 */ @@ -3115,7 +3126,7 @@ hc08_assignRegisters (eBBlock ** ebbs, int count) if (options.dump_rassgn) { - dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count); + dumpEbbsToFileExt (DUMP_RASSGN, ebbi); dumpLiveRanges (DUMP_LRANGE, liveRanges); }