浏览代码

* record the alignment of temps, and set it when creating a reference based
on a temp instead of assuming it's always aligned to a multiple of
the stackpointer size

git-svn-id: branches/hlcgllvm@28490 -

Jonas Maebe 11 年之前
父节点
当前提交
0fbaa9e924
共有 3 个文件被更改,包括 5 次插入1 次删除
  1. 1 1
      compiler/hlcgobj.pas
  2. 1 0
      compiler/llvm/tgllvm.pas
  3. 3 0
      compiler/tgobj.pas

+ 1 - 1
compiler/hlcgobj.pas

@@ -812,7 +812,7 @@ implementation
 
 
   procedure thlcgobj.temp_to_ref(p: ptemprecord; out ref: treference);
   procedure thlcgobj.temp_to_ref(p: ptemprecord; out ref: treference);
     begin
     begin
-      reference_reset_base(ref,voidstackpointertype,current_procinfo.framepointer,p^.pos,voidstackpointertype.size);
+      reference_reset_base(ref,voidstackpointertype,current_procinfo.framepointer,p^.pos,p^.alignment);
     end;
     end;
 
 
   procedure thlcgobj.a_label(list: TAsmList; l: tasmlabel); inline;
   procedure thlcgobj.a_label(list: TAsmList; l: tasmlabel); inline;

+ 1 - 0
compiler/llvm/tgllvm.pas

@@ -93,6 +93,7 @@ implementation
         tl^.temptype:=temptype;
         tl^.temptype:=temptype;
         tl^.def:=def;
         tl^.def:=def;
         tl^.fini:=fini;
         tl^.fini:=fini;
+        tl^.alignment:=alignment;
         tl^.pos:=getsupreg(ref.base);
         tl^.pos:=getsupreg(ref.base);
         tl^.size:=size;
         tl^.size:=size;
         tl^.next:=templist;
         tl^.next:=templist;

+ 3 - 0
compiler/tgobj.pas

@@ -44,6 +44,7 @@ unit tgobj;
          temptype   : ttemptype;
          temptype   : ttemptype;
          { finalize this temp if it's a managed type }
          { finalize this temp if it's a managed type }
          fini       : boolean;
          fini       : boolean;
+         alignment  : shortint;
          pos        : asizeint;
          pos        : asizeint;
          size       : asizeint;
          size       : asizeint;
          def        : tdef;
          def        : tdef;
@@ -393,6 +394,7 @@ implementation
                { Create new block and resize the old block }
                { Create new block and resize the old block }
                tl^.fini:=fini;
                tl^.fini:=fini;
                tl^.size:=size;
                tl^.size:=size;
+               tl^.alignment:=alignment;
                tl^.nextfree:=nil;
                tl^.nextfree:=nil;
                { Resize the old block }
                { Resize the old block }
                dec(bestslot^.size,size);
                dec(bestslot^.size,size);
@@ -421,6 +423,7 @@ implementation
               end;
               end;
 
 
             tl^.fini:=fini;
             tl^.fini:=fini;
+            tl^.alignment:=alignment;
             tl^.size:=size;
             tl^.size:=size;
             tl^.next:=templist;
             tl^.next:=templist;
             tl^.nextfree:=nil;
             tl^.nextfree:=nil;