@@ -138,6 +138,7 @@ pub struct Options {
138
138
pub no_trans : bool ,
139
139
pub error_format : ErrorOutputType ,
140
140
pub treat_err_as_bug : bool ,
141
+ pub mir_opt_level : usize ,
141
142
142
143
/// if true, build up the dep-graph
143
144
pub build_dep_graph : bool ,
@@ -254,6 +255,7 @@ pub fn basic_options() -> Options {
254
255
parse_only : false ,
255
256
no_trans : false ,
256
257
treat_err_as_bug : false ,
258
+ mir_opt_level : 1 ,
257
259
build_dep_graph : false ,
258
260
dump_dep_graph : false ,
259
261
no_analysis : false ,
@@ -655,6 +657,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
655
657
"show spans for compiler debugging (expr|pat|ty)" ) ,
656
658
print_trans_items: Option <String > = ( None , parse_opt_string,
657
659
"print the result of the translation item collection pass" ) ,
660
+ mir_opt_level: Option <usize > = ( None , parse_opt_uint,
661
+ "set the MIR optimization level (0-3)" ) ,
658
662
}
659
663
660
664
pub fn default_lib_output ( ) -> CrateType {
@@ -988,6 +992,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
988
992
let parse_only = debugging_opts. parse_only ;
989
993
let no_trans = debugging_opts. no_trans ;
990
994
let treat_err_as_bug = debugging_opts. treat_err_as_bug ;
995
+ let mir_opt_level = debugging_opts. mir_opt_level . unwrap_or ( 1 ) ;
991
996
let incremental_compilation = debugging_opts. incr_comp ;
992
997
let dump_dep_graph = debugging_opts. dump_dep_graph ;
993
998
let no_analysis = debugging_opts. no_analysis ;
@@ -1166,6 +1171,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1166
1171
parse_only : parse_only,
1167
1172
no_trans : no_trans,
1168
1173
treat_err_as_bug : treat_err_as_bug,
1174
+ mir_opt_level : mir_opt_level,
1169
1175
build_dep_graph : incremental_compilation || dump_dep_graph,
1170
1176
dump_dep_graph : dump_dep_graph,
1171
1177
no_analysis : no_analysis,
0 commit comments