]> git.gag.com Git - fw/sdcc/blobdiff - src/z80/ralloc.c
2001-10-21 Michael Hope <michaelh@juju.net.nz>
[fw/sdcc] / src / z80 / ralloc.c
index ac7fe0e7ecb8f5af7af98b7a5f373154cf97ea7f..bc1c337e98af9f7ed13a3c2ab9ab3af07b0b069b 100644 (file)
@@ -51,7 +51,8 @@ enum
   {
     DISABLE_PACK_ACC = 0,
     DISABLE_PACK_ASSIGN = 0,
-    DISABLE_PACK_ONE_USE = 0,
+    /* Pack for one use is quite broken. */
+    DISABLE_PACK_ONE_USE = 1,
     DISABLE_PACK_HL = 0,
   };
 
@@ -2035,6 +2036,8 @@ packRegsForHLUse (iCode * ic)
   if (ic->next != uic)
     return;
 
+  if (ic->op == CAST && uic->op == IPUSH)
+    goto hluse;
   if (ic->op == ADDRESS_OF && uic->op == IPUSH)
     goto hluse;
   if (ic->op == CALL && ic->parmBytes == 0 && (uic->op == '-' || uic->op == '+'))
@@ -2483,14 +2486,6 @@ packRegisters (eBBlock * ebp)
        packRegsForSupport (ic, ebp);
 #endif
 
-#if 0
-      /* some cases the redundant moves can
-         can be eliminated for return statements */
-      if ((ic->op == RETURN || ic->op == SEND) &&
-         !isOperandInFarSpace (IC_LEFT (ic)) &&
-         !options.model)
-       packRegsForOneuse (ic, IC_LEFT (ic), ebp);
-#endif
       /* if pointer set & left has a size more than
          one and right is not in far space */
       if (!DISABLE_PACK_ONE_USE &&
@@ -2517,6 +2512,7 @@ packRegisters (eBBlock * ebp)
 
          packRegsForOneuse (ic, IC_LEFT (ic), ebp);
        }
+
       /* pack registers for accumulator use, when the result of an
          arithmetic or bit wise operation has only one use, that use is
          immediately following the defintion and the using iCode has
@@ -2528,21 +2524,12 @@ packRegisters (eBBlock * ebp)
        {
          packRegsForHLUse (ic);
        }
-#if 0
-      if ((IS_ARITHMETIC_OP (ic)
-          || IS_BITWISE_OP (ic)
-          || ic->op == LEFT_OP || ic->op == RIGHT_OP
-         ) &&
-         IS_ITEMP (IC_RESULT (ic)) &&
-         getSize (operandType (IC_RESULT (ic))) <= 2)
-       packRegsForAccUse (ic);
-#else
+
       if (!DISABLE_PACK_ACC && IS_ITEMP (IC_RESULT (ic)) &&
          getSize (operandType (IC_RESULT (ic))) == 1)
        {
          packRegsForAccUse2 (ic);
        }
-#endif
     }
 }