Browse Source

* fix parameter allocation for left to right calling conventions

git-svn-id: trunk@10597 -
peter 17 years ago
parent
commit
f7737bebda
1 changed files with 10 additions and 1 deletions
  1. 10 1
      compiler/i386/cpupara.pas

+ 10 - 1
compiler/i386/cpupara.pas

@@ -390,7 +390,12 @@ unit cpupara;
           That means for pushes the para with the
           That means for pushes the para with the
           highest offset (see para3) needs to be pushed first
           highest offset (see para3) needs to be pushed first
         }
         }
-        for i:=0 to paras.count-1 do
+        if p.proccalloption in pushleftright_pocalls then
+          i:=paras.count-1
+        else
+          i:=0;
+        while ((p.proccalloption in pushleftright_pocalls) and (i>=0)) or
+              (not(p.proccalloption in pushleftright_pocalls) and (i<=paras.count-1)) do
           begin
           begin
             hp:=tparavarsym(paras[i]);
             hp:=tparavarsym(paras[i]);
             pushaddr:=push_addr_param(hp.varspez,hp.vardef,p.proccalloption);
             pushaddr:=push_addr_param(hp.varspez,hp.vardef,p.proccalloption);
@@ -478,6 +483,10 @@ unit cpupara;
                     dec(paralen,l);
                     dec(paralen,l);
                   end;
                   end;
               end;
               end;
+            if p.proccalloption in pushleftright_pocalls then
+              dec(i)
+            else
+              inc(i);
           end;
           end;
       end;
       end;