Fixed bug-463702
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Sep 2001 00:44:04 +0000 (00:44 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Sep 2001 00:44:04 +0000 (00:44 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1297 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCBBlock.c
src/SDCClrange.c
src/avr/gen.c
src/z80/ralloc.c

index 15470f19ac039f8081e05f7f3fd48a4e418ee25b..2d83d9f3da6dc0adee0446a8baab7b8d4af46fa0 100644 (file)
@@ -162,31 +162,6 @@ dumpLiveRanges (int id, hTab * liveRanges)
          fprintf (file, "}{ sir@ %s", sym->usl.spillLoc->rname);
        }
       fprintf (file, "}");
-
-      /* if assigned to registers */
-      if (sym->nRegs)
-       {
-         if (sym->isspilt)
-           {
-             if (!sym->remat)
-               if (sym->usl.spillLoc)
-                 fprintf (file, "[%s]", (sym->usl.spillLoc->rname[0] ?
-                                         sym->usl.spillLoc->rname :
-                                         sym->usl.spillLoc->name));
-               else
-                 fprintf (file, "[err]");
-             else
-               fprintf (file, "[remat]");
-           }
-         else
-           {
-             int i;
-             fprintf (file, "[");
-             for (i = 0; i < sym->nRegs; i++)
-               fprintf (file, "%s ", port->getRegName (sym->regs[i]));
-             fprintf (file, "]");
-           }
-       }
       fprintf (file, "\n");
     }
 
index c3922ce0f763564a06ebc829fc6daf56dfdeaf1a..6d0a3cb976623c95e8dc2fb1252ac133dce2c0e4 100644 (file)
@@ -545,35 +545,42 @@ markLiveRanges (eBBlock * ebp, eBBlock ** ebbs, int count)
 void 
 rlivePoint (eBBlock ** ebbs, int count)
 {
-  int i;
-
-  /* for all blocks do */
-  for (i = 0; i < count; i++)
-    {
-      iCode *ic;
-
-      /* for all instruction in the block do */
-      for (ic = ebbs[i]->sch; ic; ic = ic->next)
-       {
-         symbol *lrange;
-         int k;
-
-         ic->rlive = newBitVect (operandKey);
-         /* for all symbols in the liverange table */
-         for (lrange = hTabFirstItem (liveRanges, &k); lrange;
-              lrange = hTabNextItem (liveRanges, &k))
-           {
-
-             /* if it is live then add the lrange to ic->rlive */
-             if (lrange->liveFrom <= ic->seq &&
-                 lrange->liveTo >= ic->seq)
-               {
-                 lrange->isLiveFcall |= (ic->op == CALL || ic->op == PCALL || ic->op == SEND);
-                 ic->rlive = bitVectSetBit (ic->rlive, lrange->key);
+       int i;
+
+       /* for all blocks do */
+       for (i = 0; i < count; i++) {
+               iCode *ic;
+
+               /* for all instruction in the block do */
+               for (ic = ebbs[i]->sch; ic; ic = ic->next) {
+                       symbol *lrange;
+                       int k;
+
+                       ic->rlive = newBitVect (operandKey);
+                       /* for all symbols in the liverange table */
+                       for (lrange = hTabFirstItem (liveRanges, &k); lrange;
+                            lrange = hTabNextItem (liveRanges, &k)) {
+
+                               /* if it is live then add the lrange to ic->rlive */
+                               if (lrange->liveFrom <= ic->seq &&
+                                   lrange->liveTo >= ic->seq) {
+                                       lrange->isLiveFcall |= (ic->op == CALL || ic->op == PCALL || ic->op == SEND);
+                                       ic->rlive = bitVectSetBit (ic->rlive, lrange->key);
+                               }
+                       }
+                       /* overlapping live ranges should be eliminated */
+                       if (ASSIGN_ITEMP_TO_ITEMP (ic)) {
+
+                               if (SPIL_LOC(IC_RIGHT(ic)) == SPIL_LOC(IC_RESULT(ic))   && /* left & right share the same spil location */
+                                   OP_SYMBOL(IC_RESULT(ic))->isreqv                    && /* left of assign is a register requivalent */
+                                   !OP_SYMBOL(IC_RIGHT(ic))->isreqv                    && /* right side is not */
+                                   OP_SYMBOL(IC_RIGHT(ic))->liveTo > ic->key           && /* right side live beyond this point */
+                                   bitVectnBitsOn(OP_DEFS(IC_RESULT(ic))) > 1 )        {  /* left has multiple definitions */
+                                       SPIL_LOC(IC_RIGHT(ic)) = NULL; /* then cannot share */
+                               }
+                       }
                }
-           }
        }
-    }
 }
 
 
index 3bed205bdb5639365e7abc92729823ba911cfc8d..cd262f6eaed8ec4cfee13fccad5ad0b2a3346256 100644 (file)
@@ -4639,16 +4639,17 @@ genAddrOf (iCode * ic)
        int size, offset;
 
        aopOp (IC_RESULT (ic), ic, FALSE);
-
+       assert(AOP_SIZE(IC_RESULT(ic)) >= 2);
        /* if the operand is on the stack then we
           need to get the stack offset of this
           variable */
        if (sym->onStack) {
                /* if it has an offset then we need to compute it */
                if (sym->stack) {
-                       emitcode ("mov", "a,_bp");
-                       emitcode ("add", "a,#0x%02x",
+#if 0
+                       if (AOP_ISHIGHREG(AOP(
                                  ((char) sym->stack & 0xff));
+#endif
                        aopPut (AOP (IC_RESULT (ic)), "a", 0);
                }
                else {
index d15e042c9b682f26dd810470daa05fc351f2e142..ac7fe0e7ecb8f5af7af98b7a5f373154cf97ea7f 100644 (file)
@@ -2602,8 +2602,10 @@ z80_assignRegisters (eBBlock ** ebbs, int count)
       _G.dataExtend = 0;
     }
 
-  if (options.dump_rassgn)
+  if (options.dump_rassgn) {
     dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
+    dumpLiveRanges (DUMP_LRANGE, liveRanges);
+  }
 
   /* after that create the register mask
      for each of the instruction */