From: kvigor Date: Fri, 11 Feb 2000 21:40:27 +0000 (+0000) Subject: Misc flat 24 stack handling fixes X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=43c4f03d72618d6f385d73f9c97823ee4b8b5817;p=fw%2Fsdcc Misc flat 24 stack handling fixes git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@101 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 57fe38fc..b153c4fd 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -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"}; diff --git a/src/mcs51/main.c b/src/mcs51/main.c index 7064aab9..5276dd14 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -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 + } } diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 11d2216b..eb82aff5 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -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; diff --git a/src/mcs51/ralloc.h b/src/mcs51/ralloc.h index 0e1ecbe0..0488a61c 100644 --- a/src/mcs51/ralloc.h +++ b/src/mcs51/ralloc.h @@ -54,4 +54,7 @@ extern regs regs8051[]; regs *mcs51_regWithIdx (int); +/* in gen.c */ +extern unsigned fReturnSize; + #endif