Browse Source

* fixed stackframe generation for win x64

git-svn-id: trunk@3124 -
florian 19 years ago
parent
commit
d904a04d3b
1 changed files with 30 additions and 2 deletions
  1. 30 2
      compiler/x86_64/cpupi.pas

+ 30 - 2
compiler/x86_64/cpupi.pas

@@ -1,5 +1,5 @@
 {
 {
-    Copyright (c) 2002 by Florian Klaempfl
+    Copyright (c) 2002-2006 by Florian Klaempfl
 
 
     This unit contains the CPU specific part of tprocinfo
     This unit contains the CPU specific part of tprocinfo
 
 
@@ -32,6 +32,8 @@ interface
 
 
     type
     type
        tx86_64procinfo = class(tcgprocinfo)
        tx86_64procinfo = class(tcgprocinfo)
+         procedure set_first_temp_offset;override;
+         procedure generate_parameter_info;override;
          function calc_stackframe_size:longint;override;
          function calc_stackframe_size:longint;override;
        end;
        end;
 
 
@@ -39,18 +41,44 @@ interface
 implementation
 implementation
 
 
     uses
     uses
+      systems,
       globals,
       globals,
       cutils,
       cutils,
+      symconst,
       tgobj;
       tgobj;
 
 
 
 
+    procedure tx86_64procinfo.set_first_temp_offset;
+      begin
+        if target_info.system=system_x86_64_win64 then
+          begin
+            if not(po_assembler in procdef.procoptions) and
+              (tg.direction > 0) then
+              tg.setfirsttemp(tg.direction*maxpushedparasize+4*8);
+          end
+        else
+          inherited;
+      end;
+
+
+    procedure tx86_64procinfo.generate_parameter_info;
+      begin
+        inherited generate_parameter_info;
+        if target_info.system=system_x86_64_win64 then
+          para_stack_size:=0;
+      end;
+
+
     function tx86_64procinfo.calc_stackframe_size:longint;
     function tx86_64procinfo.calc_stackframe_size:longint;
       begin
       begin
         maxpushedparasize:=align(maxpushedparasize,max(aktalignment.localalignmin,16));
         maxpushedparasize:=align(maxpushedparasize,max(aktalignment.localalignmin,16));
         { RSP should be aligned on 16 bytes }
         { RSP should be aligned on 16 bytes }
-        result:=Align(tg.direction*tg.lasttemp,16)+maxpushedparasize;
+        result:=Align(tg.direction*tg.lasttemp+maxpushedparasize,16);
+        if target_info.system=system_x86_64_win64 then
+          inc(result,4*8);
       end;
       end;
 
 
+
 begin
 begin
    cprocinfo:=tx86_64procinfo;
    cprocinfo:=tx86_64procinfo;
 end.
 end.