* fixed the WebAssembly inline asm call instruction with the internal assembler writer

This commit is contained in:
Nikolay Nikolov 2024-07-20 21:53:24 +03:00
parent d8340641cc
commit b08b5bf136
2 changed files with 11 additions and 3 deletions

View File

@ -45,7 +45,8 @@ type
TOprType=(OPR_NONE,OPR_CONSTANT,OPR_SYMBOL,OPR_LOCAL,
OPR_REFERENCE,OPR_REGISTER,OPR_COND,OPR_REGSET,
OPR_SHIFTEROP,OPR_MODEFLAGS,OPR_SPECIALREG,
OPR_REGPAIR,OPR_FENCEFLAGS,OPR_INDEXEDREG,OPR_FLOATCONSTANT);
OPR_REGPAIR,OPR_FENCEFLAGS,OPR_INDEXEDREG,OPR_FLOATCONSTANT,
OPR_FUNCTYPE);
TOprRec = record
case typ:TOprType of
@ -91,6 +92,7 @@ type
{$endif aarch64}
{$ifdef wasm32}
OPR_FLOATCONSTANT: (floatval:double);
OPR_FUNCTYPE : (functype: TWasmFuncType);
{$endif wasm32}
end;
@ -1345,6 +1347,8 @@ end;
else
internalerror(2024072001);
end;
OPR_FUNCTYPE:
ai.loadfunctype(i-1,functype);
{$endif wasm32}
{ ignore wrong operand }
OPR_NONE:

View File

@ -81,7 +81,7 @@ Unit rawasmtext;
{ aasm }
cpuinfo,aasmtai,aasmdata,aasmcpu,
{ symtable }
symconst,symbase,symtype,symsym,symtable,symdef,symutil,
symconst,symbase,symtype,symsym,symtable,symdef,symutil,symcpu,
{ parser }
scanner,pbase,
procinfo,
@ -933,9 +933,13 @@ Unit rawasmtext;
if Tprocsym(srsym).ProcdefList.Count>1 then
Message(asmr_w_calling_overload_func);
result.ops:=1;
result.ops:=2;
result.operands[1].opr.typ:=OPR_SYMBOL;
result.operands[1].opr.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(srsym).ProcdefList[0]).mangledname,AT_FUNCTION);
result.operands[2].opr.typ:=OPR_FUNCTYPE;
result.operands[2].opr.functype:=tcpuprocdef(tprocsym(srsym).ProcdefList[0]).create_functype;
Consume(AS_ID);
end;
else