Skip to content

Commit 2da64a0

Browse files
committed
add rival compiler
1 parent 909a5d1 commit 2da64a0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/core/egg-herbie.rkt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,15 +1196,22 @@
11961196
(define regraph (make-regraph egg-graph))
11971197

11981198
(displayln "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
1199+
(define exprs '())
1200+
(define values (make-hasheq))
11991201
(define extract-id (extractor regraph))
12001202
(define reprs (egg-runner-reprs runner))
1201-
(for/list ([id (in-list root-ids)]
1203+
(define l (for/list ([id (in-list root-ids)]
12021204
[repr (in-list reprs)])
12031205
(define eclass (regraph-extract-variants regraph extract-id id repr))
1204-
(for([expr eclass])
1205-
(displayln expr))
1206+
(cons exprs (first eclass))
12061207
(regraph-extract-best regraph extract-id id repr)
1207-
)
1208+
))
1209+
(for ([expr exprs])
1210+
(define output (real-apply (make-real-compiler ctx) pt))
1211+
(if (hash-has-key? values (cdr ouput))
1212+
(displayln "found double")
1213+
(hash-set! (cdr output) (car output))))
1214+
l
12081215
]
12091216
[`(multi . ,extractor) ; multi expression extraction
12101217
(define regraph (make-regraph egg-graph))

0 commit comments

Comments
 (0)