* most of tcgcallparanode.secondcallparan's code was moved into two new methods:

secondcallparan_do_secondpass and secondcallparan_after_secondpass. These are
  protected methods, meant to be called in secondcallparan's descendants, to
  provide alternative parameter handling algorithms (needed for WebAssembly). No
  functional changes.
This commit is contained in:
Nikolay Nikolov 2025-02-25 07:21:13 +02:00
parent b2f5f6ac7d
commit e237da95d2

View File

@ -40,6 +40,9 @@ interface
procedure push_formal_para;virtual;
procedure push_copyout_para;virtual;abstract;
function maybe_push_unused_para:boolean;virtual;
procedure secondcallparan_do_secondpass;
procedure secondcallparan_after_secondpass;
public
tempcgpara : tcgpara;
@ -317,21 +320,18 @@ implementation
end;
procedure tcgcallparanode.secondcallparan;
var
pushaddr: boolean;
begin
if not(assigned(parasym)) then
internalerror(200304242);
{ Skip nothingn nodes which are used after disabling
a parameter }
if (left.nodetype<>nothingn) then
procedure tcgcallparanode.secondcallparan_do_secondpass;
begin
if assigned(fparainit) then
secondpass(fparainit);
secondpass(left);
end;
procedure tcgcallparanode.secondcallparan_after_secondpass;
var
pushaddr: boolean;
begin
hlcg.maybe_change_load_node_reg(current_asmdata.CurrAsmList,left,true);
paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,not followed_by_stack_tainting_call_cached,tempcgpara);
@ -440,6 +440,20 @@ implementation
location_copy(aktcallnode.location,left.location);
end;
procedure tcgcallparanode.secondcallparan;
begin
if not(assigned(parasym)) then
internalerror(200304242);
{ Skip nothingn nodes which are used after disabling
a parameter }
if (left.nodetype<>nothingn) then
begin
secondcallparan_do_secondpass;
secondcallparan_after_secondpass;
end;
{ next parameter }
if assigned(right) then
tcallparanode(right).secondcallparan;