From 4475fbc1bf0220f1e41fd41b9262ce8983603cfd Mon Sep 17 00:00:00 2001 From: sandeep Date: Wed, 2 May 2001 04:22:51 +0000 Subject: [PATCH] Fixed a bug in packForpush wasn't extending the liveRange of the replacing operand correctly git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@765 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/avr/gen.c | 23 ++++------------------- src/ds390/ralloc.c | 5 ++++- src/mcs51/ralloc.c | 8 ++++++-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/avr/gen.c b/src/avr/gen.c index 731b98ca..0cb4b0f1 100644 --- a/src/avr/gen.c +++ b/src/avr/gen.c @@ -4585,8 +4585,7 @@ genAddrOf (iCode * ic) need to get the stack offset of this variable */ if (sym->onStack) { - /* if it has an offset then we need to compute - it */ + /* if it has an offset then we need to compute it */ if (sym->stack) { emitcode ("mov", "a,_bp"); emitcode ("add", "a,#0x%02x", @@ -4598,24 +4597,10 @@ genAddrOf (iCode * ic) aopPut (AOP (IC_RESULT (ic)), "_bp", 0); } /* fill the result with zero */ - size = AOP_SIZE (IC_RESULT (ic)) - 1; - - - if (options.stack10bit && size < (FPTRSIZE - 1)) { - fprintf (stderr, - "*** warning: pointer to stack var truncated.\n"); - } - - offset = 1; + size = AOP_SIZE (IC_RESULT (ic)) - 2; + offset = 2; while (size--) { - /* Yuck! */ - if (options.stack10bit && offset == 2) { - aopPut (AOP (IC_RESULT (ic)), "0x40", - offset++); - } - else { - aopPut (AOP (IC_RESULT (ic)), zero, offset++); - } + aopPut (AOP (IC_RESULT (ic)), zero, offset++); } goto release; diff --git a/src/ds390/ralloc.c b/src/ds390/ralloc.c index 55b2e222..0475b177 100644 --- a/src/ds390/ralloc.c +++ b/src/ds390/ralloc.c @@ -2210,7 +2210,10 @@ packForPush (iCode * ic, eBBlock * ebp) for (lic = ic; lic != dic ; lic = lic->prev) { if (bitVectBitValue(dbv,lic->key)) return ; } - + /* extend the live range of replaced operand if needed */ + if (OP_SYMBOL(IC_RIGHT(dic))->liveTo < ic->seq) { + OP_SYMBOL(IC_RIGHT(dic))->liveTo = ic->seq; + } /* 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 e5ab7389..76040b5b 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -2212,10 +2212,14 @@ packForPush (iCode * ic, eBBlock * ebp) if (bitVectBitValue(dbv,lic->key)) return ; } + /* extend the live range of replaced operand if needed */ + if (OP_SYMBOL(IC_RIGHT(dic))->liveTo < ic->seq) { + OP_SYMBOL(IC_RIGHT(dic))->liveTo = ic->seq; + } /* 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); - + remiCodeFromeBBlock (ebp, dic); hTabDeleteItem (&iCodehTab, dic->key, dic, DELETE_ITEM, NULL); } @@ -2413,7 +2417,7 @@ packRegisters (eBBlock * ebp) if (dic) { if (IS_ARITHMETIC_OP (dic)) - { + { IC_RESULT (dic) = IC_RESULT (ic); remiCodeFromeBBlock (ebp, ic); hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL); -- 2.30.2