initial import of tinibios
[fw/sdcc] / src / z80 / ralloc.c
index 75127f84b3fb7d8fec6f7284f892e5b0db1be527..540b3a16a6e784b71cfa7a4dd9082f101ba45b08 100644 (file)
@@ -461,7 +461,7 @@ symbol *createStackSpil (symbol *sym)
 /*-----------------------------------------------------------------*/
 bool isSpiltOnStack (symbol *sym)
 {
-    link *etype;
+    sym_link *etype;
 
     if (!sym)
        return FALSE ;
@@ -569,11 +569,13 @@ symbol *selectSpil (iCode *ic, eBBlock *ebp, symbol *forSym)
           used in the remainder of the block */
        if (!blockSpil && (selectS = liveRangesWith(lrcs,notUsedInRemaining,ebp,ic))) {
            sym = leastUsedLR (selectS);
-           if (!sym->remat) {
-               sym->remainSpil = 1;
-               blockSpil++;
+           if (sym != ForSym) {
+               if (!sym->remat) {
+                   sym->remainSpil = 1;
+                   blockSpil++;
+               }
+               return sym;
            }
-           return sym;
        }
     }
     /* find live ranges with spillocation && not used as pointers */
@@ -789,7 +791,7 @@ static void deassignLRs (iCode *ic, eBBlock *ebp)
                ((nfreeRegsType(result->regType) +
                  sym->nRegs) >= result->nRegs)
                ) {
-               for (i = 0 ; i < max(sym->nRegs,result->nRegs) ; i++) {
+               for (i = 0 ; i < result->nRegs ; i++) {
                    if (i < sym->nRegs )
                        result->regs[i] = sym->regs[i] ;
                    else
@@ -1651,7 +1653,7 @@ static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp)
 /*-----------------------------------------------------------------*/
 static bool isBitwiseOptimizable (iCode *ic)
 {
-    link *rtype = getSpec(operandType(IC_RIGHT(ic)));
+    sym_link *rtype = getSpec(operandType(IC_RIGHT(ic)));
 
     /* bitwise operations are considered optimizable
        under the following conditions (Jean-Louis VERN)