* src/SDCCicode.c:
[fw/sdcc] / src / mcs51 / ralloc.c
index 832a203cbdc9205fd41f6756a84d2e4e43964832..54af801e55919137a881463623e6eacf818df23a 100644 (file)
@@ -1910,6 +1910,8 @@ regTypeNum (eBBlock *ebbs)
             {
               if (IS_AGGREGATE (sym->type) || sym->isptr)
                 sym->type = aggrToPtr (sym->type, FALSE);
+              else if (IS_BIT(sym->type))
+                sym->regType = REG_CND;
               continue;
             }
 
@@ -2110,6 +2112,13 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
             }
         }
 
+      /* Don't move an assignment out of a critical block */
+      if (dic->op == CRITICAL)
+       {
+         dic = NULL;
+         break;
+       }
+
       if (SKIP_IC2 (dic))
         continue;
 
@@ -2465,8 +2474,8 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   if (ic->op == SEND && ic->argreg != 1) return NULL;
 
-  /* this routine will mark the symbol as used in one
-     instruction use only && if the defintion is local
+  /* this routine will mark the symbol as used in one
+     instruction use only && if the definition is local
      (ie. within the basic block) && has only one definition &&
      that definition is either a return value from a
      function or does not contain any variables in
@@ -2474,7 +2483,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
   if (bitVectnBitsOn (OP_USES (op)) > 1)
     return NULL;
 
-  /* if it has only one defintion */
+  /* if it has only one definition */
   if (bitVectnBitsOn (OP_DEFS (op)) > 1)
     return NULL;                /* has more than one definition */
 
@@ -2552,11 +2561,10 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   sic = dic;
 
-  /* also make sure the intervenening instructions
-     don't have any thing in far space */
+  /* also make sure the intervening instructions
+     don't have anything in far space */
   for (dic = dic->next; dic && dic != ic && sic != ic; dic = dic->next)
     {
-
       /* if there is an intervening function call then no */
       if (dic->op == CALL || dic->op == PCALL)
         return NULL;
@@ -3143,7 +3151,6 @@ packRegisters (eBBlock ** ebpp, int blockno)
           getSize (aggrToPtr (operandType (IC_LEFT (ic)), FALSE)) > 1)
         packRegsForOneuse (ic, IC_LEFT (ic), ebp);
 
-
       /* if this is a cast for intergral promotion then
          check if it's the only use of the definition of the
          operand being casted/ if yes then replace
@@ -3178,7 +3185,6 @@ packRegisters (eBBlock ** ebpp, int blockno)
             }
           else
             {
-
               /* if the type from and type to are the same
                  then if this is the only use then packit */
               if (compareType (operandType (IC_RIGHT (ic)),