+ introduced tai_import_module and tai_import_name that represent the

.import_module and .import_name assembler directives
This commit is contained in:
Nikolay Nikolov 2021-09-24 22:14:32 +03:00
parent 459bb0fa18
commit a6e75d52f7
4 changed files with 57 additions and 9 deletions

View File

@ -96,6 +96,8 @@ interface
ait_local,
ait_functype,
ait_tagtype,
ait_import_module,
ait_import_name,
{$endif}
{ SEH directives used in ARM,MIPS and x86_64 COFF targets }
ait_seh_directive,
@ -244,6 +246,8 @@ interface
'local',
'functype',
'tagtype',
'import_module',
'import_name',
{$endif}
'cfi',
'seh_directive',
@ -359,7 +363,7 @@ interface
ait_llvmmetadatarefoperand,
{$endif llvm}
{$ifdef wasm}
ait_importexport,ait_local,ait_functype,ait_tagtype,
ait_importexport,ait_local,ait_functype,ait_tagtype,ait_import_module,ait_import_name,
{$endif wasm}
ait_seh_directive,
ait_cfi,

View File

@ -1650,6 +1650,20 @@ implementation
WriteImportExport(tai_impexp(hp));
ait_tagtype:
WriteTagType(tai_tagtype(hp));
ait_import_module:
begin
writer.AsmWrite(#9'.import_module'#9);
writer.AsmWrite(tai_import_module(hp).symname);
writer.AsmWrite(', ');
writer.AsmWriteLn(tai_import_module(hp).importmodule);
end;
ait_import_name:
begin
writer.AsmWrite(#9'.import_name'#9);
writer.AsmWrite(tai_import_name(hp).symname);
writer.AsmWrite(', ');
writer.AsmWriteLn(tai_import_name(hp).importname);
end;
{$endif WASM}
else

View File

@ -125,6 +125,22 @@ uses
constructor create(const atagname: string; aparams: TWasmResultType);
end;
{ tai_import_module }
tai_import_module = class(tai)
symname: string;
importmodule: string;
constructor create(const asymname, aimportmodule: string);
end;
{ tai_import_name }
tai_import_name = class(tai)
symname: string;
importname: string;
constructor create(const asymname, aimportname: string);
end;
procedure InitAsm;
procedure DoneAsm;
@ -133,6 +149,26 @@ uses
implementation
{ tai_import_name }
constructor tai_import_name.create(const asymname, aimportname: string);
begin
inherited Create;
typ:=ait_import_name;
symname:=asymname;
importname:=aimportname;
end;
{ tai_import_module }
constructor tai_import_module.create(const asymname, aimportmodule: string);
begin
inherited Create;
typ:=ait_import_module;
symname:=asymname;
importmodule:=aimportmodule;
end;
{ tai_functype }
constructor tai_functype.create(const afuncname: string; afunctype: TWasmFuncType);

View File

@ -75,16 +75,10 @@ implementation
begin
list:=TAsmList.Create;
thlcgwasm(hlcg).g_procdef(list,proc);
list.Concat(tai_import_module.create(proc.mangledname,proc.import_dll^));
list.Concat(tai_import_name.create(proc.mangledname,proc.import_name^));
WriteTree(list);
list.free;
writer.AsmWrite(#9'.import_module'#9);
writer.AsmWrite(proc.mangledname);
writer.AsmWrite(', ');
writer.AsmWriteLn(proc.import_dll^);
writer.AsmWrite(#9'.import_name'#9);
writer.AsmWrite(proc.mangledname);
writer.AsmWrite(', ');
writer.AsmWriteLn(proc.import_name^);
end;
var