浏览代码

* fixed ARM register allocation problem when additional register is used for spilling.

git-svn-id: trunk@5659 -
yury 18 年之前
父节点
当前提交
496e19c9c2
共有 1 个文件被更改,包括 6 次插入9 次删除
  1. 6 9
      compiler/arm/rgcpu.pas

+ 6 - 9
compiler/arm/rgcpu.pas

@@ -53,7 +53,6 @@ unit rgcpu;
 
 
     procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
     procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
       var
       var
-        helpins: tai;
         tmpref : treference;
         tmpref : treference;
         helplist : TAsmList;
         helplist : TAsmList;
         l : tasmlabel;
         l : tasmlabel;
@@ -86,13 +85,11 @@ unit rgcpu;
             if spilltemp.index<>NR_NO then
             if spilltemp.index<>NR_NO then
               internalerror(200401263);
               internalerror(200401263);
 
 
-            helpins:=spilling_create_load(tmpref,tempreg);
-            helplist.concat(helpins);
-            if pos=nil then
-              list.insertlistafter(list.first,helplist)
-            else
-              list.insertlistafter(pos.next,helplist);
+            helplist.concat(spilling_create_load(tmpref,tempreg));
+            if getregtype(tempreg)=R_INTREGISTER then
+              ungetregisterinline(helplist,hreg);
 
 
+            list.insertlistafter(pos,helplist);
             helplist.free;
             helplist.free;
           end
           end
         else
         else
@@ -102,7 +99,6 @@ unit rgcpu;
 
 
     procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
     procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
       var
       var
-        helpins: tai;
         tmpref : treference;
         tmpref : treference;
         helplist : TAsmList;
         helplist : TAsmList;
         l : tasmlabel;
         l : tasmlabel;
@@ -139,7 +135,8 @@ unit rgcpu;
             if getregtype(tempreg)=R_INTREGISTER then
             if getregtype(tempreg)=R_INTREGISTER then
               ungetregisterinline(helplist,hreg);
               ungetregisterinline(helplist,hreg);
 
 
-            list.insertlistafter(pos,helplist)
+            list.insertlistafter(pos,helplist);
+            helplist.free;
           end
           end
         else
         else
           inherited do_spill_written(list,pos,spilltemp,tempreg);
           inherited do_spill_written(list,pos,spilltemp,tempreg);