* moved the preparation of the locals asm list in tcpuprocinfo.postprocess_code to a local subroutine

This commit is contained in:
Nikolay Nikolov 2023-10-18 01:47:42 +03:00
parent db23f54f8c
commit 0e39e7c12d

View File

@ -650,32 +650,36 @@ implementation
asmlist:=l2; asmlist:=l2;
end; end;
var function prepare_locals: TAsmList;
localslist: TAsmList; var
l : TWasmLocal; local: tai_local;
first, labels_resolved: Boolean; first: Boolean;
local: tai_local; l : TWasmLocal;
first_tai_functype: tai_functype;
begin
first_tai_functype:=findfirst_tai_functype(aktproccode);
localslist:=TAsmList.create;
local:=nil;
first:=true;
l:=ttgwasm(tg).localvars.first;
FFirstFreeLocal:=Length(first_tai_functype.functype.params);
while Assigned(l) do
begin begin
local:=tai_local.create(l.typ); result:=TAsmList.create;
local.first:=first; local:=nil;
first:=false; first:=true;
localslist.Concat(local); l:=ttgwasm(tg).localvars.first;
l:=l.nextseq; FFirstFreeLocal:=Length(findfirst_tai_functype(aktproccode).functype.params);
Inc(FFirstFreeLocal); while Assigned(l) do
begin
local:=tai_local.create(l.typ);
local.first:=first;
first:=false;
result.Concat(local);
l:=l.nextseq;
Inc(FFirstFreeLocal);
end;
if assigned(local) then
local.last:=true;
end; end;
if assigned(local) then
local.last:=true; var
aktproccode.insertListAfter(first_tai_functype,localslist); localslist: TAsmList;
labels_resolved: Boolean;
begin
localslist:=prepare_locals;
aktproccode.insertListAfter(findfirst_tai_functype(aktproccode),localslist);
localslist.Free; localslist.Free;
replace_local_frame_pointer(aktproccode); replace_local_frame_pointer(aktproccode);