* src/avr/ralloc.c (serialRegAssign),
[fw/sdcc] / src / z80 / ralloc.c
index ed6868c8d7326ca591ba8ba61b9eb571a75875c4..53f212194944199e8cfef500ff33ee76d2ab380d 100644 (file)
@@ -1168,6 +1168,17 @@ serialRegAssign (eBBlock ** ebbs, int count)
 
                }
 
+             /* If the live range preceeds the point of definition 
+                then ideally we must take into account registers that 
+                have been allocated after sym->liveFrom but freed
+                before ic->seq. This is complicated, so spill this
+                symbol instead and let fillGaps handle the allocation. */
+             if (sym->liveFrom < ic->seq)
+               {
+                   spillThis (sym);
+                   continue;                 
+               }
+
              /* if it has a spillocation & is used less than
                 all other live ranges then spill this */
              if (willCS) {