* src/avr/ralloc.c (serialRegAssign),
[fw/sdcc] / src / xa51 / ralloc.c
index 1f530ece925535d57c7da83b39c2841f6329e2a2..27c88a44f9127195957d2347e000a319039b8725 100755 (executable)
@@ -1010,6 +1010,16 @@ 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 */
        if (willCS) {