@@ -111,13 +111,13 @@ pub mod write {
111
111
fn target_feature < ' a > ( sess : & ' a Session ) -> & ' a str {
112
112
match sess. targ_cfg . os {
113
113
abi:: OsAndroid => {
114
- if "" == sess. opts . target_feature {
114
+ if "" == sess. opts . cg . target_feature {
115
115
"+v7"
116
116
} else {
117
- sess. opts . target_feature . as_slice ( )
117
+ sess. opts . cg . target_feature . as_slice ( )
118
118
}
119
119
}
120
- _ => sess. opts . target_feature . as_slice ( )
120
+ _ => sess. opts . cg . target_feature . as_slice ( )
121
121
}
122
122
}
123
123
@@ -130,7 +130,7 @@ pub mod write {
130
130
unsafe {
131
131
configure_llvm ( sess) ;
132
132
133
- if sess. opts . save_temps {
133
+ if sess. opts . cg . save_temps {
134
134
output. with_extension ( "no-opt.bc" ) . with_c_str ( |buf| {
135
135
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
136
136
} )
@@ -142,7 +142,7 @@ pub mod write {
142
142
session:: Default => lib:: llvm:: CodeGenLevelDefault ,
143
143
session:: Aggressive => lib:: llvm:: CodeGenLevelAggressive ,
144
144
} ;
145
- let use_softfp = sess. opts . debugging_opts & session :: USE_SOFTFP != 0 ;
145
+ let use_softfp = sess. opts . cg . soft_float ;
146
146
147
147
// FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
148
148
// FIXME: #11954: mac64 unwinding may not work with fp elim
@@ -151,7 +151,7 @@ pub mod write {
151
151
sess. targ_cfg . arch == abi:: X86_64 ) ;
152
152
153
153
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 | {
155
155
target_feature ( & sess) . with_c_str ( |Features | {
156
156
llvm:: LLVMRustCreateTargetMachine (
157
157
T , CPU , Features ,
@@ -180,13 +180,13 @@ pub mod write {
180
180
} ;
181
181
if !sess. no_verify ( ) { assert ! ( addpass( "verify" ) ) ; }
182
182
183
- if !sess. no_prepopulate_passes ( ) {
183
+ if !sess. opts . cg . no_prepopulate_passes {
184
184
llvm:: LLVMRustAddAnalysisPasses ( tm, fpm, llmod) ;
185
185
llvm:: LLVMRustAddAnalysisPasses ( tm, mpm, llmod) ;
186
186
populate_llvm_passes ( fpm, mpm, llmod, OptLevel ) ;
187
187
}
188
188
189
- for pass in sess. opts . custom_passes . iter ( ) {
189
+ for pass in sess. opts . cg . passes . iter ( ) {
190
190
pass. with_c_str ( |s| {
191
191
if !llvm:: LLVMRustAddPass ( mpm, s) {
192
192
sess. warn ( format ! ( "unknown pass {}, ignoring" , * pass) ) ;
@@ -208,7 +208,7 @@ pub mod write {
208
208
// emitting an rlib. Whenever an rlib is created, the bytecode is
209
209
// inserted into the archive in order to allow LTO against it.
210
210
let crate_types = sess. crate_types . borrow ( ) ;
211
- if sess. opts . save_temps ||
211
+ if sess. opts . cg . save_temps ||
212
212
( crate_types. get ( ) . contains ( & session:: CrateTypeRlib ) &&
213
213
sess. opts . output_types . contains ( & OutputTypeExe ) ) {
214
214
output. temp_path ( OutputTypeBitcode ) . with_c_str ( |buf| {
@@ -220,7 +220,7 @@ pub mod write {
220
220
time ( sess. time_passes ( ) , "all lto passes" , ( ) , |( ) |
221
221
lto:: run ( sess, llmod, tm, trans. reachable ) ) ;
222
222
223
- if sess. opts . save_temps {
223
+ if sess. opts . cg . save_temps {
224
224
output. with_extension ( "lto.bc" ) . with_c_str ( |buf| {
225
225
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
226
226
} )
@@ -353,10 +353,10 @@ pub mod write {
353
353
354
354
// Copy what clang does by turning on loop vectorization at O2 and
355
355
// slp vectorization at O3
356
- let vectorize_loop = !sess. no_vectorize_loops ( ) &&
356
+ let vectorize_loop = !sess. opts . cg . no_vectorize_loops &&
357
357
( sess. opts . optimize == session:: Default ||
358
358
sess. opts . optimize == session:: Aggressive ) ;
359
- let vectorize_slp = !sess. no_vectorize_slp ( ) &&
359
+ let vectorize_slp = !sess. opts . cg . no_vectorize_slp &&
360
360
sess. opts . optimize == session:: Aggressive ;
361
361
362
362
let mut llvm_c_strs = ~[ ] ;
@@ -374,7 +374,7 @@ pub mod write {
374
374
if sess. time_llvm_passes ( ) { add ( "-time-passes" ) ; }
375
375
if sess. print_llvm_passes ( ) { add ( "-debug-pass=Structure" ) ; }
376
376
377
- for arg in sess. opts . llvm_args . iter ( ) {
377
+ for arg in sess. opts . cg . llvm_args . iter ( ) {
378
378
add ( * arg) ;
379
379
}
380
380
@@ -745,7 +745,7 @@ pub fn output_lib_filename(lm: &LinkMeta) -> ~str {
745
745
}
746
746
747
747
pub fn get_cc_prog ( sess : Session ) -> ~str {
748
- match sess. opts . linker {
748
+ match sess. opts . cg . linker {
749
749
Some ( ref linker) => return linker. to_owned ( ) ,
750
750
None => { }
751
751
}
@@ -763,7 +763,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
763
763
}
764
764
765
765
pub fn get_ar_prog ( sess : Session ) -> ~str {
766
- match sess. opts . ar {
766
+ match sess. opts . cg . ar {
767
767
Some ( ref ar) => return ar. to_owned ( ) ,
768
768
None => { }
769
769
}
@@ -773,7 +773,7 @@ pub fn get_ar_prog(sess: Session) -> ~str {
773
773
774
774
fn get_system_tool ( sess : Session , tool : & str ) -> ~str {
775
775
match sess. targ_cfg . os {
776
- abi:: OsAndroid => match sess. opts . android_cross_path {
776
+ abi:: OsAndroid => match sess. opts . cg . android_cross_path {
777
777
Some ( ref path) => {
778
778
let tool_str = match tool {
779
779
"cc" => "gcc" ,
@@ -813,7 +813,7 @@ pub fn link_binary(sess: Session,
813
813
}
814
814
815
815
// 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 {
817
817
let obj_filename = outputs. temp_path ( OutputTypeObject ) ;
818
818
if !sess. opts . output_types . contains ( & OutputTypeObject ) {
819
819
remove ( sess, & obj_filename) ;
@@ -969,7 +969,7 @@ fn link_rlib(sess: Session,
969
969
// into the archive.
970
970
let bc = obj_filename. with_extension ( "bc" ) ;
971
971
a. add_file ( & bc, false ) ;
972
- if !sess. opts . save_temps &&
972
+ if !sess. opts . cg . save_temps &&
973
973
!sess. opts . output_types . contains ( & OutputTypeBitcode ) {
974
974
remove ( sess, & bc) ;
975
975
}
@@ -1142,7 +1142,7 @@ fn link_args(sess: Session,
1142
1142
args. push ( ~"-dynamiclib") ;
1143
1143
args. push ( ~"-Wl , -dylib") ;
1144
1144
// FIXME (#9639): This needs to handle non-utf8 paths
1145
- if !sess. opts . no_rpath {
1145
+ if !sess. opts . cg . no_rpath {
1146
1146
args. push ( ~"-Wl , -install_name, @rpath/" +
1147
1147
out_filename.filename_str().unwrap());
1148
1148
}
@@ -1163,13 +1163,13 @@ fn link_args(sess: Session,
1163
1163
// FIXME (#2397): At some point we want to rpath our guesses as to
1164
1164
// where extern libraries might live, based on the
1165
1165
// addl_lib_search_paths
1166
- if !sess. opts . no_rpath {
1166
+ if !sess. opts . cg . no_rpath {
1167
1167
args. push_all ( rpath:: get_rpath_flags ( sess, out_filename) ) ;
1168
1168
}
1169
1169
1170
1170
// Finally add all the linker arguments provided on the command line along
1171
1171
// 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 ) ;
1173
1173
let used_link_args = sess. cstore . get_used_link_args ( ) ;
1174
1174
let used_link_args = used_link_args. borrow ( ) ;
1175
1175
for arg in used_link_args. get ( ) . iter ( ) {
@@ -1235,7 +1235,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1235
1235
}
1236
1236
1237
1237
let cstore = sess. cstore ;
1238
- if !dylib && !sess. prefer_dynamic ( ) {
1238
+ if !dylib && !sess. opts . cg . prefer_dynamic {
1239
1239
// With an executable, things get a little interesting. As a limitation
1240
1240
// of the current implementation, we require that everything must be
1241
1241
// static or everything must be dynamic. The reasons for this are a
0 commit comments