From 4714dc22189e825a882f80fae79b284cb918dbdf Mon Sep 17 00:00:00 2001 From: sergei Date: Sat, 1 Jun 2013 13:47:33 +0000 Subject: [PATCH] + 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 - --- compiler/parabase.pas | 9 +++++---- compiler/paramgr.pas | 11 ++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/compiler/parabase.pas b/compiler/parabase.pas index 4807bea4f6..a1f8c2a63c 100644 --- a/compiler/parabase.pas +++ b/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; diff --git a/compiler/paramgr.pas b/compiler/paramgr.pas index 6d2a49cec1..c00e094d62 100644 --- a/compiler/paramgr.pas +++ b/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