From 04a394483c4ca0755c4258779481d66bce82a2b5 Mon Sep 17 00:00:00 2001 From: epetrich Date: Fri, 30 Jan 2004 05:52:20 +0000 Subject: [PATCH] * src/mcs51/ralloc.c (getRegPtr, getRegGpr), * src/ds390/ralloc.c (getRegPtr, getRegGpr), * src/pic/ralloc.c (getRegPtr, getRegGpr), * src/pic16/ralloc.c (getRegPtr, getRegGpr), * src/z80/ralloc.c (getRegGpr): fixed bug #883361 * as/mcs51/asexpr.c (term), * as/hc08/asexpr.c (term): fixed bug #887146 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3158 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 12 +++++++++++- as/hc08/asexpr.c | 2 +- as/mcs51/asexpr.c | 2 +- src/ds390/ralloc.c | 12 ++++++++++++ src/mcs51/ralloc.c | 25 ++++++++++++++++++++++++- src/pic/ralloc.c | 12 ++++++++++++ src/pic16/ralloc.c | 12 ++++++++++++ src/z80/ralloc.c | 6 ++++++ 8 files changed, 79 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3453cdc..08d834a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,14 @@ -2004-01-27 Erik Petrich +2004-01-30 Erik Petrich + + * src/mcs51/ralloc.c (getRegPtr, getRegGpr), + * src/ds390/ralloc.c (getRegPtr, getRegGpr), + * src/pic/ralloc.c (getRegPtr, getRegGpr), + * src/pic16/ralloc.c (getRegPtr, getRegGpr), + * src/z80/ralloc.c (getRegGpr): fixed bug #883361 + * as/mcs51/asexpr.c (term), + * as/hc08/asexpr.c (term): fixed bug #887146 + +2004-01-29 Erik Petrich * src/z80/gen.c (genMult): handle single byte result product * src/SDCCopt.c (killDeadCode): never convert ADDRESS_OF iCode to diff --git a/as/hc08/asexpr.c b/as/hc08/asexpr.c index 26aea4b0..a21e9b0f 100644 --- a/as/hc08/asexpr.c +++ b/as/hc08/asexpr.c @@ -408,7 +408,7 @@ register struct expr *esp; } tp = tp->t_lnk; } - /* err('u'); */ + err('u'); return; } r = radix; diff --git a/as/mcs51/asexpr.c b/as/mcs51/asexpr.c index 26aea4b0..a21e9b0f 100644 --- a/as/mcs51/asexpr.c +++ b/as/mcs51/asexpr.c @@ -408,7 +408,7 @@ register struct expr *esp; } tp = tp->t_lnk; } - /* err('u'); */ + err('u'); return; } r = radix; diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 042eb500..42de2a96 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -802,6 +802,7 @@ static regs * getRegPtr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; tryAgain: /* try for a ptr type */ @@ -816,6 +817,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; @@ -828,6 +834,7 @@ static regs * getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; tryAgain: /* try for gpr type */ @@ -842,6 +849,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 163c2c54..e45b233c 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -782,6 +782,7 @@ static regs * getRegPtr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; tryAgain: /* try for a ptr type */ @@ -796,6 +797,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; @@ -808,7 +814,8 @@ static regs * getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; - + int j; + tryAgain: /* try for gpr type */ if ((reg = allocReg (REG_GPR))) @@ -822,6 +829,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; @@ -1208,6 +1220,17 @@ serialRegAssign (eBBlock ** ebbs, int count) mcs51_ptrRegReq++; ptrRegSet = 1; } + if (IC_LEFT (ic) && IS_SYMOP (IC_LEFT (ic)) + && SPEC_OCLS(OP_SYMBOL (IC_LEFT (ic))->etype) == idata) { + mcs51_ptrRegReq++; + ptrRegSet = 1; + } + if (IC_RIGHT (ic) && IS_SYMOP (IC_RIGHT (ic)) + && SPEC_OCLS(OP_SYMBOL (IC_RIGHT (ic))->etype) == idata) { + mcs51_ptrRegReq++; + ptrRegSet = 1; + } + /* else we assign registers to it */ _G.regAssigned = bitVectSetBit (_G.regAssigned, sym->key); _G.totRegAssigned = bitVectSetBit (_G.totRegAssigned, sym->key); diff --git a/src/pic/ralloc.c b/src/pic/ralloc.c index 809c6dbe..8dfd64f7 100644 --- a/src/pic/ralloc.c +++ b/src/pic/ralloc.c @@ -1925,6 +1925,7 @@ static regs * getRegPtr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; debugLog ("%s\n", __FUNCTION__); tryAgain: @@ -1940,6 +1941,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; @@ -1952,6 +1958,7 @@ static regs * getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; debugLog ("%s\n", __FUNCTION__); tryAgain: @@ -1967,6 +1974,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index 343546c6..2f21d221 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -1734,6 +1734,7 @@ static regs * getRegPtr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; debugLog ("%s\n", __FUNCTION__); tryAgain: @@ -1749,6 +1750,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; @@ -1761,6 +1767,7 @@ static regs * getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; debugLog ("%s\n", __FUNCTION__); tryAgain: @@ -1776,6 +1783,11 @@ tryAgain: if (!spilSomething (ic, ebp, sym)) return NULL; + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; + /* this looks like an infinite loop but in really selectSpil will abort */ goto tryAgain; diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index a9ce2dcc..17d3b806 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -763,6 +763,7 @@ regs * getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym) { regs *reg; + int j; D (D_ALLOC, ("getRegGpr: on ic %p\n", ic)); tryAgain: @@ -779,6 +780,11 @@ tryAgain: D (D_ALLOC, ("getRegGpr: have to spill.\n")); return NULL; } + + /* make sure partially assigned registers aren't reused */ + for (j=0; j<=sym->nRegs; j++) + if (sym->regs[j]) + sym->regs[j]->isFree = 0; /* this looks like an infinite loop but in really selectSpil will abort */ -- 2.30.2