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