* generate jumpless code for the IN node for WebAssembly. TODO: this needs to be

refactored, so the WebAssembly-specific code generation code goes in the wasm
  in node descendant class.

git-svn-id: branches/wasm@48178 -
This commit is contained in:
nickysn 2021-01-18 22:32:35 +00:00
parent c8e130d525
commit c4e8f091ec

View File

@ -96,6 +96,9 @@ implementation
symconst,symdef,symsym,defutil,
pass_2,tgobj,
nbas,ncon,ncgflw,
{$ifdef WASM}
hlcgcpu,aasmcpu,
{$endif WASM}
ncgutil,hlcgobj;
@ -491,6 +494,18 @@ implementation
((tenumdef(left.resultdef).min < aint(tsetdef(right.resultdef).setbase)) or
(tenumdef(left.resultdef).max > aint(tsetdef(right.resultdef).setmax)))) then
begin
{$ifdef WASM}
needslabel := True;
thlcgwasm(hlcg).a_cmp_const_reg_stack(current_asmdata.CurrAsmList, opdef, OC_A, tsetdef(right.resultdef).setmax-tsetdef(right.resultdef).setbase, pleftreg);
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_if));
thlcgwasm(hlcg).incblock;
thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1);
hlcg.a_load_const_reg(current_asmdata.CurrAsmList, uopdef, 0, location.register);
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_else));
{$else WASM}
current_asmdata.getjumplabel(l);
current_asmdata.getjumplabel(l2);
needslabel := True;
@ -501,13 +516,21 @@ implementation
hlcg.a_jmp_always(current_asmdata.CurrAsmList, l2);
hlcg.a_label(current_asmdata.CurrAsmList, l);
{$endif WASM}
end;
hlcg.a_bit_test_reg_loc_reg(current_asmdata.CurrAsmList,opdef,right.resultdef,uopdef,
pleftreg,right.location,location.register);
if needslabel then
hlcg.a_label(current_asmdata.CurrAsmList, l2);
begin
{$ifdef WASM}
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_if));
thlcgwasm(hlcg).decblock;
{$else WASM}
hlcg.a_label(current_asmdata.CurrAsmList, l2);
{$endif WASM}
end
end;
{$ifndef cpuhighleveltarget}
location.size := def_cgsize(resultdef);