mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 05:06:36 +02:00
Added opt:renumber-lambdas!
This commit is contained in:
parent
edf3c0e87f
commit
7be8fe8f9a
1 changed files with 21 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
analyze:find-direct-recursive-calls
|
analyze:find-direct-recursive-calls
|
||||||
analyze:find-known-lambdas
|
analyze:find-known-lambdas
|
||||||
;analyze-lambda-side-effects
|
;analyze-lambda-side-effects
|
||||||
|
opt:renumber-lambdas!
|
||||||
opt:add-inlinable-functions
|
opt:add-inlinable-functions
|
||||||
opt:contract
|
opt:contract
|
||||||
opt:inline-prims
|
opt:inline-prims
|
||||||
|
@ -1587,6 +1588,26 @@
|
||||||
-1))
|
-1))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
;; Renumber lambdas and re-run analysis
|
||||||
|
(define (opt:renumber-lambdas! exp)
|
||||||
|
(define (scan exp)
|
||||||
|
(cond
|
||||||
|
((ast:lambda? exp)
|
||||||
|
(ast:%make-lambda
|
||||||
|
(ast:get-next-lambda-id!)
|
||||||
|
(ast:lambda-args exp)
|
||||||
|
(scan (ast:lambda-body exp))
|
||||||
|
(ast:lambda-has-cont exp)))
|
||||||
|
((quote? exp)
|
||||||
|
exp)
|
||||||
|
((app? exp)
|
||||||
|
(map (lambda (e) (scan e)) exp))
|
||||||
|
(else exp)))
|
||||||
|
(let ((result (scan exp)))
|
||||||
|
(adb:clear!)
|
||||||
|
(analyze-cps result)
|
||||||
|
result))
|
||||||
|
|
||||||
;; Closure-conversion.
|
;; Closure-conversion.
|
||||||
;;
|
;;
|
||||||
;; Closure conversion eliminates all of the free variables from every
|
;; Closure conversion eliminates all of the free variables from every
|
||||||
|
|
Loading…
Add table
Reference in a new issue