mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 07:17:37 +02:00
Issue #43 - Add -O0
to disable optimizations
This is the first step to being able to specify optimization level from the command line. This will be more important as more optimizations are added and when (if) some of them are not always safe to apply.
This commit is contained in:
parent
f3741ca67a
commit
66993ebce5
1 changed files with 14 additions and 4 deletions
18
cyclone.scm
18
cyclone.scm
|
@ -22,6 +22,8 @@
|
||||||
(scheme cyclone macros)
|
(scheme cyclone macros)
|
||||||
(scheme cyclone libraries))
|
(scheme cyclone libraries))
|
||||||
|
|
||||||
|
(define *optimization-level* 2) ;; Default level
|
||||||
|
|
||||||
;; Code emission.
|
;; Code emission.
|
||||||
|
|
||||||
; c-compile-and-emit : (string -> A) exp -> void
|
; c-compile-and-emit : (string -> A) exp -> void
|
||||||
|
@ -228,10 +230,11 @@
|
||||||
(trace:info "---------------- after CPS:")
|
(trace:info "---------------- after CPS:")
|
||||||
(trace:info input-program) ;pretty-print
|
(trace:info input-program) ;pretty-print
|
||||||
|
|
||||||
(set! input-program
|
(when (> *optimization-level* 0)
|
||||||
(optimize-cps input-program))
|
(set! input-program
|
||||||
(trace:info "---------------- after cps optimizations:")
|
(optimize-cps input-program))
|
||||||
(trace:info input-program)
|
(trace:info "---------------- after cps optimizations:")
|
||||||
|
(trace:info input-program))
|
||||||
|
|
||||||
(set! input-program
|
(set! input-program
|
||||||
(map
|
(map
|
||||||
|
@ -380,6 +383,11 @@
|
||||||
(equal? #\- (string-ref arg 0)))))
|
(equal? #\- (string-ref arg 0)))))
|
||||||
args))
|
args))
|
||||||
(compile? #t))
|
(compile? #t))
|
||||||
|
;; Set optimization level(s)
|
||||||
|
(if (member "-O0" args)
|
||||||
|
(set! *optimization-level* 0))
|
||||||
|
;; TODO: place more optimization reading here as necessary
|
||||||
|
;; End optimizations
|
||||||
(if (member "-t" args)
|
(if (member "-t" args)
|
||||||
(set! *trace-level* 4)) ;; Show all trace output
|
(set! *trace-level* 4)) ;; Show all trace output
|
||||||
(if (member "-d" args)
|
(if (member "-d" args)
|
||||||
|
@ -392,6 +400,8 @@
|
||||||
-d Only generate intermediate C files, do not compile them
|
-d Only generate intermediate C files, do not compile them
|
||||||
-h, --help Display usage information
|
-h, --help Display usage information
|
||||||
-v Display version information
|
-v Display version information
|
||||||
|
-Ox Optimization level, higher means more optimizations will
|
||||||
|
be used. Set to 0 to disable optimizations.
|
||||||
--autogen Cyclone developer use only, create autogen.out file
|
--autogen Cyclone developer use only, create autogen.out file
|
||||||
")
|
")
|
||||||
(newline))
|
(newline))
|
||||||
|
|
Loading…
Add table
Reference in a new issue