* src/mcs51/ralloc.c (isSpiltOnStack): fixed bug 1565152
[fw/sdcc] / src / mcs51 / ralloc.c
index d4d3ad42160229eccca7d57a03a6a7e27a63adb7..7ce56c40ef12f5b00a537322d9a74c453ff9e2d6 100644 (file)
@@ -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);
         }
     }