Browse Source

+ fixed bug0163 (set1 <= set2 support)

Jonas Maebe 26 years ago
parent
commit
b9a674b9fe
2 changed files with 63 additions and 7 deletions
  1. 30 5
      compiler/cg386add.pas
  2. 33 2
      compiler/tcadd.pas

+ 30 - 5
compiler/cg386add.pas

@@ -377,14 +377,36 @@ implementation
         { handle operations }
         case p^.treetype of
           equaln,
-        unequaln : begin
+        unequaln
+{$IfNDef NoSetInclusion}
+        ,lten, gten
+{$EndIf NoSetInclusion}
+                  : begin
                      cmpop:=true;
                      del_reference(p^.left^.location.reference);
                      del_reference(p^.right^.location.reference);
                      pushusedregisters(pushedregs,$ff);
-                     emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
-                     emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
-                     emitcall('FPC_SET_COMP_SETS',true);
+{$IfNDef NoSetInclusion}
+                     If (p^.treetype in [equaln, unequaln, lten]) Then
+                       Begin
+{$EndIf NoSetInclusion}
+                         emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
+                         emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
+{$IfNDef NoSetInclusion}
+                       End
+                     Else  {gten = lten, if the arguments are reversed}
+                       Begin
+                         emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
+                         emitpushreferenceaddr(exprasmlist,p^.right^.location.reference);
+                       End;
+                     Case p^.treetype of
+                       equaln, unequaln:
+{$EndIf NoSetInclusion}
+                         emitcall('FPC_SET_COMP_SETS',true);
+{$IfNDef NoSetInclusion}
+                       lten, gten: emitcall('FPC_SET_CONTAINS_SETS',true)
+                     End;
+{$EndIf NoSetInclusion}
                      maybe_loadesi;
                      popusedregisters(pushedregs);
                      ungetiftemp(p^.left^.location.reference);
@@ -1737,7 +1759,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.39  1999-01-19 10:18:58  florian
+  Revision 1.40  1999-01-20 17:39:22  jonas
+    + fixed bug0163 (set1 <= set2 support)
+
+  Revision 1.39  1999/01/19 10:18:58  florian
     * bug with mul. of dwords fixed, reported by Alexander Stohr
     * some changes to compile with TP
     + small enhancements for the new code generator

+ 33 - 2
compiler/tcadd.pas

@@ -545,7 +545,11 @@ implementation
                  end
                 else
                  begin
-                   if not(p^.treetype in [addn,subn,symdifn,muln,equaln,unequaln]) then
+                   if not(p^.treetype in [addn,subn,symdifn,muln,equaln,unequaln
+{$IfNDef NoSetInclusion}
+                                          ,lten,gten
+{$EndIf NoSetInclusion}
+                   ]) then
                     CGMessage(type_e_set_operation_unknown);
                  { right def must be a also be set }
                    if (rd^.deftype<>setdef) or not(is_equal(rd,ld)) then
@@ -634,6 +638,30 @@ implementation
                                    end;
                                  t:=genordinalconstnode(ord(b),booldef);
                                end;
+{$IfNDef NoSetInclusion}
+                       lten : Begin
+                                b := true;
+                                For i := 0 to 31 Do
+                                  If (p^.right^.value_set^[i] And p^.left^.value_set^[i]) <>
+                                      p^.left^.value_set^[i] Then
+                                    Begin
+                                      b := false;
+                                      Break
+                                    End;
+                                t := genordinalconstnode(ord(b),booldef);
+                              End;
+                       gten : Begin
+                                b := true;
+                                For i := 0 to 31 Do
+                                  If (p^.left^.value_set^[i] And p^.right^.value_set^[i]) <>
+                                      p^.right^.value_set^[i] Then
+                                    Begin
+                                      b := false;
+                                      Break
+                                    End;
+                                t := genordinalconstnode(ord(b),booldef);
+                              End;
+{$EndIf NoSetInclusion}
                      end;
                      dispose(resultset);
                      disposetree(p);
@@ -973,7 +1001,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.19  1998-12-30 13:35:35  peter
+  Revision 1.20  1999-01-20 17:39:26  jonas
+    + fixed bug0163 (set1 <= set2 support)
+
+  Revision 1.19  1998/12/30 13:35:35  peter
     * fix for boolean=true compares
 
   Revision 1.18  1998/12/15 17:12:35  peter