mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 11:46:35 +02:00
WIP
This commit is contained in:
parent
61508ef55a
commit
c382b259c7
2 changed files with 11 additions and 4 deletions
|
@ -18,7 +18,9 @@
|
||||||
(scheme cyclone pretty-print)
|
(scheme cyclone pretty-print)
|
||||||
(srfi 2)
|
(srfi 2)
|
||||||
(srfi 69)
|
(srfi 69)
|
||||||
)))
|
)
|
||||||
|
(define trace:error write)
|
||||||
|
))
|
||||||
|
|
||||||
;; TODO:
|
;; TODO:
|
||||||
;; analyze call graph. not exactly sure how this is going to work yet, but the goal is to be able to figure out which
|
;; analyze call graph. not exactly sure how this is going to work yet, but the goal is to be able to figure out which
|
||||||
|
@ -37,7 +39,7 @@
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(and-let* ((adb-var (adb:get/default v #f)))
|
(and-let* ((adb-var (adb:get/default v #f)))
|
||||||
(when (not (adbv:inlinable adb-var))
|
(when (not (adbv:inlinable adb-var))
|
||||||
(write `(cannot inline ,ref)) (newline)
|
(trace:error `(cannot inline ,ref))
|
||||||
(return #f))
|
(return #f))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -52,7 +54,7 @@
|
||||||
;; exp - S-expression to scan
|
;; exp - S-expression to scan
|
||||||
;; vars - alist of current set of variables
|
;; vars - alist of current set of variables
|
||||||
(define (scan exp vars)
|
(define (scan exp vars)
|
||||||
(write `(DEBUG scan ,(ast:ast->pp-sexp exp))) (newline)
|
(trace:error `(DEBUG scan ,(ast:ast->pp-sexp exp)))
|
||||||
(cond
|
(cond
|
||||||
((ast:lambda? exp)
|
((ast:lambda? exp)
|
||||||
(for-each
|
(for-each
|
||||||
|
|
|
@ -109,6 +109,7 @@
|
||||||
with-fnc!
|
with-fnc!
|
||||||
)
|
)
|
||||||
(include "cps-opt-local-var-redux.scm")
|
(include "cps-opt-local-var-redux.scm")
|
||||||
|
(include "cps-opt-analyze-call-graph.scm")
|
||||||
(begin
|
(begin
|
||||||
;; The following two defines allow non-CPS functions to still be considered
|
;; The following two defines allow non-CPS functions to still be considered
|
||||||
;; for certain inlining optimizations.
|
;; for certain inlining optimizations.
|
||||||
|
@ -130,9 +131,12 @@
|
||||||
(eval '(define Cyc-fast-lte <=) env)
|
(eval '(define Cyc-fast-lte <=) env)
|
||||||
env))
|
env))
|
||||||
(define *adb* (make-hash-table))
|
(define *adb* (make-hash-table))
|
||||||
|
(define *adb-call-graph* (make-hash-table))
|
||||||
(define (adb:get-db) *adb*)
|
(define (adb:get-db) *adb*)
|
||||||
(define (adb:clear!)
|
(define (adb:clear!)
|
||||||
(set! *adb* (make-hash-table)))
|
(set! *adb* (make-hash-table))
|
||||||
|
(set! *adb-call-graph* (make-hash-table))
|
||||||
|
)
|
||||||
(define (adb:get key) (hash-table-ref *adb* key))
|
(define (adb:get key) (hash-table-ref *adb* key))
|
||||||
(define (adb:get/default key default) (hash-table-ref/default *adb* key default))
|
(define (adb:get/default key default) (hash-table-ref/default *adb* key default))
|
||||||
(define (adb:lambda-ids)
|
(define (adb:lambda-ids)
|
||||||
|
@ -1598,6 +1602,7 @@
|
||||||
(analyze exp -1 -1) ;; Top-level is lambda ID -1
|
(analyze exp -1 -1) ;; Top-level is lambda ID -1
|
||||||
(analyze2 exp) ;; Second pass
|
(analyze2 exp) ;; Second pass
|
||||||
(analyze:find-inlinable-vars exp '()) ;; Identify variables safe to inline
|
(analyze:find-inlinable-vars exp '()) ;; Identify variables safe to inline
|
||||||
|
;(set! *adb-call-graph* (analyze:build-call-graph exp))
|
||||||
(analyze:find-recursive-calls2 exp)
|
(analyze:find-recursive-calls2 exp)
|
||||||
;(analyze:set-calls-self)
|
;(analyze:set-calls-self)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue