aboutsummaryrefslogtreecommitdiffstats
path: root/driver/Driver.ml
diff options
context:
space:
mode:
Diffstat (limited to 'driver/Driver.ml')
-rw-r--r--driver/Driver.ml17
1 files changed, 6 insertions, 11 deletions
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 8ceb3a25..089cd423 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -263,17 +263,12 @@ Code generation options: (use -fno-<opt> to turn off -f<opt>)
-trace Have the interpreter produce a detailed trace of reductions
-random Randomize execution order
-all Simulate all possible execution orders
+ -main <name> Start executing at function <name> instead of main()
|}
let print_usage_and_exit () =
printf "%s" usage_string; exit 0
-let enforce_buildnr nr =
- let build = int_of_string Version.buildnr in
- if nr != build then
- fatal_error no_loc "Mismatching builds: This is CompCert build %d, but QSK requires build %d.\n\
-Please use matching builds of QSK and CompCert." build nr
-
let dump_mnemonics destfile =
let oc = open_out_bin destfile in
let pp = Format.formatter_of_out_channel oc in
@@ -320,10 +315,7 @@ let cmdline_actions =
@ version_options tool_name @
(* Enforcing CompCert build numbers for QSKs and mnemonics dump *)
(if Version.buildnr <> "" then
- [ Exact "-qsk-enforce-build", Integer enforce_buildnr;
- Exact "--qsk-enforce-build", Integer enforce_buildnr;
- Exact "-dump-mnemonics", String dump_mnemonics;
- ]
+ [Exact "-dump-mnemonics", String dump_mnemonics;]
else []) @
(* Processing options *)
[ Exact "-c", Set option_c;
@@ -409,7 +401,8 @@ let cmdline_actions =
Exact "-quiet", Unit (fun () -> Interp.trace := 0);
Exact "-trace", Unit (fun () -> Interp.trace := 2);
Exact "-random", Unit (fun () -> Interp.mode := Interp.Random);
- Exact "-all", Unit (fun () -> Interp.mode := Interp.All)
+ Exact "-all", Unit (fun () -> Interp.mode := Interp.All);
+ Exact "-main", String (fun s -> main_function_name := s)
]
(* Optimization options *)
(* -f options: come in -f and -fno- variants *)
@@ -497,6 +490,8 @@ let _ =
fatal_error no_loc "ambiguous '-o' option (multiple source files)";
if !num_input_files = 0 then
fatal_error no_loc "no input file";
+ if not !option_interp && !main_function_name <> "main" then
+ fatal_error no_loc "option '-main' requires option '-interp'";
let linker_args = time "Total compilation time" perform_actions () in
if not (nolink ()) && linker_args <> [] then begin
linker (output_filename_default "a.out") linker_args