increased count on regUsedinRange to prevent unnecessary warning.
authorslade_rich <slade_rich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Oct 2004 01:24:29 +0000 (01:24 +0000)
committerslade_rich <slade_rich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 13 Oct 2004 01:24:29 +0000 (01:24 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3538 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/pic/pcoderegs.c

index 61ea9a9718d394338c6907e8750759fddfa55429..4b37f118da39751e6d150889588d0f279e87106e 100644 (file)
@@ -418,13 +418,14 @@ int regUsedinRange(pCode *pc1, pCode *pc2, regs *reg)
                if(testreg && (testreg->rIdx == reg->rIdx)) {
                        return 1;
                }
+               if (i++ > 1000) {
+                       fprintf(stderr, "warning, regUsedinRange searched through too many pcodes\n");
+                       return 0;
+               }
                
                pc1 = findNextInstruction(pc1->next);
                
-       } while (pc1 && (pc1 != pc2) && (i++ < 100)) ;
-       
-       if(i >= 100)
-               fprintf(stderr, "warning, regUsedinRange searched through too many pcodes\n");
+       } while (pc1 && (pc1 != pc2)) ;
        
        return 0;
 }
@@ -611,17 +612,6 @@ int pCodeOptime2pCodes(pCode *pc1, pCode *pc2, pCode *pcfl_used, regs *reg, int
                                        total_registers_saved++;  // debugging stats.
                                        
                                }
-                               /* Note this else if is same conditional as the if - DELETE ME 
-                               } else if ( (PCI(pct1)->op == POC_MOVWF) &&
-                                       (PCI(pc2)->op == POC_MOVFW)) {
-                                       DFPRINTF(stderr, "   optimising MOVF reg1,W MOVWF reg ... MOVF reg,W\n");
-                                       if(optimize_level > 1 && can_free) {
-                                               pct2 = newpCode(POC_MOVFW, PCI(pc1)->pcop);
-                                               pCodeInsertAfter(pc2, pct2);
-                                               Remove2pcodes(pcfl_used, pc1, pc2, reg, 1);
-                                       total_registers_saved++;  // debugging stats.
-                               }
-                               */
                        }
                }
   }