* group tai_local directives, so that they are output as a single directive with comma separated types

git-svn-id: branches/wasm@46714 -
This commit is contained in:
nickysn 2020-08-26 23:36:28 +00:00
parent b3a4f160bc
commit 35e83d5524
3 changed files with 20 additions and 7 deletions

View File

@ -1587,14 +1587,13 @@ implementation
{$ifdef WASM}
ait_local:
begin
writer.AsmWrite(#9'.local'#9);
if tai_local(hp).first then
writer.AsmWrite(#9'.local'#9)
else
writer.AsmWrite(', ');
writer.AsmWrite(gas_wasm_basic_type_str[tai_local(hp).bastyp]);
if tai_local(hp).name<>'' then
begin
writer.AsmWrite(#9+asminfo^.comment);
writer.AsmWrite(tai_local(hp).name);
end;
writer.AsmLn;
if tai_local(hp).last then
writer.AsmLn;
end;
ait_functype:
WriteFuncType(tai_functype(hp));

View File

@ -105,6 +105,8 @@ uses
tai_local = class(tai)
bastyp: TWasmBasicType;
name : string;
first: boolean;
last: boolean;
constructor create(abasictype: TWasmBasicType; const aname: string = '');
end;

View File

@ -71,6 +71,7 @@ implementation
var
templist : TAsmList;
l : TWasmLocal;
first_tai_local, last_tai_local: tai_local;
begin
templist := TAsmList.create;
l := ttgwasm(tg).localvars.first;
@ -81,6 +82,17 @@ implementation
aktproccode.insertListBefore(findfirst_tai_local(aktproccode),templist);
templist.Free;
first_tai_local:=findfirst_tai_local(aktproccode);
if assigned(first_tai_local) then
begin
first_tai_local.first:=true;
{ also find the last tai_local in the group }
last_tai_local:=first_tai_local;
while assigned(last_tai_local.Next) and (tai(last_tai_local.Next).typ=ait_local) do
last_tai_local:=tai_local(last_tai_local.Next);
last_tai_local.last:=true;
end;
inherited postprocess_code;
end;