* LLVM=: also merge varargs paralocs

git-svn-id: branches/debug_eh@41520 -
This commit is contained in:
Jonas Maebe 2019-02-27 21:13:49 +00:00
parent e720a1f306
commit 8f6820a9f1

View File

@ -49,12 +49,14 @@ unit llvmpara;
function param_use_paraloc(const cgpara: tcgpara): boolean; override;
procedure createtempparaloc(list: TAsmList; calloption: tproccalloption; parasym: tparavarsym; can_use_final_stack_loc: boolean; var cgpara: TCGPara); override;
function create_paraloc_info(p: tabstractprocdef; side: tcallercallee): longint; override;
function create_varargs_paraloc_info(p: tabstractprocdef; side: tcallercallee; varargspara: tvarargsparalist): longint; override;
function get_funcretloc(p: tabstractprocdef; side: tcallercallee; forcetempdef: tdef): tcgpara; override;
private
procedure create_paraloc_info_internllvm(p: tabstractprocdef; side: tcallercallee);
procedure set_llvm_paraloc_name(p: tabstractprocdef; hp: tparavarsym; var para: tcgpara);
procedure add_llvm_callee_paraloc_names(p: tabstractprocdef);
procedure reducetosingleregparaloc(paraloc: PCGParaLocation; def: tdef; reg: tregister);
procedure reduceparalocs(p: tabstractprocdef; side: tcallercallee);
procedure reduceparalocs(p: tabstractprocdef; side: tcallercallee; paras: tparalist);
end;
@ -108,15 +110,15 @@ unit llvmpara;
end;
procedure tllvmparamanager.reduceparalocs(p: tabstractprocdef; side: tcallercallee);
procedure tllvmparamanager.reduceparalocs(p: tabstractprocdef; side: tcallercallee; paras: tparalist);
var
paranr: longint;
hp: tparavarsym;
paraloc: PCGParaLocation;
begin
for paranr:=0 to p.paras.count-1 do
for paranr:=0 to paras.count-1 do
begin
hp:=tparavarsym(p.paras[paranr]);
hp:=tparavarsym(paras[paranr]);
paraloc:=hp.paraloc[side].location;
if assigned(paraloc) and
assigned(paraloc^.next) and
@ -211,21 +213,17 @@ unit llvmpara;
function tllvmparamanager.create_paraloc_info(p: tabstractprocdef; side: tcallercallee): longint;
begin
result:=inherited create_paraloc_info(p, side);
{ on the calleeside, llvm declares the parameters similar to Pascal or C
(a list of parameters and their types), but they correspond more
closely to parameter locations than to parameters -> add names to the
locations }
if (side=calleeside) and
not(po_assembler in p.procoptions) then
begin
add_llvm_callee_paraloc_names(p);
reduceparalocs(p,side);
end
else if side=callerside then
begin
reduceparalocs(p,side);
end;
result:=inherited;
create_paraloc_info_internllvm(p,side);
end;
function tllvmparamanager.create_varargs_paraloc_info(p: tabstractprocdef; side: tcallercallee; varargspara: tvarargsparalist): longint;
begin
result:=inherited;
create_paraloc_info_internllvm(p,side);
if assigned(varargspara) then
reduceparalocs(p,side,varargspara);
end;
@ -252,6 +250,25 @@ unit llvmpara;
end;
procedure tllvmparamanager.create_paraloc_info_internllvm(p: tabstractprocdef; side: tcallercallee);
begin
{ on the calleeside, llvm declares the parameters similar to Pascal or C
(a list of parameters and their types), but they correspond more
closely to parameter locations than to parameters -> add names to the
locations }
if (side=calleeside) and
not(po_assembler in p.procoptions) then
begin
add_llvm_callee_paraloc_names(p);
reduceparalocs(p,side,p.paras);
end
else if side=callerside then
begin
reduceparalocs(p,side,p.paras);
end;
end;
{ hp non-nil: parasym to check
hp nil: function result
}