From 0fae32d2b7f7a4c8f1fe14dba3f0c01e703105db Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 4 Jan 2021 11:06:41 +0000 Subject: [PATCH] * simplified if-then-else code generation, since we now support void 'if' instructions git-svn-id: branches/wasm@48029 - --- compiler/wasm32/nwasmflw.pas | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/compiler/wasm32/nwasmflw.pas b/compiler/wasm32/nwasmflw.pas index 45c5e9ee67..9e60b07ce2 100644 --- a/compiler/wasm32/nwasmflw.pas +++ b/compiler/wasm32/nwasmflw.pas @@ -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