@@ -37,19 +37,16 @@ use syntax_pos::{Span, MultiSpan, FileMap};
37
37
use rustc_back:: { LinkerFlavor , PanicStrategy } ;
38
38
use rustc_back:: target:: Target ;
39
39
use rustc_data_structures:: flock;
40
- use llvm;
41
40
42
41
use std:: path:: { Path , PathBuf } ;
43
42
use std:: cell:: { self , Cell , RefCell } ;
44
43
use std:: collections:: HashMap ;
45
44
use std:: env;
46
- use std:: ffi:: CString ;
47
45
use std:: io:: Write ;
48
46
use std:: rc:: Rc ;
49
47
use std:: fmt;
50
48
use std:: time:: Duration ;
51
49
use std:: sync:: Arc ;
52
- use libc:: c_int;
53
50
54
51
mod code_stats;
55
52
pub mod config;
@@ -713,8 +710,6 @@ pub fn build_session_(sopts: config::Options,
713
710
out_of_fuel : Cell :: new ( false ) ,
714
711
} ;
715
712
716
- init_llvm ( & sess) ;
717
-
718
713
sess
719
714
}
720
715
@@ -743,55 +738,6 @@ pub enum IncrCompSession {
743
738
}
744
739
}
745
740
746
- fn init_llvm ( sess : & Session ) {
747
- unsafe {
748
- // Before we touch LLVM, make sure that multithreading is enabled.
749
- use std:: sync:: Once ;
750
- static INIT : Once = Once :: new ( ) ;
751
- static mut POISONED : bool = false ;
752
- INIT . call_once ( || {
753
- if llvm:: LLVMStartMultithreaded ( ) != 1 {
754
- // use an extra bool to make sure that all future usage of LLVM
755
- // cannot proceed despite the Once not running more than once.
756
- POISONED = true ;
757
- }
758
-
759
- configure_llvm ( sess) ;
760
- } ) ;
761
-
762
- if POISONED {
763
- bug ! ( "couldn't enable multi-threaded LLVM" ) ;
764
- }
765
- }
766
- }
767
-
768
- unsafe fn configure_llvm ( sess : & Session ) {
769
- let mut llvm_c_strs = Vec :: new ( ) ;
770
- let mut llvm_args = Vec :: new ( ) ;
771
-
772
- {
773
- let mut add = |arg : & str | {
774
- let s = CString :: new ( arg) . unwrap ( ) ;
775
- llvm_args. push ( s. as_ptr ( ) ) ;
776
- llvm_c_strs. push ( s) ;
777
- } ;
778
- add ( "rustc" ) ; // fake program name
779
- if sess. time_llvm_passes ( ) { add ( "-time-passes" ) ; }
780
- if sess. print_llvm_passes ( ) { add ( "-debug-pass=Structure" ) ; }
781
-
782
- for arg in & sess. opts . cg . llvm_args {
783
- add ( & ( * arg) ) ;
784
- }
785
- }
786
-
787
- llvm:: LLVMInitializePasses ( ) ;
788
-
789
- llvm:: initialize_available_targets ( ) ;
790
-
791
- llvm:: LLVMRustSetLLVMOptions ( llvm_args. len ( ) as c_int ,
792
- llvm_args. as_ptr ( ) ) ;
793
- }
794
-
795
741
pub fn early_error ( output : config:: ErrorOutputType , msg : & str ) -> ! {
796
742
let emitter: Box < Emitter > = match output {
797
743
config:: ErrorOutputType :: HumanReadable ( color_config) => {
0 commit comments