Browse Source

+ implemented the boolean NOT node for WebAssembly

git-svn-id: branches/wasm@48180 -
nickysn 4 years ago
parent
commit
9fdc8c141c
1 changed files with 18 additions and 1 deletions
  1. 18 1
      compiler/wasm32/nwasmmat.pas

+ 18 - 1
compiler/wasm32/nwasmmat.pas

@@ -40,7 +40,9 @@ interface
          procedure pass_generate_code;override;
       end;
 
-      twasmnotnode = class(tcghlnotnode)
+      twasmnotnode = class(tcgnotnode)
+      protected
+        procedure second_boolean;override;
       end;
 
       twasmunaryminusnode = class(tcgunaryminusnode)
@@ -185,6 +187,21 @@ implementation
       end;
 
 
+{*****************************************************************************
+                               twasmnotnode
+*****************************************************************************}
+
+    procedure twasmnotnode.second_boolean;
+      begin
+        secondpass(left);
+        if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
+          hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
+        location_reset(location,LOC_REGISTER,left.location.size);
+        location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
+        { perform the NOT operation }
+        hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,left.resultdef,left.location.register,location.register);
+      end;
+
 {*****************************************************************************
                             twasmunaryminustnode
 *****************************************************************************}