Fixed a bug in packForpush wasn't extending the
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 2 May 2001 04:22:51 +0000 (04:22 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 2 May 2001 04:22:51 +0000 (04:22 +0000)
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
src/ds390/ralloc.c
src/mcs51/ralloc.c

index 731b98caae46646b16186d0b8e1f63ec16854e13..0cb4b0f120630bc513d9f7b27f3459787ea4162d 100644 (file)
@@ -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;
index 55b2e22282412b9c398c52e94b8f1a4604e673a4..0475b17735ca8741a9e45d5f2a34df3761fbeccf 100644 (file)
@@ -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);
index e5ab738986d8fef553f37bbc66271784027076df..76040b5bf6dd7f73c69ee9406098c11d16fa211a 100644 (file)
@@ -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);