* simplified if-then-else code generation, since we now support void 'if' instructions

git-svn-id: branches/wasm@48029 -
This commit is contained in:
nickysn 2021-01-04 11:06:41 +00:00
parent b6735179ed
commit 0fae32d2b7

View File

@ -152,34 +152,19 @@ begin
secondpass(left); // condition exprssions
current_asmdata.CurrAsmList.concat(taicpu.op_functype(a_if,TWasmFuncType.Create([],[wbt_i32])));
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_if));
thlcgwasm(hlcg).incblock;
secondpass(right); // then branchs
if Assigned(t1) then // else branch
begin
// 0 const on stack if used to return IF value
current_asmdata.CurrAsmList.concat(taicpu.op_const(a_i32_const, 1));
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_else));
secondpass(t1);
end
else // else dummy-branch
begin
// dummy else branch! todo: to be removed, when it's decided
// how to handle typeless-IF instructions (If without else)
current_asmdata.CurrAsmList.concat(taicpu.op_const(a_i32_const, 0));
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_else));
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_nop));
end;
// 0 const on stack if used to return IF value
current_asmdata.CurrAsmList.concat(taicpu.op_const(a_i32_const, 0));
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_if));
thlcgwasm(hlcg).decblock;
// clearing IF return value
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_drop));
end;
initialization