* src/mcs51/ralloc.c (getRegPtr, getRegGpr),
[fw/sdcc] / src / pic16 / ralloc.c
index 343546c6a838a9f1b2d0b0f2bad2ca1db9ff4258..2f21d2215cb5b88ebda785d52ca8b6557e1f7a5f 100644 (file)
@@ -1734,6 +1734,7 @@ static regs *
 getRegPtr (iCode * ic, eBBlock * ebp, symbol * sym)
 {
   regs *reg;
+  int j;
 
   debugLog ("%s\n", __FUNCTION__);
 tryAgain:
@@ -1749,6 +1750,11 @@ tryAgain:
   if (!spilSomething (ic, ebp, sym))
     return NULL;
 
+  /* make sure partially assigned registers aren't reused */
+  for (j=0; j<=sym->nRegs; j++)
+    if (sym->regs[j])
+      sym->regs[j]->isFree = 0;
+      
   /* this looks like an infinite loop but 
      in really selectSpil will abort  */
   goto tryAgain;
@@ -1761,6 +1767,7 @@ static regs *
 getRegGpr (iCode * ic, eBBlock * ebp, symbol * sym)
 {
   regs *reg;
+  int j;
 
   debugLog ("%s\n", __FUNCTION__);
 tryAgain:
@@ -1776,6 +1783,11 @@ tryAgain:
   if (!spilSomething (ic, ebp, sym))
     return NULL;
 
+  /* make sure partially assigned registers aren't reused */
+  for (j=0; j<=sym->nRegs; j++)
+    if (sym->regs[j])
+      sym->regs[j]->isFree = 0;
+      
   /* this looks like an infinite loop but 
      in really selectSpil will abort  */
   goto tryAgain;