Browse Source

* fixed not(not()) removal

peter 23 năm trước cách đây
mục cha
commit
160103faba
1 tập tin đã thay đổi với 25 bổ sung23 xóa
  1. 25 23
      compiler/nmat.pas

+ 25 - 23
compiler/nmat.pas

@@ -45,7 +45,7 @@ interface
           function pass_1 : tnode;override;
           function pass_1 : tnode;override;
           function det_resulttype:tnode;override;
           function det_resulttype:tnode;override;
           { override the following if you want to implement }
           { override the following if you want to implement }
-          { parts explicitely in the code generator (CEC)   
+          { parts explicitely in the code generator (CEC)
             Should return nil, if everything will be handled
             Should return nil, if everything will be handled
             in the code generator
             in the code generator
           }
           }
@@ -340,7 +340,7 @@ implementation
         right := nil;
         right := nil;
         firstpass(result);
         firstpass(result);
       end;
       end;
-      
+
 
 
     function tshlshrnode.det_resulttype:tnode;
     function tshlshrnode.det_resulttype:tnode;
       var
       var
@@ -404,7 +404,7 @@ implementation
             regs:=1
             regs:=1
            end
            end
          else
          else
-           begin 
+           begin
              result := first_shlshr64bitint;
              result := first_shlshr64bitint;
              if assigned(result) then
              if assigned(result) then
                exit;
                exit;
@@ -578,25 +578,24 @@ implementation
 
 
          resulttype:=left.resulttype;
          resulttype:=left.resulttype;
 
 
-   {Try optmimizing ourself away.}
-   if left.nodetype=notn then
-      begin
-    {Double not. Remove both.}
-    t:=Tnotnode(left).left;
-    Tnotnode(left).left:=nil;
-    left:=t;
-    result:=t;
-    exit;
-      end;
-   if left.nodetype in [ltn,lten,equaln,unequaln,gtn,gten] then
-      begin
-    {Not of boolean expression. Turn around the operator and remove
-     the not.}
-    result:=left;
-    left.nodetype:=boolean_reverse[left.nodetype];
-    left:=nil;
-    exit;
-      end;
+         { Try optmimizing ourself away }
+         if left.nodetype=notn then
+           begin
+             { Double not. Remove both }
+             result:=Tnotnode(left).left;
+             Tnotnode(left).left:=nil;
+             exit;
+           end;
+
+         if left.nodetype in [ltn,lten,equaln,unequaln,gtn,gten] then
+           begin
+             { Not of boolean expression. Turn around the operator and remove
+               the not }
+             result:=left;
+             left.nodetype:=boolean_reverse[left.nodetype];
+             left:=nil;
+             exit;
+           end;
 
 
          { constant folding }
          { constant folding }
          if (left.nodetype=ordconstn) then
          if (left.nodetype=ordconstn) then
@@ -755,7 +754,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.38  2002-08-15 15:09:42  carl
+  Revision 1.39  2002-08-25 09:10:58  peter
+    * fixed not(not()) removal
+
+  Revision 1.38  2002/08/15 15:09:42  carl
     + fpu emulation helpers (ppu checking also)
     + fpu emulation helpers (ppu checking also)
 
 
   Revision 1.37  2002/08/14 19:26:55  carl
   Revision 1.37  2002/08/14 19:26:55  carl