@@ -53,39 +53,42 @@ let opt_specialize_c = ref false
5353
5454let c_options =
5555 [
56- ( " -c_include " ,
56+ ( Flag. create ~prefix: [ " c " ] ~arg: " filename " " include " ,
5757 Arg. String (fun i -> opt_includes_c := i :: ! opt_includes_c),
58- " <filename> provide additional include for C output"
58+ " provide additional include for C output"
5959 );
60- (" -c_no_main " , Arg. Set C_backend. opt_no_main, " do not generate the main() function" );
61- (" -c_no_rts " , Arg. Set C_backend. opt_no_rts, " do not include the Sail runtime" );
62- ( " -c_no_lib " ,
60+ (Flag. create ~prefix: [ " c " ] " no_main " , Arg. Set C_backend. opt_no_main, " do not generate the main() function" );
61+ (Flag. create ~prefix: [ " c " ] " no_rts " , Arg. Set C_backend. opt_no_rts, " do not include the Sail runtime" );
62+ ( Flag. create ~prefix: [ " c " ] " no_lib " ,
6363 Arg. Tuple [Arg. Set C_backend. opt_no_lib; Arg. Set C_backend. opt_no_rts],
64- " do not include the Sail runtime or library"
64+ " do not include the Sail runtime or library"
6565 );
66- (" -c_prefix" , Arg. String (fun prefix -> C_backend. opt_prefix := prefix), " <prefix> prefix generated C functions" );
67- ( " -c_extra_params" ,
66+ ( Flag. create ~prefix: [" c" ] ~arg: " prefix" " prefix" ,
67+ Arg. String (fun prefix -> C_backend. opt_prefix := prefix),
68+ " prefix generated C functions"
69+ );
70+ ( Flag. create ~prefix: [" c" ] ~arg: " parameters" " extra_params" ,
6871 Arg. String (fun params -> C_backend. opt_extra_params := Some params),
69- " <parameters> generate C functions with additional parameters"
72+ " generate C functions with additional parameters"
7073 );
71- ( " -c_extra_args " ,
74+ ( Flag. create ~prefix: [ " c " ] ~arg: " arguments " " extra_args " ,
7275 Arg. String (fun args -> C_backend. opt_extra_arguments := Some args),
73- " <arguments> supply extra argument to every generated C function call"
76+ " supply extra argument to every generated C function call"
7477 );
75- (" -c_specialize " , Arg. Set opt_specialize_c, " specialize integer arguments in C output" );
76- ( " -c_preserve " ,
78+ (Flag. create ~prefix: [ " c " ] " specialize " , Arg. Set opt_specialize_c, " specialize integer arguments in C output" );
79+ ( Flag. create ~prefix: [ " c " ] " preserve " ,
7780 Arg. String (fun str -> Specialize. add_initial_calls (Ast_util.IdSet. singleton (Ast_util. mk_id str))),
78- " make sure the provided function identifier is preserved in C output"
81+ " make sure the provided function identifier is preserved in C output"
7982 );
80- ( " -c_fold_unit " ,
83+ ( Flag. create ~prefix: [ " c " ] " fold_unit " ,
8184 Arg. String (fun str -> Constant_fold. opt_fold_to_unit := Util. split_on_char ',' str),
82- " remove comma separated list of functions from C output, replacing them with unit"
85+ " remove comma separated list of functions from C output, replacing them with unit"
8386 );
84- ( " -c_coverage " ,
87+ ( Flag. create ~prefix: [ " c " ] ~arg: " file " " coverage " ,
8588 Arg. String (fun str -> C_backend. opt_branch_coverage := Some (open_out str)),
86- " <file> Turn on coverage tracking and output information about all branches and functions to a file"
89+ " Turn on coverage tracking and output information about all branches and functions to a file"
8790 );
88- ( " - O" ,
91+ ( Flag. create ~prefix: [ " c " ] ~hide_prefix: true " O" ,
8992 Arg. Tuple
9093 [
9194 Arg. Set C_backend. optimize_primops;
@@ -94,17 +97,20 @@ let c_options =
9497 Arg. Set C_backend. optimize_struct_updates;
9598 Arg. Set C_backend. optimize_alias;
9699 ],
97- " turn on optimizations for C compilation"
100+ " turn on optimizations for C compilation"
98101 );
99- ( " - Ofixed_int" ,
102+ ( Flag. create ~prefix: [ " c " ] ~hide_prefix: true " Ofixed_int" ,
100103 Arg. Set C_backend. optimize_fixed_int,
101- " assume fixed size integers rather than GMP arbitrary precision integers"
104+ " assume fixed size integers rather than GMP arbitrary precision integers"
102105 );
103- ( " - Ofixed_bits" ,
106+ ( Flag. create ~prefix: [ " c " ] ~hide_prefix: true " Ofixed_bits" ,
104107 Arg. Set C_backend. optimize_fixed_bits,
105- " assume fixed size bitvectors rather than arbitrary precision bitvectors"
108+ " assume fixed size bitvectors rather than arbitrary precision bitvectors"
109+ );
110+ ( Flag. create ~prefix: [" c" ] ~hide_prefix: true " static" ,
111+ Arg. Set C_backend. opt_static,
112+ " make generated C functions static"
106113 );
107- (" -static" , Arg. Set C_backend. opt_static, " make generated C functions static" );
108114 ]
109115
110116let c_rewrites =
0 commit comments