mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Added opt:add-inlinable-functions
This commit is contained in:
parent
64a562812b
commit
c5ddd79aff
1 changed files with 12 additions and 3 deletions
|
@ -23,6 +23,7 @@
|
||||||
optimize-cps
|
optimize-cps
|
||||||
analyze-cps
|
analyze-cps
|
||||||
;analyze-lambda-side-effects
|
;analyze-lambda-side-effects
|
||||||
|
opt:add-inlinable-functions
|
||||||
opt:contract
|
opt:contract
|
||||||
opt:inline-prims
|
opt:inline-prims
|
||||||
opt:beta-expand
|
opt:beta-expand
|
||||||
|
@ -62,6 +63,12 @@
|
||||||
adbf:side-effects adbf:set-side-effects!
|
adbf:side-effects adbf:set-side-effects!
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
|
;; The following two defines allow non-CPS functions to still be considered
|
||||||
|
;; for certain inlining optimizations.
|
||||||
|
(define *inlinable-functions* '())
|
||||||
|
(define (opt:add-inlinable-functions lis)
|
||||||
|
(set! *inlinable-functions* lis))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
*contract-env*
|
*contract-env*
|
||||||
(let ((env (create-environment '() '())))
|
(let ((env (create-environment '() '())))
|
||||||
|
@ -1194,8 +1201,10 @@
|
||||||
(analyze:find-inlinable-vars (if->else exp) args))
|
(analyze:find-inlinable-vars (if->else exp) args))
|
||||||
((app? exp)
|
((app? exp)
|
||||||
(cond
|
(cond
|
||||||
((and (prim? (car exp))
|
((or
|
||||||
(not (prim:mutates? (car exp))))
|
(member (car exp) *inlinable-functions*)
|
||||||
|
(and (prim? (car exp))
|
||||||
|
(not (prim:mutates? (car exp)))))
|
||||||
;; If primitive does not mutate its args, ignore if ivar is used
|
;; If primitive does not mutate its args, ignore if ivar is used
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (e)
|
(lambda (e)
|
||||||
|
|
Loading…
Add table
Reference in a new issue