summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-02-19 09:55:45 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-02-19 09:55:45 +0000
commit3ec022950ec233a2af418aacd1755fce4d701724 (patch)
tree154256c5c73fda06e874fb05695e14e610ba8ad4 /driver
parent9aeba45962e8ba5cde5d81fb701a4c9a3963f4a5 (diff)
Add option -Os to optimize for code size rather than for execution speed.
Refactored compilation flags that affect the Coq part (module Compopts). Added support for C99 for loops with declarations. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2410 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'driver')
-rw-r--r--driver/Clflags.ml1
-rw-r--r--driver/Compopts.v33
-rw-r--r--driver/Driver.ml4
-rw-r--r--driver/Interp.ml1
4 files changed, 39 insertions, 0 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index 5d068b6..b1f2bd8 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -28,6 +28,7 @@ let option_falignfunctions = ref (None: int option)
let option_falignbranchtargets = ref 0
let option_faligncondbranchs = ref 0
let option_finline_asm = ref false
+let option_Osize = ref false
let option_dparse = ref false
let option_dcmedium = ref false
let option_dclight = ref false
diff --git a/driver/Compopts.v b/driver/Compopts.v
new file mode 100644
index 0000000..205f768
--- /dev/null
+++ b/driver/Compopts.v
@@ -0,0 +1,33 @@
+(* *********************************************************************)
+(* *)
+(* The Compcert verified compiler *)
+(* *)
+(* Xavier Leroy, INRIA Paris-Rocquencourt *)
+(* *)
+(* Copyright Institut National de Recherche en Informatique et en *)
+(* Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the INRIA Non-Commercial License Agreement. *)
+(* *)
+(* *********************************************************************)
+
+(** Compilation options *)
+
+(** This file collects Coq functions to query the command-line
+ options that influence the code generated by the verified
+ part of CompCert. These functions are mapped by extraction
+ to accessors for the flags in [Clflags.ml]. *)
+
+(** Flag [-Os]. For instruction selection (mainly). *)
+Parameter optim_for_size: unit -> bool.
+
+(** Flag [-ffloat-const-prop]. For value analysis and constant propagation. *)
+Parameter propagate_float_constants: unit -> bool.
+Parameter generate_float_constants: unit -> bool.
+
+(** For value analysis. Currently always false. *)
+Parameter va_strict: unit -> bool.
+
+(** Flag -ftailcalls. For tail call optimization. *)
+Parameter eliminate_tailcalls: unit -> bool.
+
+
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 47061cd..8853794 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -426,6 +426,8 @@ Language support options (use -fno-<opt> to turn off -f<opt>) :
-fall Activate all language support options above
-fnone Turn off all language support options above
Code generation options: (use -fno-<opt> to turn off -f<opt>) :
+ -O Optimize for speed [on by default]
+ -Os Optimize for code size
-ffpu Use FP registers for some integer operations [on]
-fsmall-data <n> Set maximal size <n> for allocation in small data area
-fsmall-const <n> Set maximal size <n> for allocation in small constant area
@@ -525,6 +527,8 @@ let cmdline_actions =
assembler_options := s :: !assembler_options);
"-Wl,", Self (fun s ->
push_linker_arg s);
+ "-Os$", Set option_Osize;
+ "-O$", Unset option_Osize;
"-fsmall-data$", Integer(fun n -> option_small_data := n);
"-fsmall-const$", Integer(fun n -> option_small_const := n);
"-ffloat-const-prop$", Integer(fun n -> option_ffloatconstprop := n);
diff --git a/driver/Interp.ml b/driver/Interp.ml
index 25d363c..5975ae3 100644
--- a/driver/Interp.ml
+++ b/driver/Interp.ml
@@ -454,6 +454,7 @@ let diagnose_stuck_expr p ge w f a kont e m =
| RV, Ecomma(r1, r2, ty) -> diagnose RV r1
| RV, Eparen(r1, ty) -> diagnose RV r1
| RV, Ecall(r1, rargs, ty) -> diagnose RV r1 ||| diagnose_list rargs
+ | RV, Ebuiltin(ef, tyargs, rargs, ty) -> diagnose_list rargs
| _, _ -> false in
if found then true else begin
let l = Cexec.step_expr ge do_external_function do_inline_assembly e w k a m in