Skip to content

Commit 3e6e477

Browse files
committed
Allow lowering to look at sound operations
1 parent fd4227e commit 3e6e477

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/core/egg-herbie.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@
539539
(rule (sym-append 'lower-unsound- impl)
540540
(add-unsound spec-expr)
541541
impl-expr
542+
'(lowering))
543+
(rule (sym-append 'lower-sound- impl)
544+
(add-sound-with-wildcard spec-expr)
545+
impl-expr
542546
'(lowering))))))))
543547

544548
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

src/core/rules.rkt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
(provide *rules*
99
*sound-rules*
1010
(struct-out rule)
11-
add-unsound)
11+
add-unsound
12+
add-sound-with-wildcard)
1213

1314
;; A rule represents "find-and-replacing" `input` by `output`. Both
1415
;; are patterns, meaning that symbols represent pattern variables.
@@ -36,6 +37,13 @@
3637
[(list op args ...) (cons (sym-append "unsound-" op) (map add-unsound args))]
3738
[_ expr]))
3839

40+
(define (add-sound-with-wildcard expr)
41+
(match expr
42+
[(list op args ...)
43+
(cons (sym-append "sound-" op)
44+
(append (map add-sound-with-wildcard args) (list '_)))]
45+
[_ expr]))
46+
3947
(define-syntax define-rule
4048
(syntax-rules ()
4149
[(define-rule rname group input output)

0 commit comments

Comments
 (0)