mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +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)
|
||||
(srfi 2)
|
||||
(srfi 69)
|
||||
)))
|
||||
)
|
||||
(define trace:error write)
|
||||
))
|
||||
|
||||
;; 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
|
||||
|
@ -37,7 +39,7 @@
|
|||
(lambda (v)
|
||||
(and-let* ((adb-var (adb:get/default v #f)))
|
||||
(when (not (adbv:inlinable adb-var))
|
||||
(write `(cannot inline ,ref)) (newline)
|
||||
(trace:error `(cannot inline ,ref))
|
||||
(return #f))
|
||||
)
|
||||
)
|
||||
|
@ -52,7 +54,7 @@
|
|||
;; exp - S-expression to scan
|
||||
;; vars - alist of current set of variables
|
||||
(define (scan exp vars)
|
||||
(write `(DEBUG scan ,(ast:ast->pp-sexp exp))) (newline)
|
||||
(trace:error `(DEBUG scan ,(ast:ast->pp-sexp exp)))
|
||||
(cond
|
||||
((ast:lambda? exp)
|
||||
(for-each
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
with-fnc!
|
||||
)
|
||||
(include "cps-opt-local-var-redux.scm")
|
||||
(include "cps-opt-analyze-call-graph.scm")
|
||||
(begin
|
||||
;; The following two defines allow non-CPS functions to still be considered
|
||||
;; for certain inlining optimizations.
|
||||
|
@ -130,9 +131,12 @@
|
|||
(eval '(define Cyc-fast-lte <=) env)
|
||||
env))
|
||||
(define *adb* (make-hash-table))
|
||||
(define *adb-call-graph* (make-hash-table))
|
||||
(define (adb:get-db) *adb*)
|
||||
(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/default key default) (hash-table-ref/default *adb* key default))
|
||||
(define (adb:lambda-ids)
|
||||
|
@ -1598,6 +1602,7 @@
|
|||
(analyze exp -1 -1) ;; Top-level is lambda ID -1
|
||||
(analyze2 exp) ;; Second pass
|
||||
(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:set-calls-self)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue