mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 16:57:35 +02:00
WIP
This commit is contained in:
parent
804fcf950d
commit
41375c6d41
1 changed files with 73 additions and 17 deletions
|
@ -1,25 +1,81 @@
|
||||||
;; Temporary file to test changes to the optimization library
|
;; Temporary file to test changes to the optimization library
|
||||||
(import (optimize-cps)
|
(import (cps-optimizations)
|
||||||
(ast)
|
; (ast)
|
||||||
|
(scheme cyclone pretty-print)
|
||||||
(scheme write)
|
(scheme write)
|
||||||
(scheme base))
|
(scheme base))
|
||||||
|
|
||||||
;(adb:init!)
|
;(adb:init!)
|
||||||
(adb:set! 'v (adb:make-var))
|
;(adb:set! 'v (adb:make-var))
|
||||||
|
;
|
||||||
|
;(let ((v (adb:get 'v)))
|
||||||
|
; (adbv:set-global! v #t)
|
||||||
|
; (adbv:set-defined-by! v 1)
|
||||||
|
;
|
||||||
|
; (display v)
|
||||||
|
; (newline)
|
||||||
|
; (display (adbv:defined-by v))
|
||||||
|
; (newline))
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;(define l (ast:make-lambda '() '((write 1) (write 2) (write 3))))
|
||||||
|
;(write l)
|
||||||
|
;(newline)
|
||||||
|
;(set! l (ast:make-lambda '() '((write 1) (write 2) (write 3))))
|
||||||
|
;(write `(l is now ,l))
|
||||||
|
;(newline)
|
||||||
|
|
||||||
(let ((v (adb:get 'v)))
|
(define input-program
|
||||||
(adbv:set-global! v #t)
|
'((define test
|
||||||
(adbv:set-defined-by! v 1)
|
#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(9 (k$11 a$4) ((write k$11 3)))))
|
||||||
|
(#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(8
|
||||||
|
(y$1)
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(7
|
||||||
|
()
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(6
|
||||||
|
(r$5)
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(5
|
||||||
|
(x$2)
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(4
|
||||||
|
(y$3)
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(3
|
||||||
|
(r$7)
|
||||||
|
((#((record-marker)
|
||||||
|
#((record-marker) #f (id args body))
|
||||||
|
#(2
|
||||||
|
(r$8)
|
||||||
|
((write #((record-marker)
|
||||||
|
#((record-marker)
|
||||||
|
#f
|
||||||
|
(id args body))
|
||||||
|
#(1 (r$6) ((test %halt 4))))
|
||||||
|
r$8))))
|
||||||
|
(+ x$2 y$3)))))
|
||||||
|
(set! y$3 2)))))
|
||||||
|
#f))))
|
||||||
|
1))))
|
||||||
|
0))))))))
|
||||||
|
#f))
|
||||||
|
)
|
||||||
|
|
||||||
(display v)
|
(set! input-program
|
||||||
(newline)
|
(optimize-cps input-program))
|
||||||
(display (adbv:defined-by v))
|
|
||||||
(newline))
|
|
||||||
|
|
||||||
|
(pretty-print "---------------- cps analysis db:")
|
||||||
(define l (ast:make-lambda '() '((write 1) (write 2) (write 3))))
|
(pretty-print (adb:get-db))
|
||||||
(write l)
|
(pretty-print "---------------- after cps optimizations:")
|
||||||
(newline)
|
(pretty-print input-program)
|
||||||
(set! l (ast:make-lambda '() '((write 1) (write 2) (write 3))))
|
|
||||||
(write `(l is now ,l))
|
|
||||||
(newline)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue