mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
WIP
This commit is contained in:
parent
e060247d8a
commit
3bbd89ce2c
2 changed files with 11 additions and 8 deletions
|
@ -113,7 +113,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Transformation to memoize simple recursive numeric functions
|
;; Transformation to memoize simple recursive numeric functions
|
||||||
(define (opt:memoize-pure-fncs sexp)
|
(define (opt:memoize-pure-fncs sexp module-globals)
|
||||||
(define memo-tbl '())
|
(define memo-tbl '())
|
||||||
|
|
||||||
;; exp - S-expression to scan
|
;; exp - S-expression to scan
|
||||||
|
@ -321,12 +321,13 @@
|
||||||
|
|
||||||
))
|
))
|
||||||
|
|
||||||
(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))))
|
(opt:memoize-pure-fncs ast module-globals))))
|
||||||
|
|
||||||
;; (pretty-print
|
;; (pretty-print
|
||||||
;; (ast:ast->pp-sexp
|
;; (ast:ast->pp-sexp
|
||||||
|
|
|
@ -1700,7 +1700,7 @@
|
||||||
;; TODO: re-run phases again until program is stable (less than n opts made, more than r rounds performed, etc)
|
;; TODO: re-run phases again until program is stable (less than n opts made, more than r rounds performed, etc)
|
||||||
;; END notes
|
;; END notes
|
||||||
|
|
||||||
(define (optimize-cps ast)
|
(define (optimize-cps ast . options)
|
||||||
(adb:clear!)
|
(adb:clear!)
|
||||||
(analyze-cps ast)
|
(analyze-cps ast)
|
||||||
(trace:info "---------------- cps analysis db:")
|
(trace:info "---------------- cps analysis db:")
|
||||||
|
@ -1715,10 +1715,12 @@
|
||||||
;; (program size? heuristics? what else??)
|
;; (program size? heuristics? what else??)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; TODO: when memo flag (need to pass in) is enabled
|
;; Memoize pure functions, if instructed
|
||||||
(when #t
|
(let ((module-globals (assoc 'module-globals options)))
|
||||||
(set! new-ast (opt:memoize-pure-fncs new-ast)))
|
(when (and module-globals #t ;; TODO: (assoc 'memoize-pure-functions options)
|
||||||
|
)
|
||||||
|
(set! new-ast (opt:memoize-pure-fncs new-ast module-globals)))
|
||||||
|
)
|
||||||
new-ast
|
new-ast
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue