@@ -111,13 +111,13 @@ pub mod write {
111111 fn target_feature < ' a > ( sess : & ' a Session ) -> & ' a str {
112112 match sess. targ_cfg . os {
113113 abi:: OsAndroid => {
114- if "" == sess. opts . target_feature {
114+ if "" == sess. opts . cg . target_feature {
115115 "+v7"
116116 } else {
117- sess. opts . target_feature . as_slice ( )
117+ sess. opts . cg . target_feature . as_slice ( )
118118 }
119119 }
120- _ => sess. opts . target_feature . as_slice ( )
120+ _ => sess. opts . cg . target_feature . as_slice ( )
121121 }
122122 }
123123
@@ -130,7 +130,7 @@ pub mod write {
130130 unsafe {
131131 configure_llvm ( sess) ;
132132
133- if sess. opts . save_temps {
133+ if sess. opts . cg . save_temps {
134134 output. with_extension ( "no-opt.bc" ) . with_c_str ( |buf| {
135135 llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
136136 } )
@@ -142,7 +142,7 @@ pub mod write {
142142 session:: Default => lib:: llvm:: CodeGenLevelDefault ,
143143 session:: Aggressive => lib:: llvm:: CodeGenLevelAggressive ,
144144 } ;
145- let use_softfp = sess. opts . debugging_opts & session :: USE_SOFTFP != 0 ;
145+ let use_softfp = sess. opts . cg . soft_float ;
146146
147147 // FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
148148 // FIXME: #11954: mac64 unwinding may not work with fp elim
@@ -151,7 +151,7 @@ pub mod write {
151151 sess. targ_cfg . arch == abi:: X86_64 ) ;
152152
153153 let tm = sess. targ_cfg . target_strs . target_triple . with_c_str ( |T | {
154- sess. opts . target_cpu . with_c_str ( |CPU | {
154+ sess. opts . cg . target_cpu . with_c_str ( |CPU | {
155155 target_feature ( & sess) . with_c_str ( |Features | {
156156 llvm:: LLVMRustCreateTargetMachine (
157157 T , CPU , Features ,
@@ -180,13 +180,13 @@ pub mod write {
180180 } ;
181181 if !sess. no_verify ( ) { assert ! ( addpass( "verify" ) ) ; }
182182
183- if !sess. no_prepopulate_passes ( ) {
183+ if !sess. opts . cg . no_prepopulate_passes {
184184 llvm:: LLVMRustAddAnalysisPasses ( tm, fpm, llmod) ;
185185 llvm:: LLVMRustAddAnalysisPasses ( tm, mpm, llmod) ;
186186 populate_llvm_passes ( fpm, mpm, llmod, OptLevel ) ;
187187 }
188188
189- for pass in sess. opts . custom_passes . iter ( ) {
189+ for pass in sess. opts . cg . passes . iter ( ) {
190190 pass. with_c_str ( |s| {
191191 if !llvm:: LLVMRustAddPass ( mpm, s) {
192192 sess. warn ( format ! ( "unknown pass {}, ignoring" , * pass) ) ;
@@ -208,7 +208,7 @@ pub mod write {
208208 // emitting an rlib. Whenever an rlib is created, the bytecode is
209209 // inserted into the archive in order to allow LTO against it.
210210 let crate_types = sess. crate_types . borrow ( ) ;
211- if sess. opts . save_temps ||
211+ if sess. opts . cg . save_temps ||
212212 ( crate_types. get ( ) . contains ( & session:: CrateTypeRlib ) &&
213213 sess. opts . output_types . contains ( & OutputTypeExe ) ) {
214214 output. temp_path ( OutputTypeBitcode ) . with_c_str ( |buf| {
@@ -220,7 +220,7 @@ pub mod write {
220220 time ( sess. time_passes ( ) , "all lto passes" , ( ) , |( ) |
221221 lto:: run ( sess, llmod, tm, trans. reachable ) ) ;
222222
223- if sess. opts . save_temps {
223+ if sess. opts . cg . save_temps {
224224 output. with_extension ( "lto.bc" ) . with_c_str ( |buf| {
225225 llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
226226 } )
@@ -353,10 +353,10 @@ pub mod write {
353353
354354 // Copy what clang does by turning on loop vectorization at O2 and
355355 // slp vectorization at O3
356- let vectorize_loop = !sess. no_vectorize_loops ( ) &&
356+ let vectorize_loop = !sess. opts . cg . no_vectorize_loops &&
357357 ( sess. opts . optimize == session:: Default ||
358358 sess. opts . optimize == session:: Aggressive ) ;
359- let vectorize_slp = !sess. no_vectorize_slp ( ) &&
359+ let vectorize_slp = !sess. opts . cg . no_vectorize_slp &&
360360 sess. opts . optimize == session:: Aggressive ;
361361
362362 let mut llvm_c_strs = ~[ ] ;
@@ -374,7 +374,7 @@ pub mod write {
374374 if sess. time_llvm_passes ( ) { add ( "-time-passes" ) ; }
375375 if sess. print_llvm_passes ( ) { add ( "-debug-pass=Structure" ) ; }
376376
377- for arg in sess. opts . llvm_args . iter ( ) {
377+ for arg in sess. opts . cg . llvm_args . iter ( ) {
378378 add ( * arg) ;
379379 }
380380
@@ -745,7 +745,7 @@ pub fn output_lib_filename(lm: &LinkMeta) -> ~str {
745745}
746746
747747pub fn get_cc_prog ( sess : Session ) -> ~str {
748- match sess. opts . linker {
748+ match sess. opts . cg . linker {
749749 Some ( ref linker) => return linker. to_owned ( ) ,
750750 None => { }
751751 }
@@ -763,7 +763,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
763763}
764764
765765pub fn get_ar_prog ( sess : Session ) -> ~str {
766- match sess. opts . ar {
766+ match sess. opts . cg . ar {
767767 Some ( ref ar) => return ar. to_owned ( ) ,
768768 None => { }
769769 }
@@ -773,7 +773,7 @@ pub fn get_ar_prog(sess: Session) -> ~str {
773773
774774fn get_system_tool ( sess : Session , tool : & str ) -> ~str {
775775 match sess. targ_cfg . os {
776- abi:: OsAndroid => match sess. opts . android_cross_path {
776+ abi:: OsAndroid => match sess. opts . cg . android_cross_path {
777777 Some ( ref path) => {
778778 let tool_str = match tool {
779779 "cc" => "gcc" ,
@@ -813,7 +813,7 @@ pub fn link_binary(sess: Session,
813813 }
814814
815815 // Remove the temporary object file and metadata if we aren't saving temps
816- if !sess. opts . save_temps {
816+ if !sess. opts . cg . save_temps {
817817 let obj_filename = outputs. temp_path ( OutputTypeObject ) ;
818818 if !sess. opts . output_types . contains ( & OutputTypeObject ) {
819819 remove ( sess, & obj_filename) ;
@@ -969,7 +969,7 @@ fn link_rlib(sess: Session,
969969 // into the archive.
970970 let bc = obj_filename. with_extension ( "bc" ) ;
971971 a. add_file ( & bc, false ) ;
972- if !sess. opts . save_temps &&
972+ if !sess. opts . cg . save_temps &&
973973 !sess. opts . output_types . contains ( & OutputTypeBitcode ) {
974974 remove ( sess, & bc) ;
975975 }
@@ -1142,7 +1142,7 @@ fn link_args(sess: Session,
11421142 args. push ( ~"-dynamiclib") ;
11431143 args. push ( ~"-Wl , -dylib") ;
11441144 // FIXME (#9639): This needs to handle non-utf8 paths
1145- if !sess. opts . no_rpath {
1145+ if !sess. opts . cg . no_rpath {
11461146 args. push ( ~"-Wl , -install_name, @rpath/" +
11471147 out_filename.filename_str().unwrap());
11481148 }
@@ -1163,13 +1163,13 @@ fn link_args(sess: Session,
11631163 // FIXME (#2397): At some point we want to rpath our guesses as to
11641164 // where extern libraries might live, based on the
11651165 // addl_lib_search_paths
1166- if !sess. opts . no_rpath {
1166+ if !sess. opts . cg . no_rpath {
11671167 args. push_all ( rpath:: get_rpath_flags ( sess, out_filename) ) ;
11681168 }
11691169
11701170 // Finally add all the linker arguments provided on the command line along
11711171 // with any #[link_args] attributes found inside the crate
1172- args. push_all ( sess. opts . linker_args ) ;
1172+ args. push_all ( sess. opts . cg . link_args ) ;
11731173 let used_link_args = sess. cstore . get_used_link_args ( ) ;
11741174 let used_link_args = used_link_args. borrow ( ) ;
11751175 for arg in used_link_args. get ( ) . iter ( ) {
@@ -1235,7 +1235,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
12351235 }
12361236
12371237 let cstore = sess. cstore ;
1238- if !dylib && !sess. prefer_dynamic ( ) {
1238+ if !dylib && !sess. opts . cg . prefer_dynamic {
12391239 // With an executable, things get a little interesting. As a limitation
12401240 // of the current implementation, we require that everything must be
12411241 // static or everything must be dynamic. The reasons for this are a
0 commit comments