mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
Rework to use add-globals and flag-set functions
This commit is contained in:
parent
94f77f6075
commit
3af8cef894
1 changed files with 5 additions and 8 deletions
|
@ -120,7 +120,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Transformation to memoize simple recursive numeric functions
|
;; Transformation to memoize simple recursive numeric functions
|
||||||
(define (opt:memoize-pure-fncs sexp module-globals)
|
(define (opt:memoize-pure-fncs sexp add-globals!)
|
||||||
(define memo-tbl '())
|
(define memo-tbl '())
|
||||||
|
|
||||||
;; exp - S-expression to scan
|
;; exp - S-expression to scan
|
||||||
|
@ -170,10 +170,8 @@
|
||||||
(let ((new-exp (scan sexp)))
|
(let ((new-exp (scan sexp)))
|
||||||
(cond
|
(cond
|
||||||
((not (null? memo-tbl))
|
((not (null? memo-tbl))
|
||||||
(when (pair? module-globals)
|
(when (procedure? add-globals!)
|
||||||
(set-cdr!
|
(add-globals! (map cdr memo-tbl)))
|
||||||
module-globals
|
|
||||||
(append (cdr module-globals) (map cdr memo-tbl))))
|
|
||||||
(append
|
(append
|
||||||
(map
|
(map
|
||||||
(lambda (var/new-var)
|
(lambda (var/new-var)
|
||||||
|
@ -331,13 +329,12 @@
|
||||||
|
|
||||||
))
|
))
|
||||||
|
|
||||||
(let ((ast (ast:sexp->ast sexp))
|
(let ((ast (ast:sexp->ast sexp)))
|
||||||
(module-globals (list)))
|
|
||||||
(analyze-cps ast)
|
(analyze-cps ast)
|
||||||
;(analyze:find-recursive-calls ast)
|
;(analyze:find-recursive-calls ast)
|
||||||
(pretty-print
|
(pretty-print
|
||||||
(ast:ast->pp-sexp
|
(ast:ast->pp-sexp
|
||||||
(opt:memoize-pure-fncs ast module-globals))))
|
(opt:memoize-pure-fncs ast #f))))
|
||||||
|
|
||||||
;; (pretty-print
|
;; (pretty-print
|
||||||
;; (ast:ast->pp-sexp
|
;; (ast:ast->pp-sexp
|
||||||
|
|
Loading…
Add table
Reference in a new issue