aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-06-22 09:30:45 +0000
committerdos-reis <gdr@axiomatics.org>2011-06-22 09:30:45 +0000
commit0ce3502a3677bfb4fb58c664b7ae00d530e5bacf (patch)
treee09c4b162edfb242847aa7f65c0e92fa9e8babad /src
parent8b45d02f8f861fe0eab071ccbfcf5ef8bd6593d6 (diff)
downloadopen-axiom-0ce3502a3677bfb4fb58c664b7ae00d530e5bacf.tar.gz
* interp/g-opt.boot (optCond): Remove unreachable code.
(opt2bit): Tidy. (opt2bool): Likewise. * interp/bits.lisp (TRUTH-TO-BIT): Remove. (BIT-TO-TRUTH): Likewise. (BVEC-MAKE-FULL): Likewise. (BVEC-ELT): Likewise. (BVEC-SETELT): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/interp/bits.lisp9
-rw-r--r--src/interp/g-opt.boot29
-rw-r--r--src/interp/lisp-backend.boot4
4 files changed, 28 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c0e20a55..297b9991 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2011-06-22 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/g-opt.boot (optCond): Remove unreachable code.
+ (opt2bit): Tidy.
+ (opt2bool): Likewise.
+ * interp/bits.lisp (TRUTH-TO-BIT): Remove.
+ (BIT-TO-TRUTH): Likewise.
+ (BVEC-MAKE-FULL): Likewise.
+ (BVEC-ELT): Likewise.
+ (BVEC-SETELT): Likewise.
+
2011-06-21 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/Makefile.in (OBJS): Remove foam_l.$(FASLEXT), $(ASCOMP).
diff --git a/src/interp/bits.lisp b/src/interp/bits.lisp
index 5b20b3e7..8a97cb10 100644
--- a/src/interp/bits.lisp
+++ b/src/interp/bits.lisp
@@ -47,15 +47,6 @@
;;; SMW Nov 88: Created
-(defmacro truth-to-bit (x) `(cond (,x 1) ('else 0)))
-(defmacro bit-to-truth (b) `(eql ,b 1))
-
-(defun bvec-make-full (n x)
- (make-array (list n) :element-type 'bit :initial-element x))
-
-(defmacro bvec-elt (bv i) `(sbit ,bv ,i))
-(defmacro bvec-setelt (bv i x) `(setf (sbit ,bv ,i) ,x))
-
(defun bvec-greater (bv1 bv2)
(let ((pos (mismatch bv1 bv2)))
(cond ((or (null pos) (>= pos (length bv1))) nil)
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index f1dd8d2e..8a6c0d91 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -287,6 +287,9 @@ optCons (x is ["CONS",a,b]) ==
x
optCond (x is ['%when,:l]) ==
+ l is [['%true,c],:.] => c
+ l is [['%false,.],:.] => optCond ['%when,:rest l]
+ l is [['%otherwise,c]] => c
if l is [a,[aa,b]] and aa is '%otherwise and b is ['%when,:c] then
x.rest.rest := c
if l is [[p1,:c1],[p2,:c2],:.] then
@@ -680,10 +683,20 @@ optOr(x is ['%or,a,b]) ==
a is '%true => '%true
x
+-- Boolean <-> bit conversion.
+opt2bit ['%2bit,a] ==
+ optCond ['%when,[a,'%icst1],['%otherwise,'%icst0]]
+
+opt2bool ['%2bool,a] ==
+ a is '%icst0 => '%false
+ a is '%icst1 => '%true
+ optIeq ['%ieq,a,'%icst1]
+
optIeq(x is ['%ieq,a,b]) ==
integer? a and integer? b =>
- a = b => '%true
+ scalarEq?(a,b) => '%true
'%false
+ sameObject?(a,b) => '%true
x
optIlt(x is ['%ilt,a,b]) ==
@@ -752,23 +765,11 @@ optIquo(x is ['%iquo,a,b]) ==
integer? a and integer? b => a quo b
x
--- Boolean <-> bit conversion.
-opt2bit(x is ['%2bit,a]) ==
- a is '%true => 1
- a is '%false => 0
- x
-
-opt2bool(x is ['%2bool,a]) ==
- integer? a =>
- a = 1 => '%true
- '%false
- x
-
--%
--% optimizer hash table
--%
-for x in '( (%call optCall) _
+for x in '((%call optCall) _
(SEQ optSEQ)_
(LET optLET)_
(%bind optBind)_
diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot
index 3b254c78..a6fe5da7 100644
--- a/src/interp/lisp-backend.boot
+++ b/src/interp/lisp-backend.boot
@@ -446,8 +446,6 @@ for x in [
['%true, :'T],
-- unary Boolean operations
['%not, :'NOT],
- ['%2bit, :'TRUTH_-TO_-BIT],
- ['%2bool, :'BIT_-TO_-TRUTH],
-- binary Boolean operations
['%and, :'AND],
['%or, :'OR],
@@ -470,6 +468,8 @@ for x in [
['%blt, :'byteLessThan],
-- integer constants
+ ['%icst0, :0],
+ ['%icst1, :1],
['%icstmin, :'_$ShortMinimum],
['%icstmax, :'_$ShortMaximum],
-- unary integer operations.