* src/avr/ralloc.c (serialRegAssign),
[fw/sdcc] / src / ds390 / ralloc.c
index e75a587f0ac15910ed4913a3b5703817ff9e1092..627cc4756f95f04f7d4a9cdcc39a3ed8d1c88ae5 100644 (file)
@@ -685,7 +685,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)
@@ -1269,7 +1271,7 @@ serialRegAssign (eBBlock ** ebbs, int count)
 
       unusedLRs = deassignUnsedLRs(ebbs[i]);
 
-      /* of all instructions do */
+      /* for all instructions do */
       for (ic = ebbs[i]->sch; ic; ic = ic->next)
         {
 
@@ -1305,6 +1307,13 @@ serialRegAssign (eBBlock ** ebbs, int count)
               int willCS;
               int j;
               int ptrRegSet = 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
@@ -1323,6 +1332,16 @@ serialRegAssign (eBBlock ** ebbs, int count)
                   spillThis (sym);
                   continue;
                 }
+
+              /* if this is a bit variable then don't use precious registers
+                 along with expensive bit-to-char conversions but just spill
+                 it */
+              if (SPEC_NOUN(sym->etype) == V_BIT)
+                {
+                  spillThis (sym);
+                  continue;
+                }
+
               /* if trying to allocate this will cause
                  a spill and there is nothing to spill
                  or this one is rematerializable then