Make function for adding vars to unboxed vars table.

This commit is contained in:
Eric Dobson 2013-09-18 09:37:53 -07:00
parent 3cab38845e
commit 7af7dea078
2 changed files with 7 additions and 6 deletions

View File

@ -130,7 +130,7 @@
(for ((v (in-syntax #'(opt-candidates.id ...)))
(r (in-syntax #'(opt-candidates.real-binding ...)))
(i (in-syntax #'(opt-candidates.imag-binding ...))))
(dict-set! unboxed-vars-table v (list r i v)))]
(add-unboxed-var! v r i))]
;; in the case where no bindings are unboxed, we create a let
;; that is equivalent to the original, but with all parts optimized
#:with opt (quasisyntax/loc/origin
@ -274,10 +274,7 @@
body.opt ...))]
[(memq i to-unbox)
;; we unbox the current param, add to the table
(dict-set! unboxed-vars-table (car params)
(list (car real-parts)
(car imag-parts)
(car params)))
(add-unboxed-var! (car params) (car real-parts) (car imag-parts))
(loop (cdr params) (add1 i)
(cdr real-parts) (cdr imag-parts)
boxed)]

View File

@ -5,14 +5,18 @@
(utils tc-utils))
(provide
unboxed-vars-table
unboxed-funs-table
add-unboxed-var!
unboxed-var)
;; contains the bindings which actually exist as separate bindings for each component
;; associates identifiers to lists (real-binding imag-binding orig-binding-occurrence)
(define unboxed-vars-table (make-free-id-table))
(define (add-unboxed-var! orig-binding real-binding imag-binding)
(dict-set! unboxed-vars-table orig-binding
(list real-binding imag-binding orig-binding)))
(define-syntax-class unboxed-var
#:attributes (real-binding imag-binding)
(pattern v:id