fixed bug #720667
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 17 Apr 2003 09:32:03 +0000 (09:32 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 17 Apr 2003 09:32:03 +0000 (09:32 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2532 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/mcs51/ralloc.c

index c8bcb1d9edefba88e88037beda010bbbfcb416f9..bc9a959ac4afa8ca81ca98de6d5ccef68b69e226 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-04-17    <johan@balder>
+
+       * src/mcs51/ralloc.c (packRegisters): fixed bug #720667
+
 2003-04-13  Borut Razem <borut.razem@siol.net>
 
        * doc/sdccman.lyx: updated info about #pragma SAVE/RESTORE nesting
index 6289a4a20fe3f4ba96f6077b4b3112d9f6582c32..795237d22ffb660e548047ec8158ae793ba2282c 100644 (file)
@@ -1574,30 +1574,6 @@ regTypeNum (eBBlock *ebbs)
              continue;
            }
 
-#ifdef RANGEHUNT
-         /* if this symbol has only one usage and that is an assignment
-            to a ruonly, we don't need registers */
-         // if this symbol has only one def
-         if (bitVectnBitsOn (sym->defs)==1) {
-           printf ("sym: %s has only one usage", sym->name);
-           // find that usage
-           if ((ic = hTabItemWithKey (iCodehTab, bitVectFirstBit (sym->defs)))) {
-             if (ic->op==CALL) {
-               printf (" for a call ");
-               // if this is only assigned to a ruonly
-               if ((ic = hTabItemWithKey (iCodehTab, bitVectFirstBit (sym->defs)))) {
-                 if (ic->op=='=') {
-                   if (OP_SYMBOL(IC_RESULT(ic))->ruonly) {
-                     printf("regTypeNum: %s assigned to %s\n", \
-                            sym->name, OP_SYMBOL(IC_RESULT(ic))->name); 
-                   }
-                 }
-               }
-             }
-           }
-         }
-#endif
-
          /* if the symbol has only one definition &
             that definition is a get_pointer */
          if (bitVectnBitsOn (sym->defs) == 1 &&
@@ -2601,7 +2577,8 @@ packRegisters (eBBlock ** ebpp, int blockno)
         cast is remat, then we can remat this cast as well */
       if (ic->op == CAST && 
          IS_SYMOP(IC_RIGHT(ic)) &&
-         OP_SYMBOL(IC_RIGHT(ic))->remat ) {
+         OP_SYMBOL(IC_RIGHT(ic))->remat &&
+         bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1) {
              sym_link *to_type = operandType(IC_LEFT(ic));
              sym_link *from_type = operandType(IC_RIGHT(ic));
              if (IS_GENPTR(to_type) && IS_PTR(from_type)) {