register allocator should not do block spil if defined used
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 8 Mar 2000 02:19:18 +0000 (02:19 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 8 Mar 2000 02:19:18 +0000 (02:19 +0000)
or defined anywhere in the block

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@175 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/ralloc.c

index 4acaf3bf2fd4b1e9928234b4ee5f5ca279215e13..b2dff194df679f4b3a300b0fe2c96972ea9c122c 100644 (file)
@@ -272,7 +272,7 @@ static int notUsedInBlock (symbol *sym, eBBlock *ebp, iCode *ic)
 static int notUsedInRemaining (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return ((usedInRemaining (operandFromSymbol(sym),ic) ? 0 : 1) &&
-           allDefsOutOfRange (sym->defs,ic->seq,ebp->lSeq));
+           allDefsOutOfRange (sym->defs,ebp->fSeq,ebp->lSeq));
 }
 
 /*-----------------------------------------------------------------*/
@@ -609,8 +609,8 @@ static symbol *selectSpil (iCode *ic, eBBlock *ebp, symbol *forSym)
        return sym;
     }
 
-    /* if the symbol is local to the block then */        
-    if (forSym->liveTo < ebp->lSeq ) {       
+    /* if the symbol is local to the block then */
+    if (forSym->liveTo < ebp->lSeq) {       
 
        /* check if there are any live ranges allocated
           to registers that are not used in this block */
@@ -1568,6 +1568,7 @@ pack:
         
     remiCodeFromeBBlock(ebp,ic);
     hTabDeleteItem (&iCodehTab,ic->key,ic,DELETE_ITEM,NULL);
+    OP_DEFS(IC_RESULT(dic)) = bitVectSetBit(OP_DEFS(IC_RESULT(dic)),dic->key);
     return 1;
     
 }
@@ -2199,6 +2200,7 @@ static void packRegisters (eBBlock *ebp)
                        IC_RESULT(dic) = IC_RESULT(ic);
                        remiCodeFromeBBlock(ebp,ic);
                        hTabDeleteItem (&iCodehTab,ic->key,ic,DELETE_ITEM,NULL);
+                       OP_DEFS(IC_RESULT(dic)) = bitVectSetBit(OP_DEFS(IC_RESULT(dic)),dic->key);
                        ic = ic->prev;
                    } else
                        OP_SYMBOL(IC_RIGHT(ic))->ruonly =  0;
@@ -2214,6 +2216,7 @@ static void packRegisters (eBBlock *ebp)
                        IC_RESULT(dic) = IC_RESULT(ic);
                        remiCodeFromeBBlock(ebp,ic);
                        hTabDeleteItem (&iCodehTab,ic->key,ic,DELETE_ITEM,NULL);
+                       OP_DEFS(IC_RESULT(dic)) = bitVectSetBit(OP_DEFS(IC_RESULT(dic)),dic->key);
                        ic = ic->prev;
                    }
                }