Redefine `invert-cc-noncommutative'. This was originally designed to
authorChris Hanson <org/chris-hanson/cph>
Thu, 3 Nov 1988 07:16:11 +0000 (07:16 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 3 Nov 1988 07:16:11 +0000 (07:16 +0000)
be like `invert-cc'.  However, it is used to adjust the condition code
for the situation of reversing the arguments to a conditional, while
`invert-cc' is used to adjust for reversing the branches.  These are
quite different.

v7/src/compiler/machines/bobcat/lapgen.scm

index 1528de9982863f1043b95963e60f2fd4bf48c73c..533bb2dd86c3b0a78d8cbb4a6bf971f2c5a2a6b1 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.14 1988/11/02 21:55:33 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.15 1988/11/03 07:16:11 cph Exp $
 
 Copyright (c) 1988 Massachusetts Institute of Technology
 
@@ -191,9 +191,22 @@ MIT in each case. |#
           (error "INVERT-CC: Not a known CC" cc))))
 
 (define (invert-cc-noncommutative cc)
-  (if (cc-commutative? cc)
-      cc
-      (invert-cc cc)))
+  ;; Despite the fact that the name of this procedure is similar to
+  ;; that of `invert-cc', it is quite different.  `invert-cc' is used
+  ;; when the branches of a conditional are being exchanged, while
+  ;; this is used when the arguments are being exchanged.
+  (cdr (or (assq cc
+                '((HI . LO) (LO . HI)
+                  (HS . LS) (LS . HS)
+                  (CC . LS) (CS . HI)
+                  (PL . MI) (MI . PL)
+                  (GE . LE) (LE . GE)
+                  (GT . LT) (LT . GT)
+                  (T . T) (F . F)
+                  (NE . NE) (EQ . EQ)
+                  (VC . VC) (VS . VS)
+                  ))
+          (error "INVERT-CC-NONCOMMUTATIVE: Not a known CC" cc))))
 
 (define-integrable (cc-commutative? cc)
   (memq cc '(T F NE EQ)))