瀏覽代碼

* fix wrong comparisons in trgobj.conservative to enable better coalescing,
before this patch, k was calculated wrong most of the time

git-svn-id: trunk@31439 -

florian 10 年之前
父節點
當前提交
199b1861d6
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      compiler/rgobj.pas

+ 6 - 5
compiler/rgobj.pas

@@ -21,10 +21,11 @@
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 
+{ $define DEBUG_REGALLOC}
+
 { Allow duplicate allocations, can be used to get the .s file written }
 { Allow duplicate allocations, can be used to get the .s file written }
 { $define ALLOWDUPREG}
 { $define ALLOWDUPREG}
 
 
-
 unit rgobj;
 unit rgobj;
 
 
   interface
   interface
@@ -577,9 +578,9 @@ unit rgobj;
         insert_regalloc_info_all(list);
         insert_regalloc_info_all(list);
         ibitmap:=tinterferencebitmap.create;
         ibitmap:=tinterferencebitmap.create;
         generate_interference_graph(list,headertai);
         generate_interference_graph(list,headertai);
-{$ifdef DEBUG_SSA}
+{$ifdef DEBUG_REGALLOC}
         writegraph(rtindex);
         writegraph(rtindex);
-{$endif DEBUG_SSA}
+{$endif DEBUG_REGALLOC}
         inc(rtindex);
         inc(rtindex);
         { Don't do the real allocation when -sr is passed }
         { Don't do the real allocation when -sr is passed }
         if (cs_no_regalloc in current_settings.globalswitches) then
         if (cs_no_regalloc in current_settings.globalswitches) then
@@ -1116,7 +1117,7 @@ unit rgobj;
             for i:=1 to adj^.length do
             for i:=1 to adj^.length do
               begin
               begin
                 n:=adj^.buf^[i-1];
                 n:=adj^.buf^[i-1];
-                if flags*[ri_coalesced,ri_selected]=[] then
+                if reginfo[n].flags*[ri_coalesced,ri_selected]=[] then
                   begin
                   begin
                     supregset_include(done,n);
                     supregset_include(done,n);
                     if reginfo[n].degree>=usable_registers_cnt then
                     if reginfo[n].degree>=usable_registers_cnt then
@@ -1131,7 +1132,7 @@ unit rgobj;
             n:=adj^.buf^[i-1];
             n:=adj^.buf^[i-1];
             if not supregset_in(done,n) and
             if not supregset_in(done,n) and
                (reginfo[n].degree>=usable_registers_cnt) and
                (reginfo[n].degree>=usable_registers_cnt) and
-               (reginfo[u].flags*[ri_coalesced,ri_selected]=[]) then
+               (reginfo[n].flags*[ri_coalesced,ri_selected]=[]) then
               inc(k);
               inc(k);
           end;
           end;
       conservative:=(k<usable_registers_cnt);
       conservative:=(k<usable_registers_cnt);