Misc flat 24 stack handling fixes
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Feb 2000 21:40:27 +0000 (21:40 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Feb 2000 21:40:27 +0000 (21:40 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@101 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/gen.c
src/mcs51/main.c
src/mcs51/ralloc.c
src/mcs51/ralloc.h

index 57fe38fc63f4dbe2653107f4acec9ca0447de9d5..b153c4fd8a1f3cbd449ff0b2b12100d7a608d33a 100644 (file)
@@ -63,7 +63,7 @@ static char *spname ;
 
 static char *fReturn8051[] = {"dpl","dph","b","a" };
 static char *fReturn390[] = {"dpl","dph","dpx", "b","a" };
-static unsigned fReturnSize = 4;
+unsigned fReturnSize = 4; /* shared with ralloc.c */
 static char **fReturn = fReturn8051;
 static char *accUse[] = {"a","b"};
 
index 7064aab9696d7b58be0832f58b6d3f43490e3e6f..5276dd148782829ca12f3aad919fd1a3ddfa625b 100644 (file)
@@ -60,6 +60,15 @@ static void _mcs51_finaliseOptions(void)
     {
         port->s.fptr_size = 3;
         port->s.gptr_size = 4;
+        port->stack.isr_overhead++;   /* Will save dpx on ISR entry. */
+        #if 1
+        port->stack.call_overhead++;      /* This acounts for the extra byte 
+                                           * of return addres on the stack.
+                                           * but is ugly. There must be a 
+                                           * better way.
+                                           */
+       #endif                                      
+        
     } 
 }
 
index 11d2216b9f075b1dfb669329fdd0675c0dbd2467..eb82aff5a155d9b2d33bf801a7fcad80a2970175 100644 (file)
@@ -1721,7 +1721,7 @@ static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp)
     
     /* only upto 2 bytes since we cannot predict
        the usage of b, & acc */
-    if (getSize(operandType(op)) > 2 && 
+    if (getSize(operandType(op)) >  (fReturnSize - 2) &&
        ic->op != RETURN             &&
        ic->op != SEND)
        return NULL;
index 0e1ecbe049113e67ea8b0bee55ca361f4bb576b9..0488a61c7b5a814faab11865ba9b260824fb1e1a 100644 (file)
@@ -54,4 +54,7 @@ extern regs regs8051[];
 
 regs  *mcs51_regWithIdx (int);
 
+/* in gen.c */
+extern unsigned fReturnSize;
+
 #endif