|
206 | 206 | [(? number?) (if (representation? type) (literal enode (representation-name type)) enode)] |
207 | 207 | [(? symbol?) |
208 | 208 | (if (hash-has-key? rename-dict enode) (car (hash-ref rename-dict enode)) enode)] |
209 | | - [(list '$approx spec impl) |
| 209 | + [(list '$approx spec (app eggref impl)) |
210 | 210 | (define spec* (vector-ref id->spec spec)) |
211 | 211 | (unless spec* |
212 | 212 | (error 'regraph-extract-variants "no initial approx node in eclass")) |
213 | 213 | (define spec-type (if (representation? type) (representation-type type) type)) |
214 | 214 | (define final-spec (egg-parsed->expr spec* rename-dict spec-type)) |
215 | 215 | (define final-spec-idx (mutable-batch-munge! out final-spec)) |
216 | | - (approx final-spec-idx (loop (eggref impl) type))] |
217 | | - [(list 'if cond ift iff) |
| 216 | + (approx final-spec-idx (loop impl type))] |
| 217 | + [(list 'if (app eggref cond) (app eggref ift) (app eggref iff)) |
218 | 218 | (if (representation? type) |
219 | | - (list 'if |
220 | | - (loop (eggref cond) (get-representation 'bool)) |
221 | | - (loop (eggref ift) type) |
222 | | - (loop (eggref iff) type)) |
223 | | - (list 'if |
224 | | - (loop (eggref cond) 'bool) |
225 | | - (loop (eggref ift) type) |
226 | | - (loop (eggref iff) type)))] |
227 | | - [(list (? impl-exists? impl) ids ...) |
228 | | - (define args |
229 | | - (for/list ([id (in-list ids)] |
| 219 | + (list 'if (loop cond (get-representation 'bool)) (loop ift type) (loop iff type)) |
| 220 | + (list 'if (loop cond 'bool) (loop ift type) (loop iff type)))] |
| 221 | + [(list (? impl-exists? impl) (app eggref args) ...) |
| 222 | + (define args* |
| 223 | + (for/list ([arg (in-list args)] |
230 | 224 | [type (in-list (impl-info impl 'itype))]) |
231 | | - (loop (eggref id) type))) |
232 | | - (cons impl args)] |
233 | | - [(list (? operator-exists? op) ids ...) |
234 | | - (define args |
235 | | - (for/list ([id (in-list ids)] |
| 225 | + (loop arg type))) |
| 226 | + (cons impl args*)] |
| 227 | + [(list (? operator-exists? op) (app eggref args) ...) |
| 228 | + (define args* |
| 229 | + (for/list ([arg (in-list args)] |
236 | 230 | [type (in-list (operator-info op 'itype))]) |
237 | | - (loop (eggref id) type))) |
238 | | - (cons op args)])) |
| 231 | + (loop arg type))) |
| 232 | + (cons op args*)])) |
239 | 233 | (batch-push! out enode*))) |
240 | 234 | (batchref input-batch idx)) |
241 | 235 |
|
|
0 commit comments