@@ -37,19 +37,16 @@ use syntax_pos::{Span, MultiSpan, FileMap};
3737use rustc_back:: { LinkerFlavor , PanicStrategy } ;
3838use rustc_back:: target:: Target ;
3939use rustc_data_structures:: flock;
40- use llvm;
4140
4241use std:: path:: { Path , PathBuf } ;
4342use std:: cell:: { self , Cell , RefCell } ;
4443use std:: collections:: HashMap ;
4544use std:: env;
46- use std:: ffi:: CString ;
4745use std:: io:: Write ;
4846use std:: rc:: Rc ;
4947use std:: fmt;
5048use std:: time:: Duration ;
5149use std:: sync:: Arc ;
52- use libc:: c_int;
5350
5451mod code_stats;
5552pub mod config;
@@ -713,8 +710,6 @@ pub fn build_session_(sopts: config::Options,
713710 out_of_fuel : Cell :: new ( false ) ,
714711 } ;
715712
716- init_llvm ( & sess) ;
717-
718713 sess
719714}
720715
@@ -743,55 +738,6 @@ pub enum IncrCompSession {
743738 }
744739}
745740
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-
795741pub fn early_error ( output : config:: ErrorOutputType , msg : & str ) -> ! {
796742 let emitter: Box < Emitter > = match output {
797743 config:: ErrorOutputType :: HumanReadable ( color_config) => {
0 commit comments