fixed bug #845089
[fw/sdcc] / src / avr / ralloc.c
index 6efc4aedf2f214354b96f5ecd448c6ee42cd1b2e..abecd394c9a2efde31e97fec66b23eb669e6b98c 100644 (file)
@@ -549,31 +549,6 @@ nfreeRegsType (int type)
        return nFreeRegs (type);
 }
 
-
-/*-----------------------------------------------------------------*/
-/* allDefsOutOfRange - all definitions are out of a range          */
-/*-----------------------------------------------------------------*/
-static bool
-allDefsOutOfRange (bitVect * defs, int fseq, int toseq)
-{
-       int i;
-
-       if (!defs)
-               return TRUE;
-
-       for (i = 0; i < defs->size; i++) {
-               iCode *ic;
-
-               if (bitVectBitValue (defs, i) &&
-                   (ic = hTabItemWithKey (iCodehTab, i)) &&
-                   (ic->seq >= fseq && ic->seq <= toseq))
-
-                       return FALSE;
-       }
-
-       return TRUE;
-}
-
 /*-----------------------------------------------------------------*/
 /* computeSpillable - given a point find the spillable live ranges */
 /*-----------------------------------------------------------------*/
@@ -635,16 +610,6 @@ rematable (symbol * sym, eBBlock * ebp, iCode * ic)
        return sym->remat;
 }
 
-/*-----------------------------------------------------------------*/
-/* notUsedInBlock - not used in this block                         */
-/*-----------------------------------------------------------------*/
-static int
-notUsedInBlock (symbol * sym, eBBlock * ebp, iCode * ic)
-{
-       return (!bitVectBitsInCommon (sym->defs, ebp->usesDefs) &&
-               allDefsOutOfRange (sym->defs, ebp->fSeq, ebp->lSeq));
-}
-
 /*-----------------------------------------------------------------*/
 /* notUsedInRemaining - not used or defined in remain of the block */
 /*-----------------------------------------------------------------*/
@@ -727,7 +692,7 @@ leastUsedLR (set * sset)
 
        }
 
-       setToNull ((void **) &sset);
+       setToNull ((void *) &sset);
        sym->blockSpil = 0;
        return sym;
 }
@@ -2265,6 +2230,10 @@ avr_assignRegisters (eBBlock ** ebbs, int count)
        for (i = 0; i < count; i++)
                packRegisters (ebbs[i]);
 
+       /* liveranges probably changed by register packing
+          so we compute them again */
+       recomputeLiveRanges (ebbs, count);
+
        if (options.dump_pack)
                dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
 
@@ -2311,8 +2280,8 @@ avr_assignRegisters (eBBlock ** ebbs, int count)
        /* free up any _G.stackSpil locations allocated */
        applyToSet (_G.stackSpil, deallocStackSpil);
        _G.slocNum = 0;
-       setToNull ((void **) &_G.stackSpil);
-       setToNull ((void **) &_G.spiltSet);
+       setToNull ((void *) &_G.stackSpil);
+       setToNull ((void *) &_G.spiltSet);
        /* mark all registers as free */
 
        return;