Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weed out dependencies on librustc_llvm and librustc. #32571

Merged
merged 3 commits into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
3 changes: 1 addition & 2 deletions src/etc/platform-intrinsics/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,11 @@ def open(self, platform):

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<Intrinsic> {{
pub fn find(name: &str) -> Option<Intrinsic> {{
if !name.starts_with("{0}") {{ return None }}
Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix())

Expand Down
1 change: 0 additions & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
5 changes: 0 additions & 5 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
//
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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") {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ pub fn run_compiler<'a>(args: &[String],

let sopts = config::build_session_options(&matches);

if sopts.debugging_opts.debug_llvm {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be moved all the way to phase 3 I think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case something is touching LLVM before then, I didn't want to change behavior.

unsafe { llvm::LLVMSetDebug(1); }
}

let descriptions = diagnostics_registry();

do_or_return!(callbacks.early_callback(&matches,
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_platform_intrinsics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
3 changes: 1 addition & 2 deletions src/librustc_platform_intrinsics/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Intrinsic> {
pub fn find(name: &str) -> Option<Intrinsic> {
if !name.starts_with("aarch64_v") { return None }
Some(match &name["aarch64_v".len()..] {
"hadd_s8" => Intrinsic {
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_platform_intrinsics/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Intrinsic> {
pub fn find(name: &str) -> Option<Intrinsic> {
if !name.starts_with("arm_v") { return None }
Some(match &name["arm_v".len()..] {
"hadd_s8" => Intrinsic {
Expand Down
15 changes: 5 additions & 10 deletions src/librustc_platform_intrinsics/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -102,13 +97,13 @@ mod arm;
mod aarch64;

impl Intrinsic {
pub fn find<'tcx>(tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
pub fn find(name: &str) -> Option<Intrinsic> {
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
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_platform_intrinsics/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Intrinsic> {
pub fn find(name: &str) -> Option<Intrinsic> {
if !name.starts_with("x86_mm") { return None }
Some(match &name["x86_mm".len()..] {
"_movemask_ps" => Intrinsic {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/execution-engine/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down