* src/mcs51/gen.c (genPointerGet, genNearPointerGet, genPagedPointerGet,
[fw/sdcc] / src / mcs51 / ralloc.c
index 671ef9e30e6d2a7a3aaabfd3be7e1d7a1964ec80..c738b6dd65dc542df8f8f24cf4bf592a5113b4fc 100644 (file)
@@ -2917,7 +2917,8 @@ packRegisters (eBBlock ** ebpp, int blockno)
         this is the only usage then
          mark the itemp as a conditional */
       if ((IS_CONDITIONAL (ic) ||
-          (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic))) &&
+          (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic)) ||
+           (POINTER_GET (ic) && getSize (operandType (IC_RESULT (ic))) <=1)) &&
          ic->next && ic->next->op == IFX &&
          bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
          isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
@@ -2926,6 +2927,20 @@ packRegisters (eBBlock ** ebpp, int blockno)
          OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND;
          continue;
        }
+      
+      /* if the condition of an if instruction
+         is defined in the previous GET_POINTER instruction and
+        this is the only usage then
+         mark the itemp as accumulator use */
+      if ((POINTER_GET (ic) && getSize (operandType (IC_RESULT (ic))) <=1) &&
+          ic->next && ic->next->op == IFX &&
+          bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
+          isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
+          OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq)
+        {
+          OP_SYMBOL (IC_RESULT (ic))->accuse = 1;
+          continue;
+        }
 
       /* reduce for support function calls */
       if (ic->supportRtn || ic->op == '+' || ic->op == '-')