* src/avr/ralloc.c (serialRegAssign),
[fw/sdcc] / src / pic / ralloc.c
index e71c82f99352dd75d963e8bd85280c0a1241e3ec..cce44ed13110e3215e36af93362d89a52486836d 100644 (file)
@@ -2319,6 +2319,17 @@ serialRegAssign (eBBlock ** ebbs, int count)
                                        continue;
                                        
                                }
+
+                               /* 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 */