diff --git a/mk/crates.mk b/mk/crates.mk index 05018d2a940..ba959d2778e 100644 --- a/mk/crates.mk +++ b/mk/crates.mk @@ -53,11 +53,12 @@ TARGET_CRATES := libc std term \ getopts collections test rand \ core alloc \ rustc_unicode rustc_bitflags \ - alloc_system alloc_jemalloc rustc_const_eval + alloc_system alloc_jemalloc RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \ rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \ rustc_data_structures rustc_front rustc_platform_intrinsics \ - rustc_plugin rustc_metadata rustc_passes rustc_save_analysis + rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \ + rustc_const_eval HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \ flate arena graphviz rbml log serialize TOOLS := compiletest rustdoc rustc rustbook error_index_generator @@ -94,9 +95,9 @@ DEPS_syntax_ext := syntax fmt_macros DEPS_rustc_const_eval := std syntax DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml rustc_front\ - log graphviz rustc_llvm rustc_back rustc_data_structures\ + log graphviz rustc_back rustc_data_structures\ rustc_const_eval -DEPS_rustc_back := std syntax rustc_llvm rustc_front flate log libc +DEPS_rustc_back := std syntax rustc_front flate log libc DEPS_rustc_borrowck := rustc rustc_front rustc_mir log graphviz syntax DEPS_rustc_data_structures := std log serialize DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \ @@ -110,7 +111,7 @@ DEPS_rustc_metadata := rustc rustc_front syntax rbml rustc_const_eval DEPS_rustc_passes := syntax rustc core rustc_front DEPS_rustc_mir := rustc rustc_front syntax rustc_const_eval DEPS_rustc_resolve := arena rustc rustc_front log syntax -DEPS_rustc_platform_intrinsics := rustc rustc_llvm +DEPS_rustc_platform_intrinsics := std DEPS_rustc_plugin := rustc rustc_metadata syntax rustc_mir DEPS_rustc_privacy := rustc rustc_front log syntax DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \ diff --git a/src/etc/platform-intrinsics/generator.py b/src/etc/platform-intrinsics/generator.py index 786cb20ed75..a21194962f9 100644 --- a/src/etc/platform-intrinsics/generator.py +++ b/src/etc/platform-intrinsics/generator.py @@ -759,12 +759,11 @@ class CompilerDefs(object): use {{Intrinsic, Type}}; use IntrinsicDef::Named; -use rustc::middle::ty::TyCtxt; // The default inlining settings trigger a pathological behaviour in // LLVM, which causes makes compilation very slow. See #28273. #[inline(never)] -pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option {{ +pub fn find(name: &str) -> Option {{ if !name.starts_with("{0}") {{ return None }} Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix()) diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 1f000c2af68..d2dc5f1ed93 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -21,6 +21,5 @@ rustc_bitflags = { path = "../librustc_bitflags" } rustc_const_eval = { path = "../librustc_const_eval" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_front = { path = "../librustc_front" } -rustc_llvm = { path = "../librustc_llvm" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 4fdfe59e2b0..6b5f889fcfb 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -50,7 +50,6 @@ extern crate getopts; extern crate graphviz; extern crate libc; extern crate rbml; -pub extern crate rustc_llvm as llvm; extern crate rustc_back; extern crate rustc_front; extern crate rustc_data_structures; @@ -140,10 +139,6 @@ pub mod util { pub mod fs; } -pub mod lib { - pub use llvm; -} - // A private module so that macro-expanded idents like // `::rustc::lint::Lint` will also work in `rustc` itself. // diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index bf532d9ccf9..0eef4b5221a 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -38,8 +38,6 @@ use std::env; use std::fmt; use std::path::PathBuf; -use llvm; - pub struct Config { pub target: Target, pub int_type: IntTy, @@ -1052,10 +1050,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let dump_dep_graph = debugging_opts.dump_dep_graph; let no_analysis = debugging_opts.no_analysis; - if debugging_opts.debug_llvm { - unsafe { llvm::LLVMSetDebug(1); } - } - let mut output_types = HashMap::new(); if !debugging_opts.parse_only && !no_trans { for list in matches.opt_strs("emit") { diff --git a/src/librustc_back/Cargo.toml b/src/librustc_back/Cargo.toml index 255ca60e2b8..2cf6cbc4bcf 100644 --- a/src/librustc_back/Cargo.toml +++ b/src/librustc_back/Cargo.toml @@ -11,7 +11,6 @@ crate-type = ["dylib"] [dependencies] syntax = { path = "../libsyntax" } serialize = { path = "../libserialize" } -rustc_llvm = { path = "../librustc_llvm" } rustc_front = { path = "../librustc_front" } log = { path = "../liblog" } diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index d854b9ed697..80dec2cd281 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -45,7 +45,6 @@ extern crate syntax; extern crate libc; extern crate serialize; -extern crate rustc_llvm; extern crate rustc_front; #[macro_use] extern crate log; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index d8d1cf5a026..057a34c27b1 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -166,6 +166,10 @@ pub fn run_compiler<'a>(args: &[String], let sopts = config::build_session_options(&matches); + if sopts.debugging_opts.debug_llvm { + unsafe { llvm::LLVMSetDebug(1); } + } + let descriptions = diagnostics_registry(); do_or_return!(callbacks.early_callback(&matches, diff --git a/src/librustc_platform_intrinsics/Cargo.toml b/src/librustc_platform_intrinsics/Cargo.toml index 97bf4f854cc..92f37f974ef 100644 --- a/src/librustc_platform_intrinsics/Cargo.toml +++ b/src/librustc_platform_intrinsics/Cargo.toml @@ -7,7 +7,3 @@ version = "0.0.0" name = "rustc_platform_intrinsics" path = "lib.rs" crate-type = ["dylib"] - -[dependencies] -rustc_llvm = { path = "../librustc_llvm" } -rustc = { path = "../librustc" } diff --git a/src/librustc_platform_intrinsics/aarch64.rs b/src/librustc_platform_intrinsics/aarch64.rs index 97fe632a529..0fb8513e138 100644 --- a/src/librustc_platform_intrinsics/aarch64.rs +++ b/src/librustc_platform_intrinsics/aarch64.rs @@ -15,12 +15,11 @@ use {Intrinsic, Type}; use IntrinsicDef::Named; -use rustc::ty::TyCtxt; // The default inlining settings trigger a pathological behaviour in // LLVM, which causes makes compilation very slow. See #28273. #[inline(never)] -pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option { +pub fn find(name: &str) -> Option { if !name.starts_with("aarch64_v") { return None } Some(match &name["aarch64_v".len()..] { "hadd_s8" => Intrinsic { diff --git a/src/librustc_platform_intrinsics/arm.rs b/src/librustc_platform_intrinsics/arm.rs index 65751d65232..834528aaaa3 100644 --- a/src/librustc_platform_intrinsics/arm.rs +++ b/src/librustc_platform_intrinsics/arm.rs @@ -15,12 +15,11 @@ use {Intrinsic, Type}; use IntrinsicDef::Named; -use rustc::ty::TyCtxt; // The default inlining settings trigger a pathological behaviour in // LLVM, which causes makes compilation very slow. See #28273. #[inline(never)] -pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option { +pub fn find(name: &str) -> Option { if !name.starts_with("arm_v") { return None } Some(match &name["arm_v".len()..] { "hadd_s8" => Intrinsic { diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs index 9736d558769..6fe1f0c2b9c 100644 --- a/src/librustc_platform_intrinsics/lib.rs +++ b/src/librustc_platform_intrinsics/lib.rs @@ -12,15 +12,10 @@ #![unstable(feature = "rustc_private", issue = "27812")] #![crate_type = "dylib"] #![crate_type = "rlib"] -#![feature(staged_api, rustc_private)] +#![feature(staged_api)] #![cfg_attr(not(stage0), deny(warnings))] #![allow(bad_style)] -extern crate rustc_llvm as llvm; -extern crate rustc; - -use rustc::ty::TyCtxt; - pub struct Intrinsic { pub inputs: &'static [&'static Type], pub output: &'static Type, @@ -102,13 +97,13 @@ mod arm; mod aarch64; impl Intrinsic { - pub fn find<'tcx>(tcx: &TyCtxt<'tcx>, name: &str) -> Option { + pub fn find(name: &str) -> Option { if name.starts_with("x86_") { - x86::find(tcx, name) + x86::find(name) } else if name.starts_with("arm_") { - arm::find(tcx, name) + arm::find(name) } else if name.starts_with("aarch64_") { - aarch64::find(tcx, name) + aarch64::find(name) } else { None } diff --git a/src/librustc_platform_intrinsics/x86.rs b/src/librustc_platform_intrinsics/x86.rs index de9d3dcf355..54e2cb929b8 100644 --- a/src/librustc_platform_intrinsics/x86.rs +++ b/src/librustc_platform_intrinsics/x86.rs @@ -15,12 +15,11 @@ use {Intrinsic, Type}; use IntrinsicDef::Named; -use rustc::ty::TyCtxt; // The default inlining settings trigger a pathological behaviour in // LLVM, which causes makes compilation very slow. See #28273. #[inline(never)] -pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option { +pub fn find(name: &str) -> Option { if !name.starts_with("x86_mm") { return None } Some(match &name["x86_mm".len()..] { "_movemask_ps" => Intrinsic { diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs index b7b74e44d3e..130a864f5e6 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -818,7 +818,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, } (_, _) => { - let intr = match Intrinsic::find(tcx, &name) { + let intr = match Intrinsic::find(&name) { Some(intr) => intr, None => unreachable!("unknown intrinsic '{}'", name), }; diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 8720469a724..3c43e0d5217 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -360,7 +360,7 @@ pub fn check_platform_intrinsic_type(ccx: &CrateCtxt, } } _ => { - match intrinsics::Intrinsic::find(tcx, &name) { + match intrinsics::Intrinsic::find(&name) { Some(intr) => { // this function is a platform specific intrinsic if i_n_tps != 0 { diff --git a/src/test/run-make/execution-engine/test.rs b/src/test/run-make/execution-engine/test.rs index 7454bbfb531..81ad276ca68 100644 --- a/src/test/run-make/execution-engine/test.rs +++ b/src/test/run-make/execution-engine/test.rs @@ -16,6 +16,7 @@ extern crate rustc; extern crate rustc_driver; extern crate rustc_front; extern crate rustc_lint; +extern crate rustc_llvm as llvm; extern crate rustc_metadata; extern crate rustc_resolve; #[macro_use] extern crate syntax; @@ -28,7 +29,6 @@ use std::thread::Builder; use rustc::dep_graph::DepGraph; use rustc::front::map as ast_map; -use rustc::llvm; use rustc::middle::cstore::{CrateStore, LinkagePreference}; use rustc::ty; use rustc::session::config::{self, basic_options, build_configuration, Input, Options};