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
12
cyclone.scm
12
cyclone.scm
|
@ -22,6 +22,8 @@
|
|||
(scheme cyclone macros)
|
||||
(scheme cyclone libraries))
|
||||
|
||||
(define *optimization-level* 2) ;; Default level
|
||||
|
||||
;; Code emission.
|
||||
|
||||
; c-compile-and-emit : (string -> A) exp -> void
|
||||
|
@ -228,10 +230,11 @@
|
|||
(trace:info "---------------- after CPS:")
|
||||
(trace:info input-program) ;pretty-print
|
||||
|
||||
(when (> *optimization-level* 0)
|
||||
(set! input-program
|
||||
(optimize-cps input-program))
|
||||
(trace:info "---------------- after cps optimizations:")
|
||||
(trace:info input-program)
|
||||
(trace:info input-program))
|
||||
|
||||
(set! input-program
|
||||
(map
|
||||
|
@ -380,6 +383,11 @@
|
|||
(equal? #\- (string-ref arg 0)))))
|
||||
args))
|
||||
(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)
|
||||
(set! *trace-level* 4)) ;; Show all trace output
|
||||
(if (member "-d" args)
|
||||
|
@ -392,6 +400,8 @@
|
|||
-d Only generate intermediate C files, do not compile them
|
||||
-h, --help Display usage 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
|
||||
")
|
||||
(newline))
|
||||
|
|
Loading…
Add table
Reference in a new issue