Переглянути джерело

* avoid spill coalesce of registers with itself, resolves issue #31926

git-svn-id: trunk@36363 -
florian 8 роки тому
батько
коміт
7c0f72d9af
1 змінених файлів з 8 додано та 3 видалено
  1. 8 3
      compiler/rgobj.pas

+ 8 - 3
compiler/rgobj.pas

@@ -22,14 +22,13 @@
 {$i fpcdefs.inc}
 
 { $define DEBUG_REGALLOC}
-{$define DEBUG_SPILLCOALESCE}
+{ $define DEBUG_SPILLCOALESCE}
 { $define DEBUG_REGISTERLIFE}
 
 { Allow duplicate allocations, can be used to get the .s file written }
 { $define ALLOWDUPREG}
 
 
-
 {$ifdef DEBUG_REGALLOC}
 {$define EXTDEBUG}
 {$endif DEBUG_REGALLOC}
@@ -2084,7 +2083,6 @@ unit rgobj;
               writeln('trgobj.spill_registers: Spilling ',t);
 {$endif DEBUG_SPILLCOALESCE}
 
-              spillinfo[t].spilled:=true;
               spillinfo[t].interferences:=Tinterferencebitmap.create;
 
               { copy interferences }
@@ -2134,6 +2132,13 @@ unit rgobj;
               if getnewspillloc then
                 get_spill_temp(templist,spill_temps,t);
 
+{$ifdef DEBUG_SPILLCOALESCE}
+              writeln('trgobj.spill_registers: Spill temp: ',getsupreg(spill_temps^[t].base),'+',spill_temps^[t].offset);
+{$endif DEBUG_SPILLCOALESCE}
+
+              { set spilled only as soon as a temp is assigned, else a mov iregX,iregX results in a spill coalesce with itself }
+              spillinfo[t].spilled:=true;
+
               spillinfo[t].spilllocation:=spill_temps^[t];
             end;
         list.insertlistafter(headertai,templist);