fixed bug #477835 for the mcs port
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Nov 2001 14:28:10 +0000 (14:28 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Nov 2001 14:28:10 +0000 (14:28 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1507 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/include/limits.h
src/mcs51/gen.c
src/mcs51/ralloc.c
src/mcs51/ralloc.h

index a1fe0a771580ace0b00823fac50f9d63e13ebcfe..23cbc60ca16dba7b3566b8341012484029d8475c 100644 (file)
 #define SCHAR_MIN   CHAR_MIN
 #define UCHAR_MAX   0xff
 #define UCHAR_MIN   0
-#define SHRT_MAX    CHAR_MAX
-#define SHRT_MIN    CHAR_MIN
-#define USHRT_MAX   UCHAR_MAX
-#define USHRT_MIN   UCHAR_MIN
 #define INT_MIN    -32768
 #define INT_MAX     32767
+#define SHRT_MAX    INT_MAX
+#define SHRT_MIN    INT_MIN
 #define UINT_MAX    0xffff
 #define UINT_MIN    0
+#define USHRT_MAX   UINT_MAX
+#define USHRT_MIN   UINT_MIN
 #define LONG_MIN   -2147483648
 #define LONG_MAX    2147483647
 #define ULONG_MAX   0xffffffff
index 76add3aa6d678874add2bc7443cee8676bb652e0..646faf856cc938390d7937c82a57d241d14d94d6 100644 (file)
@@ -1460,10 +1460,10 @@ saveRegisters (iCode * lic)
       IFFUNC_ISNAKED(OP_SYM_TYPE(IC_LEFT (ic))))
     return;
 
-  /* find the registers in use at this time
-     and push them away to safety */
-  rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
-                        ic->rUsed);
+  /* safe the registers in use at this time but skip the
+     ones for the result */
+  rsave = bitVectCplAnd (bitVectCopy (ic->rMask), 
+                        mcs51_rUmaskForOp (IC_RESULT(ic)));
 
   ic->regsSaved = 1;
   if (options.useXstack)
@@ -1503,10 +1503,11 @@ unsaveRegisters (iCode * ic)
 {
   int i;
   bitVect *rsave;
-  /* find the registers in use at this time
-     and push them away to safety */
-  rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
-                        ic->rUsed);
+
+  /* restore the registers in use at this time but skip the
+     ones for the result */
+  rsave = bitVectCplAnd (bitVectCopy (ic->rMask), 
+                        mcs51_rUmaskForOp (IC_RESULT(ic)));
 
   if (options.useXstack)
     {
@@ -1967,7 +1968,7 @@ genPcall (iCode * ic)
   sym_link *dtype;
   symbol *rlbl = newiTempLabel (NULL);
 
-
+  D(emitcode(";", "genPCall"));
   /* if caller saves & we have not saved then */
   if (!ic->regsSaved)
     saveRegisters (ic);
index a6a346418fd86a631f27437c31bf05ae3f83762b..3c5f39dbebe0c11b4202412e46c41e19aae7a902 100644 (file)
@@ -1220,8 +1220,8 @@ serialRegAssign (eBBlock ** ebbs, int count)
 /*-----------------------------------------------------------------*/
 /* rUmaskForOp :- returns register mask for an operand             */
 /*-----------------------------------------------------------------*/
-static bitVect *
-rUmaskForOp (operand * op)
+bitVect *
+mcs51_rUmaskForOp (operand * op)
 {
   bitVect *rumask;
   symbol *sym;
@@ -1261,7 +1261,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == IFX)
     {
       rmask = bitVectUnion (rmask,
-                           rUmaskForOp (IC_COND (ic)));
+                           mcs51_rUmaskForOp (IC_COND (ic)));
       goto ret;
     }
 
@@ -1269,7 +1269,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == JUMPTABLE)
     {
       rmask = bitVectUnion (rmask,
-                           rUmaskForOp (IC_JTCOND (ic)));
+                           mcs51_rUmaskForOp (IC_JTCOND (ic)));
 
       goto ret;
     }
@@ -1277,16 +1277,16 @@ regsUsedIniCode (iCode * ic)
   /* of all other cases */
   if (IC_LEFT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_LEFT (ic)));
+                         mcs51_rUmaskForOp (IC_LEFT (ic)));
 
 
   if (IC_RIGHT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_RIGHT (ic)));
+                         mcs51_rUmaskForOp (IC_RIGHT (ic)));
 
   if (IC_RESULT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_RESULT (ic)));
+                         mcs51_rUmaskForOp (IC_RESULT (ic)));
 
 ret:
   return rmask;
index 85add4180664193811fcd1057af0276af277f7d4..fc8d87a9ea562d15400b83a79e06b44d61b90767 100644 (file)
@@ -58,4 +58,6 @@ extern regs regs8051[];
 
 regs *mcs51_regWithIdx (int);
 
+bitVect *mcs51_rUmaskForOp (operand * op);
+
 #endif