Browse Source

* moved creating a reference based on a ttemprecord to a new virtual method
called temp_to_ref()

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

Jonas Maebe 11 years ago
parent
commit
830952cc3b
1 changed files with 13 additions and 4 deletions
  1. 13 4
      compiler/hlcgobj.pas

+ 13 - 4
compiler/hlcgobj.pas

@@ -38,7 +38,8 @@ unit hlcgobj;
        cpubase,cgbase,cgutils,parabase,
        cpubase,cgbase,cgutils,parabase,
        aasmbase,aasmtai,aasmdata,aasmcpu,
        aasmbase,aasmtai,aasmdata,aasmcpu,
        symconst,symbase,symtype,symsym,symdef,
        symconst,symbase,symtype,symsym,symdef,
-       node,nutils
+       node,nutils,
+       tgobj
        ;
        ;
 
 
     type
     type
@@ -123,6 +124,9 @@ unit hlcgobj;
           }
           }
           procedure reference_reset_base(var ref: treference; regsize: tdef; reg: tregister; offset, alignment: longint); virtual;
           procedure reference_reset_base(var ref: treference; regsize: tdef; reg: tregister; offset, alignment: longint); virtual;
 
 
+          {# Returns a reference corresponding to a temp }
+          procedure temp_to_ref(p: ptemprecord; out ref: treference); virtual;
+
           {# Emit a label to the instruction stream. }
           {# Emit a label to the instruction stream. }
           procedure a_label(list : TAsmList;l : tasmlabel); inline;
           procedure a_label(list : TAsmList;l : tasmlabel); inline;
 
 
@@ -638,7 +642,7 @@ implementation
        verbose,defutil,paramgr,
        verbose,defutil,paramgr,
        symtable,
        symtable,
        nbas,ncon,nld,ncgrtti,pass_1,pass_2,
        nbas,ncon,nld,ncgrtti,pass_1,pass_2,
-       cpuinfo,cgobj,tgobj,cutils,procinfo,
+       cpuinfo,cgobj,cutils,procinfo,
 {$ifdef x86}
 {$ifdef x86}
        cgx86,
        cgx86,
 {$endif x86}
 {$endif x86}
@@ -806,6 +810,11 @@ implementation
       ref.offset:=offset;
       ref.offset:=offset;
     end;
     end;
 
 
+  procedure thlcgobj.temp_to_ref(p: ptemprecord; out ref: treference);
+    begin
+      reference_reset_base(ref,voidstackpointertype,current_procinfo.framepointer,p^.pos,voidstackpointertype.size);
+    end;
+
   procedure thlcgobj.a_label(list: TAsmList; l: tasmlabel); inline;
   procedure thlcgobj.a_label(list: TAsmList; l: tasmlabel); inline;
     begin
     begin
       cg.a_label(list,l);
       cg.a_label(list,l);
@@ -4479,7 +4488,7 @@ implementation
             assigned(hp^.def) and
             assigned(hp^.def) and
             is_managed_type(hp^.def) then
             is_managed_type(hp^.def) then
           begin
           begin
-            reference_reset_base(href,voidstackpointertype,current_procinfo.framepointer,hp^.pos,voidstackpointertype.size);
+            temp_to_ref(hp,href);
             g_initialize(list,hp^.def,href);
             g_initialize(list,hp^.def,href);
           end;
           end;
          hp:=hp^.next;
          hp:=hp^.next;
@@ -4528,7 +4537,7 @@ implementation
             is_managed_type(hp^.def) then
             is_managed_type(hp^.def) then
           begin
           begin
             include(current_procinfo.flags,pi_needs_implicit_finally);
             include(current_procinfo.flags,pi_needs_implicit_finally);
-            reference_reset_base(href,voidstackpointertype,current_procinfo.framepointer,hp^.pos,voidstackpointertype.size);
+            temp_to_ref(hp,href);
             g_finalize(list,hp^.def,href);
             g_finalize(list,hp^.def,href);
           end;
           end;
          hp:=hp^.next;
          hp:=hp^.next;