Sfoglia il codice sorgente

+ paramgr.pas: provide generic implementation of getintparaloc(). Once this method has been changed to use the procdef, it can reuse 'regular' parameter locations created by create_paraloc_info, so separate cpu-specific implementations of getintparaloc are no longer necessary.
* parabase.pas: fixed tcgpara.getcopy, it should not modify the source object.

git-svn-id: trunk@24716 -

sergei 12 anni fa
parent
commit
4714dc2218
2 ha cambiato i file con 15 aggiunte e 5 eliminazioni
  1. 5 4
      compiler/parabase.pas
  2. 10 1
      compiler/paramgr.pas

+ 5 - 4
compiler/parabase.pas

@@ -168,15 +168,16 @@ implementation
 
     function tcgpara.getcopy:tcgpara;
       var
-        hlocation : pcgparalocation;
+        srcloc,hlocation : pcgparalocation;
       begin
         result.init;
-        while assigned(location) do
+        srcloc:=location;
+        while assigned(srcloc) do
           begin
             hlocation:=result.add_location;
-            hlocation^:=location^;
+            hlocation^:=srcloc^;
             hlocation^.next:=nil;
-            location:=location^.next;
+            srcloc:=srcloc^.next;
           end;
         result.alignment:=alignment;
         result.size:=size;

+ 10 - 1
compiler/paramgr.pas

@@ -80,7 +80,7 @@ unit paramgr;
           function get_volatile_registers_flags(calloption : tproccalloption):tcpuregisterset;virtual;
           function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;virtual;
 
-          procedure getintparaloc(pd: tabstractprocdef; nr : longint; var cgpara: tcgpara);virtual;abstract;
+          procedure getintparaloc(pd: tabstractprocdef; nr : longint; var cgpara: tcgpara);virtual;
 
           {# allocate an individual pcgparalocation that's part of a tcgpara
 
@@ -602,6 +602,15 @@ implementation
       end;
 
 
+    procedure tparamanager.getintparaloc(pd: tabstractprocdef; nr : longint; var cgpara: tcgpara);
+      begin
+        if (nr<1) or (nr>pd.paras.count) then
+          InternalError(2013060101);
+        pd.init_paraloc_info(callerside);
+        cgpara:=tparavarsym(pd.paras[nr-1]).paraloc[callerside].getcopy;
+      end;
+
+
 initialization
   ;
 finalization