Jelajahi Sumber

* keep track of required stack frame alignment (this information is however
not yet actually used for anything)

git-svn-id: trunk@22280 -

Jonas Maebe 13 tahun lalu
induk
melakukan
56378f907f
2 mengubah file dengan 15 tambahan dan 0 penghapusan
  1. 14 0
      compiler/procinfo.pas
  2. 1 0
      compiler/tgobj.pas

+ 14 - 0
compiler/procinfo.pas

@@ -56,6 +56,8 @@ unit procinfo;
        private
           { list to store the procinfo's of the nested procedures }
           nestedprocs : tlinkedlist;
+          { required alignment for this stackframe }
+          fstackalignment : longint;
           procedure addnestedproc(child: tprocinfo);
        public
           { pointer to parent in nested procedures }
@@ -159,6 +161,12 @@ unit procinfo;
 
           { Add to parent's list of nested procedures even if parent is a 'main' procedure }
           procedure force_nested;
+
+          { Get the required alignment for the current stack frame }
+          property stackalignment: longint read fstackalignment;
+          { Update the resuired alignment for the current stack frame based
+            on the current value and the new required alignment }
+          procedure updatestackalignment(alignment: longint);
        end;
        tcprocinfo = class of tprocinfo;
 
@@ -185,6 +193,7 @@ implementation
         parent:=aparent;
         procdef:=nil;
         para_stack_size:=0;
+        fstackalignment:=target_info.stackalign;
         flags:=[];
         init_framepointer;
         framepointer:=NR_FRAME_POINTER_REG;
@@ -234,6 +243,11 @@ implementation
         nestedprocs.insert(child);
       end;
 
+    procedure tprocinfo.updatestackalignment(alignment: longint);
+      begin
+        fstackalignment:=max(fstackalignment,alignment);
+      end;
+
     function tprocinfo.get_first_nestedproc: tprocinfo;
       begin
         if assigned(nestedprocs) then

+ 1 - 0
compiler/tgobj.pas

@@ -252,6 +252,7 @@ implementation
          bestslot:=nil;
          tl:=nil;
          bestatend:=false;
+         current_procinfo.updatestackalignment(alignment);
 
          if size=0 then
           begin