瀏覽代碼

* Procvars (methodpointers) must be treated as records, too. Fixes tw12318.pp and tw14155.pp after r23377.
* Factored related code into a separate method, as it will probably need further refinement.

git-svn-id: trunk@23387 -

sergei 12 年之前
父節點
當前提交
b5eecab582
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      compiler/mips/cpupara.pas

+ 12 - 2
compiler/mips/cpupara.pas

@@ -87,6 +87,7 @@ interface
         intparareg,
         intparasize : longint;
         can_use_float : boolean;
+        function is_abi_record(def: tdef): boolean;
         procedure create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist);
       end;
 
@@ -113,6 +114,15 @@ implementation
       end;
 
 
+    { whether "def" must be treated as record when used as function result,
+      i.e. its address passed in a0 }
+    function TMIPSParaManager.is_abi_record(def: tdef): boolean;
+      begin
+        result:=(def.typ=recorddef) or
+          ((def.typ=procvardef) and not tprocvardef(def).is_addressonly);
+      end;
+
+
     procedure TMIPSParaManager.GetIntParaLoc(pd : tabstractprocdef; nr : longint; var cgpara : tcgpara);
       var
         paraloc : pcgparalocation;
@@ -201,7 +211,7 @@ implementation
             else
               retdef:=p.returndef;
             if ret_in_param(retdef,p.proccalloption) and
-              (retdef.typ=recorddef) then
+              is_abi_record(retdef) then
               begin
                 if intparareg=0 then
                   inc(intparareg);
@@ -374,7 +384,7 @@ implementation
                   paraloc^.size:=paracgsize;
                 { ret in param? }
                 if (vo_is_funcret in hp.varoptions) and
-                  (hp.vardef.typ=recorddef) then
+                  is_abi_record(hp.vardef) then
                   begin
                     { This should be the first parameter }
                     if (side=calleeside) and assigned(current_procinfo) then