[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 11/12: Add "intset" syntax to construct intsets.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 11/12: Add "intset" syntax to construct intsets. |
Date: |
Tue, 02 Jun 2015 08:33:56 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit d78e5a260c8ffaa9a744076aa8c53cb7ce87a551
Author: Andy Wingo <address@hidden>
Date: Mon Jun 1 19:58:23 2015 +0200
Add "intset" syntax to construct intsets.
* module/language/cps/intset.scm (intset): New syntax.
---
module/language/cps/intset.scm | 6 ++++++
module/language/cps2/simplify.scm | 7 ++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/module/language/cps/intset.scm b/module/language/cps/intset.scm
index 382a4ba..87956c5 100644
--- a/module/language/cps/intset.scm
+++ b/module/language/cps/intset.scm
@@ -34,6 +34,7 @@
transient-intset?
persistent-intset
transient-intset
+ intset
intset-add
intset-add!
intset-remove
@@ -300,6 +301,11 @@
;; Add a new level and try again.
(intset-add (add-level min shift root) i))))))
+(define-syntax intset
+ (syntax-rules ()
+ ((intset) empty-intset)
+ ((intset x x* ...) (intset-add (intset x* ...) x))))
+
(define (intset-remove bs i)
(define (remove i shift root)
(cond
diff --git a/module/language/cps2/simplify.scm
b/module/language/cps2/simplify.scm
index a9355cd..5aa1bb1 100644
--- a/module/language/cps2/simplify.scm
+++ b/module/language/cps2/simplify.scm
@@ -56,9 +56,10 @@
(persistent-intmap
(intmap-fold (lambda (k v out)
(let ((v* (f k v)))
- (if (equal? v v*)
- out
- (intmap-replace! out k v*))))
+ (cond
+ ((equal? v v*) out)
+ (v* (intmap-replace! out k v*))
+ (else (intmap-remove out k)))))
conts
conts)))
- [Guile-commits] branch master updated (48b2f19 -> 6e725df), Andy Wingo, 2015/06/02
- [Guile-commits] 01/12: Fix regression in compute-idoms, Andy Wingo, 2015/06/02
- [Guile-commits] 03/12: Add intmap-replace., Andy Wingo, 2015/06/02
- [Guile-commits] 04/12: intset-next starting point is optional, Andy Wingo, 2015/06/02
- [Guile-commits] 02/12: Fix type-fold on multiplying exact numbers, Andy Wingo, 2015/06/02
- [Guile-commits] 06/12: DCE uses type analysis to find dead code, Andy Wingo, 2015/06/02
- [Guile-commits] 08/12: Fix compute-defining-expressions (and thereby compute-constant-values), Andy Wingo, 2015/06/02
- [Guile-commits] 07/12: Add intmap-replace!., Andy Wingo, 2015/06/02
- [Guile-commits] 09/12: Port prune-top-level-scopes pass to CPS2, Andy Wingo, 2015/06/02
- [Guile-commits] 10/12: Add intmap-fold-right, Andy Wingo, 2015/06/02
- [Guile-commits] 11/12: Add "intset" syntax to construct intsets.,
Andy Wingo <=
- [Guile-commits] 05/12: Port type inference module to CPS2, Andy Wingo, 2015/06/02
- [Guile-commits] 12/12: Port contification pass to CPS2., Andy Wingo, 2015/06/02