mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-22 07:09:17 +02:00
New files
This commit is contained in:
parent
a7198b425b
commit
a48a6fc9a8
2 changed files with 84 additions and 0 deletions
15
scheme/cyclone/opti-test.scm
Normal file
15
scheme/cyclone/opti-test.scm
Normal file
|
@ -0,0 +1,15 @@
|
|||
;; Temporary file to test changes to the optimization library
|
||||
(import (optimize-cps)
|
||||
(scheme write)
|
||||
(scheme base))
|
||||
|
||||
(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))
|
69
scheme/cyclone/optimize-cps.sld
Normal file
69
scheme/cyclone/optimize-cps.sld
Normal file
|
@ -0,0 +1,69 @@
|
|||
;;;; Cyclone Scheme
|
||||
;;;; https://github.com/justinethier/cyclone
|
||||
;;;;
|
||||
;;;; Copyright (c) 2014-2016, Justin Ethier
|
||||
;;;; All rights reserved.
|
||||
;;;;
|
||||
;;;; This module performs CPS analysis and optimizations.
|
||||
;;;;
|
||||
|
||||
(define-library (optimize-cps)
|
||||
;(define-library (scheme cyclone optimize-cps)
|
||||
(import (scheme base)
|
||||
(srfi 69)
|
||||
;(scheme char)
|
||||
;(scheme read)
|
||||
;(scheme write)
|
||||
;(scheme cyclone common)
|
||||
;(scheme cyclone libraries)
|
||||
;(scheme cyclone macros)
|
||||
;(scheme cyclone pretty-print)
|
||||
;(scheme cyclone util)
|
||||
;(scheme cyclone transforms)
|
||||
)
|
||||
(export
|
||||
adb:init!
|
||||
adb:get key
|
||||
adb:set! key val
|
||||
;; Variables
|
||||
adb:make-var
|
||||
%adb:make-var
|
||||
adb:variable?
|
||||
adbv:global
|
||||
adbv:set-global!
|
||||
adbv:defined-by adbv:set-defined-by!
|
||||
adbv:assigned adbv:set-assigned!
|
||||
adbv:assigned-locally adbv:set-assigned-locally!
|
||||
;; Functions
|
||||
adb:make-fnc
|
||||
%adb:make-fnc
|
||||
adb:function?
|
||||
adbf:simple adbf:set-simple!
|
||||
adbf:unused-params adbf:set-unused-params!
|
||||
)
|
||||
(begin
|
||||
(define *adb* #f) ;(make-hash-table))
|
||||
(define (adb:init!)
|
||||
(set! *adb* (make-hash-table)))
|
||||
(define (adb:get key) (hash-table-ref *adb* key))
|
||||
(define (adb:set! key val) (hash-table-set! *adb* key val))
|
||||
(define-record-type <analysis-db-variable>
|
||||
(%adb:make-var global defined-by assigned assigned-locally)
|
||||
adb:variable?
|
||||
(global adbv:global adbv:set-global!)
|
||||
(defined-by adbv:defined-by adbv:set-defined-by!)
|
||||
(assigned adbv:assigned adbv:set-assigned!)
|
||||
(assigned-locally adbv:assigned-locally adbv:set-assigned-locally!)
|
||||
)
|
||||
(define (adb:make-var)
|
||||
(%adb:make-var #f #f #f #f))
|
||||
|
||||
(define-record-type <analysis-db-function>
|
||||
(%adb:make-fnc simple unused-params)
|
||||
adb:function?
|
||||
(simple adbf:simple adbf:set-simple!)
|
||||
(unused-params adbf:unused-params adbf:set-unused-params!)
|
||||
)
|
||||
(define (adb:make-fnc)
|
||||
(%adb:make-fnc #f #f))
|
||||
))
|
Loading…
Add table
Reference in a new issue