mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
WIP
This commit is contained in:
parent
a6cc263237
commit
d36f9be25b
2 changed files with 19 additions and 12 deletions
17
cyclone.scm
17
cyclone.scm
|
@ -238,12 +238,17 @@
|
||||||
;; phase 5 - common subexpression elimination
|
;; phase 5 - common subexpression elimination
|
||||||
;; 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 CPS optimization
|
;; END CPS optimization
|
||||||
(set! input-program
|
|
||||||
(map
|
; (analyze-cps input-program)
|
||||||
cps-optimize-01
|
; (trace:info "---------------- cps analysis db:")
|
||||||
input-program))
|
; (trace:info (adb:get-db))
|
||||||
(trace:info "---------------- after cps optimizations:")
|
|
||||||
(trace:info input-program) ;pretty-print
|
; (set! input-program
|
||||||
|
; (map
|
||||||
|
; cps-optimize-01
|
||||||
|
; input-program))
|
||||||
|
; (trace:info "---------------- after cps optimizations:")
|
||||||
|
; (trace:info input-program) ;pretty-print
|
||||||
|
|
||||||
(set! input-program
|
(set! input-program
|
||||||
(map
|
(map
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
adb:get
|
adb:get
|
||||||
adb:get/default
|
adb:get/default
|
||||||
adb:set!
|
adb:set!
|
||||||
|
adb:get-db
|
||||||
;; Variables
|
;; Variables
|
||||||
adb:make-var
|
adb:make-var
|
||||||
%adb:make-var
|
%adb:make-var
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
(define *adb* (make-hash-table))
|
(define *adb* (make-hash-table))
|
||||||
|
(define (adb:get-db) *adb*)
|
||||||
;(define *adb* #f) ;(make-hash-table))
|
;(define *adb* #f) ;(make-hash-table))
|
||||||
;(define (adb:init!)
|
;(define (adb:init!)
|
||||||
; ;(set! *adb* (make-hash-table)))
|
; ;(set! *adb* (make-hash-table)))
|
||||||
|
@ -103,15 +105,15 @@
|
||||||
(adbv:set-ref-by! var (cons lid (adbv:ref-by var)))
|
(adbv:set-ref-by! var (cons lid (adbv:ref-by var)))
|
||||||
))
|
))
|
||||||
((define? exp)
|
((define? exp)
|
||||||
(let ((var (adb:get/default exp (adb:make-var))))
|
(let ((var (adb:get/default (define->var exp) (adb:make-var))))
|
||||||
;; TODO:
|
;; TODO:
|
||||||
'TODO
|
|
||||||
))
|
(analyze (define->exp exp) lid)))
|
||||||
((set!? exp)
|
((set!? exp)
|
||||||
(let ((var (adb:get/default exp (adb:make-var))))
|
(let ((var (adb:get/default (set!->var exp) (adb:make-var))))
|
||||||
;; TODO:
|
;; TODO:
|
||||||
'TODO
|
|
||||||
))
|
(analyze (set!->exp exp) lid)))
|
||||||
((if? exp) `(if ,(analyze (if->condition exp) lid)
|
((if? exp) `(if ,(analyze (if->condition exp) lid)
|
||||||
,(analyze (if->then exp) lid)
|
,(analyze (if->then exp) lid)
|
||||||
,(analyze (if->else exp) lid)))
|
,(analyze (if->else exp) lid)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue