@@ -12,9 +12,8 @@ use back::archive::{Archive, METADATA_FILENAME};
12
12
use back:: rpath;
13
13
use back:: svh:: Svh ;
14
14
use driver:: driver:: { CrateTranslation , OutputFilenames } ;
15
- use driver:: config:: NoDebugInfo ;
16
- use driver:: session:: Session ;
17
- use driver:: config;
15
+ use driver:: session:: { NoDebugInfo , Session } ;
16
+ use driver:: session;
18
17
use lib:: llvm:: llvm;
19
18
use lib:: llvm:: ModuleRef ;
20
19
use lib;
@@ -93,9 +92,8 @@ pub mod write {
93
92
use back:: link:: { OutputTypeExe , OutputTypeLlvmAssembly } ;
94
93
use back:: link:: { OutputTypeObject } ;
95
94
use driver:: driver:: { CrateTranslation , OutputFilenames } ;
96
- use driver:: config:: NoDebugInfo ;
97
- use driver:: session:: Session ;
98
- use driver:: config;
95
+ use driver:: session:: { NoDebugInfo , Session } ;
96
+ use driver:: session;
99
97
use lib:: llvm:: llvm;
100
98
use lib:: llvm:: { ModuleRef , TargetMachineRef , PassManagerRef } ;
101
99
use lib;
@@ -141,10 +139,10 @@ pub mod write {
141
139
}
142
140
143
141
let opt_level = match sess. opts . optimize {
144
- config :: No => lib:: llvm:: CodeGenLevelNone ,
145
- config :: Less => lib:: llvm:: CodeGenLevelLess ,
146
- config :: Default => lib:: llvm:: CodeGenLevelDefault ,
147
- config :: Aggressive => lib:: llvm:: CodeGenLevelAggressive ,
142
+ session :: No => lib:: llvm:: CodeGenLevelNone ,
143
+ session :: Less => lib:: llvm:: CodeGenLevelLess ,
144
+ session :: Default => lib:: llvm:: CodeGenLevelDefault ,
145
+ session :: Aggressive => lib:: llvm:: CodeGenLevelAggressive ,
148
146
} ;
149
147
let use_softfp = sess. opts . cg . soft_float ;
150
148
@@ -233,7 +231,7 @@ pub mod write {
233
231
// emitting an rlib. Whenever an rlib is created, the bytecode is
234
232
// inserted into the archive in order to allow LTO against it.
235
233
if sess. opts . cg . save_temps ||
236
- ( sess. crate_types . borrow ( ) . contains ( & config :: CrateTypeRlib ) &&
234
+ ( sess. crate_types . borrow ( ) . contains ( & session :: CrateTypeRlib ) &&
237
235
sess. opts . output_types . contains ( & OutputTypeExe ) ) {
238
236
output. temp_path ( OutputTypeBitcode ) . with_c_str ( |buf| {
239
237
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
@@ -380,10 +378,10 @@ pub mod write {
380
378
// Copy what clang does by turning on loop vectorization at O2 and
381
379
// slp vectorization at O3
382
380
let vectorize_loop = !sess. opts . cg . no_vectorize_loops &&
383
- ( sess. opts . optimize == config :: Default ||
384
- sess. opts . optimize == config :: Aggressive ) ;
381
+ ( sess. opts . optimize == session :: Default ||
382
+ sess. opts . optimize == session :: Aggressive ) ;
385
383
let vectorize_slp = !sess. opts . cg . no_vectorize_slp &&
386
- sess. opts . optimize == config :: Aggressive ;
384
+ sess. opts . optimize == session :: Aggressive ;
387
385
388
386
let mut llvm_c_strs = Vec :: new ( ) ;
389
387
let mut llvm_args = Vec :: new ( ) ;
@@ -825,14 +823,14 @@ fn is_writeable(p: &Path) -> bool {
825
823
}
826
824
}
827
825
828
- pub fn filename_for_input ( sess : & Session , crate_type : config :: CrateType ,
826
+ pub fn filename_for_input ( sess : & Session , crate_type : session :: CrateType ,
829
827
id : & CrateId , out_filename : & Path ) -> Path {
830
828
let libname = output_lib_filename ( id) ;
831
829
match crate_type {
832
- config :: CrateTypeRlib => {
830
+ session :: CrateTypeRlib => {
833
831
out_filename. with_filename ( format ! ( "lib{}.rlib" , libname) )
834
832
}
835
- config :: CrateTypeDylib => {
833
+ session :: CrateTypeDylib => {
836
834
let ( prefix, suffix) = match sess. targ_cfg . os {
837
835
abi:: OsWin32 => ( loader:: WIN32_DLL_PREFIX , loader:: WIN32_DLL_SUFFIX ) ,
838
836
abi:: OsMacos => ( loader:: MACOS_DLL_PREFIX , loader:: MACOS_DLL_SUFFIX ) ,
@@ -842,16 +840,16 @@ pub fn filename_for_input(sess: &Session, crate_type: config::CrateType,
842
840
} ;
843
841
out_filename. with_filename ( format ! ( "{}{}{}" , prefix, libname, suffix) )
844
842
}
845
- config :: CrateTypeStaticlib => {
843
+ session :: CrateTypeStaticlib => {
846
844
out_filename. with_filename ( format ! ( "lib{}.a" , libname) )
847
845
}
848
- config :: CrateTypeExecutable => out_filename. clone ( ) ,
846
+ session :: CrateTypeExecutable => out_filename. clone ( ) ,
849
847
}
850
848
}
851
849
852
850
fn link_binary_output ( sess : & Session ,
853
851
trans : & CrateTranslation ,
854
- crate_type : config :: CrateType ,
852
+ crate_type : session :: CrateType ,
855
853
outputs : & OutputFilenames ,
856
854
id : & CrateId ) -> Path {
857
855
let obj_filename = outputs. temp_path ( OutputTypeObject ) ;
@@ -879,16 +877,16 @@ fn link_binary_output(sess: &Session,
879
877
}
880
878
881
879
match crate_type {
882
- config :: CrateTypeRlib => {
880
+ session :: CrateTypeRlib => {
883
881
link_rlib ( sess, Some ( trans) , & obj_filename, & out_filename) ;
884
882
}
885
- config :: CrateTypeStaticlib => {
883
+ session :: CrateTypeStaticlib => {
886
884
link_staticlib ( sess, & obj_filename, & out_filename) ;
887
885
}
888
- config :: CrateTypeExecutable => {
886
+ session :: CrateTypeExecutable => {
889
887
link_natively ( sess, trans, false , & obj_filename, & out_filename) ;
890
888
}
891
- config :: CrateTypeDylib => {
889
+ session :: CrateTypeDylib => {
892
890
link_natively ( sess, trans, true , & obj_filename, & out_filename) ;
893
891
}
894
892
}
@@ -1047,7 +1045,7 @@ fn link_natively(sess: &Session, trans: &CrateTranslation, dylib: bool,
1047
1045
let mut cc_args = sess. targ_cfg . target_strs . cc_args . clone ( ) ;
1048
1046
cc_args. push_all_move ( link_args ( sess, dylib, tmpdir. path ( ) , trans,
1049
1047
obj_filename, out_filename) ) ;
1050
- if ( sess. opts . debugging_opts & config :: PRINT_LINK_ARGS ) != 0 {
1048
+ if ( sess. opts . debugging_opts & session :: PRINT_LINK_ARGS ) != 0 {
1051
1049
println ! ( "{} link args: '{}'" , cc_prog, cc_args. connect( "' '" ) ) ;
1052
1050
}
1053
1051
@@ -1163,8 +1161,8 @@ fn link_args(sess: &Session,
1163
1161
1164
1162
// GNU-style linkers support optimization with -O. GNU ld doesn't need a
1165
1163
// numeric argument, but other linkers do.
1166
- if sess. opts . optimize == config :: Default ||
1167
- sess. opts . optimize == config :: Aggressive {
1164
+ if sess. opts . optimize == session :: Default ||
1165
+ sess. opts . optimize == session :: Aggressive {
1168
1166
args. push ( "-Wl,-O1" . to_owned ( ) ) ;
1169
1167
}
1170
1168
} else if sess. targ_cfg . os == abi:: OsMacos {
@@ -1375,9 +1373,9 @@ fn add_upstream_rust_crates(args: &mut Vec<~str>, sess: &Session,
1375
1373
// involves just passing the right -l flag.
1376
1374
1377
1375
let data = if dylib {
1378
- trans. crate_formats . get ( & config :: CrateTypeDylib )
1376
+ trans. crate_formats . get ( & session :: CrateTypeDylib )
1379
1377
} else {
1380
- trans. crate_formats . get ( & config :: CrateTypeExecutable )
1378
+ trans. crate_formats . get ( & session :: CrateTypeExecutable )
1381
1379
} ;
1382
1380
1383
1381
// Invoke get_used_crates to ensure that we get a topological sorting of
@@ -1405,7 +1403,7 @@ fn add_upstream_rust_crates(args: &mut Vec<~str>, sess: &Session,
1405
1403
}
1406
1404
1407
1405
// Converts a library file-stem into a cc -l argument
1408
- fn unlib ( config : & config :: Config , stem : & str ) -> ~str {
1406
+ fn unlib ( config : & session :: Config , stem : & str ) -> ~str {
1409
1407
if stem. starts_with ( "lib" ) && config. os != abi:: OsWin32 {
1410
1408
stem. slice ( 3 , stem. len ( ) ) . to_owned ( )
1411
1409
} else {
0 commit comments