Fixed mixed type compares and conversions
[fw/sdcc] / src / mcs51 / ralloc.c
index 82cb8ebc628445a4ada8f11147907b294c721d77..1f77e864200cfa9e3862790d601f0e34bb901603 100644 (file)
@@ -1178,7 +1178,7 @@ serialRegAssign (eBBlock ** ebbs, int count)
                 then mark it */
              if (POINTER_GET (ic) && IS_SYMOP (IC_LEFT (ic))
                  && getSize (OP_SYMBOL (IC_LEFT (ic))->type)
-                 <= PTRSIZE)
+                 <= (unsigned int) PTRSIZE)
                {
                  mcs51_ptrRegReq++;
                  ptrRegSet = 1;
@@ -1531,7 +1531,6 @@ farSpacePackable (iCode * ic)
      symbol on the right */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
-
       /* if the definition is a call then no */
       if ((dic->op == CALL || dic->op == PCALL) &&
          IC_RESULT (dic)->key == IC_RIGHT (ic)->key)
@@ -1605,20 +1604,26 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
 
   /* if the true symbol is defined in far space or on stack
      then we should not since this will increase register pressure */
+#if 0
   if (isOperandInFarSpace (IC_RESULT (ic)))
     {
       if ((dic = farSpacePackable (ic)))
        goto pack;
       else
        return 0;
-
     }
+#else
+  if (isOperandInFarSpace(IC_RESULT(ic)) && !farSpacePackable(ic)) {
+    return 0;
+  }
+#endif
+
   /* find the definition of iTempNN scanning backwards if we find a 
      a use of the true symbol in before we find the definition then 
      we cannot */
   for (dic = ic->prev; dic; dic = dic->prev)
     {
-
+#if 0 // jwk 20010410
       /* if there is a function call and this is
          a parameter & not my parameter then don't pack it */
       if ((dic->op == CALL || dic->op == PCALL) &&
@@ -1628,6 +1633,14 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
          dic = NULL;
          break;
        }
+#else
+      /* if there is a function call then don't pack it */
+      if ((dic->op == CALL || dic->op == PCALL))
+       {
+         dic = NULL;
+         break;
+       }
+#endif
 
       if (SKIP_IC2 (dic))
        continue;
@@ -1814,6 +1827,7 @@ packRegsForSupport (iCode * ic, eBBlock * ebp)
   /* for the left & right operand :- look to see if the
      left was assigned a true symbol in far space in that
      case replace them */
+
   if (IS_ITEMP (IC_LEFT (ic)) &&
       OP_SYMBOL (IC_LEFT (ic))->liveTo <= ic->seq)
     {
@@ -1837,7 +1851,7 @@ packRegsForSupport (iCode * ic, eBBlock * ebp)
     }
 
   /* do the same for the right operand */
-right:
+ right:
   if (!change &&
       IS_ITEMP (IC_RIGHT (ic)) &&
       OP_SYMBOL (IC_RIGHT (ic))->liveTo <= ic->seq)
@@ -2019,23 +2033,18 @@ static bool
 isBitwiseOptimizable (iCode * ic)
 {
   sym_link *ltype = getSpec (operandType (IC_LEFT (ic)));
-  // jwk sym_link *rtype = getSpec (operandType (IC_RIGHT (ic)));
 
   /* bitwise operations are considered optimizable
      under the following conditions (Jean-Louis VERN) 
 
-     x & lit   <== jwk: should be x && lit
      bit & bit
      bit & x
      bit ^ bit
      bit ^ x
-     x   ^ lit <== jwk: should be x ^^ lit
-     x   | lit <== jwk: should be x || lit
      bit | bit
      bit | x
    */
-  if ( /* jwk IS_LITERAL (rtype) || */
-      (IS_BITVAR (ltype) && IN_BITSPACE (SPEC_OCLS (ltype))))
+  if ((IS_BITVAR (ltype) && IN_BITSPACE (SPEC_OCLS (ltype))))
     return TRUE;
   else
     return FALSE;
@@ -2247,7 +2256,6 @@ packRegisters (eBBlock * ebp)
 
   for (ic = ebp->sch; ic; ic = ic->next)
     {
-
       /* if this is an itemp & result of a address of a true sym 
          then mark this as rematerialisable   */
       if (ic->op == ADDRESS_OF &&
@@ -2287,8 +2295,6 @@ packRegisters (eBBlock * ebp)
           bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
           IS_OP_LITERAL (IC_RIGHT (ic))))
        {
-
-         //int i = operandLitValue (IC_RIGHT (ic));
          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
          OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
          OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
@@ -2455,7 +2461,6 @@ packRegisters (eBBlock * ebp)
          getSize (operandType (IC_RESULT (ic))) <= 2)
 
        packRegsForAccUse (ic);
-
     }
 }