Browse Source

+ use optimize_op_const in thlcgwasm.a_op_const_stack as well

Nikolay Nikolov 21 hours ago
parent
commit
3762a70423
1 changed files with 14 additions and 2 deletions
  1. 14 2
      compiler/wasm32/hlcgcpu.pas

+ 14 - 2
compiler/wasm32/hlcgcpu.pas

@@ -728,13 +728,25 @@ implementation
 
 
   procedure thlcgwasm.a_op_const_stack(list: TAsmList;op: topcg;size: tdef;a: tcgint);
   procedure thlcgwasm.a_op_const_stack(list: TAsmList;op: topcg;size: tdef;a: tcgint);
     begin
     begin
+      optimize_op_const(size,op,a);
+
       case op of
       case op of
+        OP_NONE:
+          ;
+        OP_MOVE:
+          begin
+            list.concat(taicpu.op_none(a_drop));
+            decstack(list,1);
+            a_load_const_stack(list,size,a,R_INTREGISTER);
+          end;
         OP_NEG,OP_NOT:
         OP_NEG,OP_NOT:
           internalerror(2011010801);
           internalerror(2011010801);
         else
         else
-          a_load_const_stack(list,size,a,R_INTREGISTER);
+          begin
+            a_load_const_stack(list,size,a,R_INTREGISTER);
+            a_op_stack(list,op,size);
+          end;
       end;
       end;
-      a_op_stack(list,op,size);
     end;
     end;
 
 
   procedure thlcgwasm.a_op_reg_stack(list: TAsmList; op: topcg; size: tdef; reg: tregister);
   procedure thlcgwasm.a_op_reg_stack(list: TAsmList; op: topcg; size: tdef; reg: tregister);