Applied a code patch supplied by Paul Ashmore in comments for Bugs item #954788.
[fw/sdcc] / src / pic / ralloc.c
index cce44ed13110e3215e36af93362d89a52486836d..8768063076bde877b92e2202bf582b39ef62f1eb 100644 (file)
@@ -1800,7 +1800,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->remat)
@@ -2066,6 +2068,8 @@ deassignLRs (iCode * ic, eBBlock * ebp)
                                (result = OP_SYMBOL (IC_RESULT (ic))) &&        /* has a result */
                                result->liveTo > ic->seq &&     /* and will live beyond this */
                                result->liveTo <= ebp->lSeq &&  /* does not go beyond this block */
+                               result->liveFrom == ic->seq &&    /* does not start before here */
+                               result->regType == sym->regType &&      /* same register types */
                                result->regType == sym->regType &&      /* same register types */
                                result->nRegs &&        /* which needs registers */
                                !result->isspilt &&     /* and does not already have them */