From edacee178430e759706c60ca562733983c406b42 Mon Sep 17 00:00:00 2001 From: sandeep Date: Mon, 5 Mar 2001 08:53:59 +0000 Subject: [PATCH] BUG in packForPush git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@666 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/ds390/ralloc.c | 10 +++++++++- src/mcs51/ralloc.c | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 7bc49eae..cd394735 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -2169,7 +2169,8 @@ accuse: static void packForPush (iCode * ic, eBBlock * ebp) { - iCode *dic; + iCode *dic, *lic; + bitVect *dbv; if (ic->op != IPUSH || !IS_ITEMP (IC_LEFT (ic))) return; @@ -2187,6 +2188,13 @@ packForPush (iCode * ic, eBBlock * ebp) if (dic->op != '=' || POINTER_SET (dic)) return; + /* make sure the right side does not have any definitions + inbetween */ + dbv = OP_DEFS(IC_RIGHT(dic)); + for (lic = ic; lic != dic ; lic = lic->prev) { + if (bitVectBitValue(dbv,lic->key)) return ; + } + /* we now we know that it has one & only one def & use and the that the definition is an assignment */ IC_LEFT (ic) = IC_RIGHT (dic); diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index fb5f65c9..a5a61a86 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -2173,7 +2173,8 @@ accuse: static void packForPush (iCode * ic, eBBlock * ebp) { - iCode *dic; + iCode *dic, *lic; + bitVect *dbv; if (ic->op != IPUSH || !IS_ITEMP (IC_LEFT (ic))) return; @@ -2191,6 +2192,12 @@ packForPush (iCode * ic, eBBlock * ebp) if (dic->op != '=' || POINTER_SET (dic)) return; + /* make sure the right side does not have any definitions + inbetween */ + dbv = OP_DEFS(IC_RIGHT(dic)); + for (lic = ic; lic != dic ; lic = lic->prev) { + if (bitVectBitValue(dbv,lic->key)) return ; + } /* we now we know that it has one & only one def & use and the that the definition is an assignment */ IC_LEFT (ic) = IC_RIGHT (dic); -- 2.30.2