Skip to content

Commit ec666a5

Browse files
committed
Auto merge of #32571 - eddyb:llvm-back-to-back, r=alexcrichton
Weed out dependencies on librustc_llvm and librustc. Found while working on #32570. cc @nikomatsakis
2 parents 8f5c3f1 + f22ec29 commit ec666a5

File tree

16 files changed

+22
-44
lines changed

16 files changed

+22
-44
lines changed

mk/crates.mk

+6-5
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ TARGET_CRATES := libc std term \
5353
getopts collections test rand \
5454
core alloc \
5555
rustc_unicode rustc_bitflags \
56-
alloc_system alloc_jemalloc rustc_const_eval
56+
alloc_system alloc_jemalloc
5757
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
5858
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
5959
rustc_data_structures rustc_front rustc_platform_intrinsics \
60-
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis
60+
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
61+
rustc_const_eval
6162
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
6263
flate arena graphviz rbml log serialize
6364
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
@@ -94,9 +95,9 @@ DEPS_syntax_ext := syntax fmt_macros
9495
DEPS_rustc_const_eval := std syntax
9596

9697
DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml rustc_front\
97-
log graphviz rustc_llvm rustc_back rustc_data_structures\
98+
log graphviz rustc_back rustc_data_structures\
9899
rustc_const_eval
99-
DEPS_rustc_back := std syntax rustc_llvm rustc_front flate log libc
100+
DEPS_rustc_back := std syntax rustc_front flate log libc
100101
DEPS_rustc_borrowck := rustc rustc_front rustc_mir log graphviz syntax
101102
DEPS_rustc_data_structures := std log serialize
102103
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
110111
DEPS_rustc_passes := syntax rustc core rustc_front
111112
DEPS_rustc_mir := rustc rustc_front syntax rustc_const_eval
112113
DEPS_rustc_resolve := arena rustc rustc_front log syntax
113-
DEPS_rustc_platform_intrinsics := rustc rustc_llvm
114+
DEPS_rustc_platform_intrinsics := std
114115
DEPS_rustc_plugin := rustc rustc_metadata syntax rustc_mir
115116
DEPS_rustc_privacy := rustc rustc_front log syntax
116117
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \

src/etc/platform-intrinsics/generator.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -759,12 +759,11 @@ def open(self, platform):
759759
760760
use {{Intrinsic, Type}};
761761
use IntrinsicDef::Named;
762-
use rustc::middle::ty::TyCtxt;
763762
764763
// The default inlining settings trigger a pathological behaviour in
765764
// LLVM, which causes makes compilation very slow. See #28273.
766765
#[inline(never)]
767-
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {{
766+
pub fn find(name: &str) -> Option<Intrinsic> {{
768767
if !name.starts_with("{0}") {{ return None }}
769768
Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix())
770769

src/librustc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ rustc_bitflags = { path = "../librustc_bitflags" }
2121
rustc_const_eval = { path = "../librustc_const_eval" }
2222
rustc_data_structures = { path = "../librustc_data_structures" }
2323
rustc_front = { path = "../librustc_front" }
24-
rustc_llvm = { path = "../librustc_llvm" }
2524
serialize = { path = "../libserialize" }
2625
syntax = { path = "../libsyntax" }

src/librustc/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ extern crate getopts;
5050
extern crate graphviz;
5151
extern crate libc;
5252
extern crate rbml;
53-
pub extern crate rustc_llvm as llvm;
5453
extern crate rustc_back;
5554
extern crate rustc_front;
5655
extern crate rustc_data_structures;
@@ -140,10 +139,6 @@ pub mod util {
140139
pub mod fs;
141140
}
142141

143-
pub mod lib {
144-
pub use llvm;
145-
}
146-
147142
// A private module so that macro-expanded idents like
148143
// `::rustc::lint::Lint` will also work in `rustc` itself.
149144
//

src/librustc/session/config.rs

-6
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ use std::env;
3838
use std::fmt;
3939
use std::path::PathBuf;
4040

41-
use llvm;
42-
4341
pub struct Config {
4442
pub target: Target,
4543
pub int_type: IntTy,
@@ -1052,10 +1050,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10521050
let dump_dep_graph = debugging_opts.dump_dep_graph;
10531051
let no_analysis = debugging_opts.no_analysis;
10541052

1055-
if debugging_opts.debug_llvm {
1056-
unsafe { llvm::LLVMSetDebug(1); }
1057-
}
1058-
10591053
let mut output_types = HashMap::new();
10601054
if !debugging_opts.parse_only && !no_trans {
10611055
for list in matches.opt_strs("emit") {

src/librustc_back/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ crate-type = ["dylib"]
1111
[dependencies]
1212
syntax = { path = "../libsyntax" }
1313
serialize = { path = "../libserialize" }
14-
rustc_llvm = { path = "../librustc_llvm" }
1514
rustc_front = { path = "../librustc_front" }
1615
log = { path = "../liblog" }
1716

src/librustc_back/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
extern crate syntax;
4646
extern crate libc;
4747
extern crate serialize;
48-
extern crate rustc_llvm;
4948
extern crate rustc_front;
5049
#[macro_use] extern crate log;
5150

src/librustc_driver/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ pub fn run_compiler<'a>(args: &[String],
166166

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

169+
if sopts.debugging_opts.debug_llvm {
170+
unsafe { llvm::LLVMSetDebug(1); }
171+
}
172+
169173
let descriptions = diagnostics_registry();
170174

171175
do_or_return!(callbacks.early_callback(&matches,

src/librustc_platform_intrinsics/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ version = "0.0.0"
77
name = "rustc_platform_intrinsics"
88
path = "lib.rs"
99
crate-type = ["dylib"]
10-
11-
[dependencies]
12-
rustc_llvm = { path = "../librustc_llvm" }
13-
rustc = { path = "../librustc" }

src/librustc_platform_intrinsics/aarch64.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
use {Intrinsic, Type};
1717
use IntrinsicDef::Named;
18-
use rustc::ty::TyCtxt;
1918

2019
// The default inlining settings trigger a pathological behaviour in
2120
// LLVM, which causes makes compilation very slow. See #28273.
2221
#[inline(never)]
23-
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
22+
pub fn find(name: &str) -> Option<Intrinsic> {
2423
if !name.starts_with("aarch64_v") { return None }
2524
Some(match &name["aarch64_v".len()..] {
2625
"hadd_s8" => Intrinsic {

src/librustc_platform_intrinsics/arm.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
use {Intrinsic, Type};
1717
use IntrinsicDef::Named;
18-
use rustc::ty::TyCtxt;
1918

2019
// The default inlining settings trigger a pathological behaviour in
2120
// LLVM, which causes makes compilation very slow. See #28273.
2221
#[inline(never)]
23-
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
22+
pub fn find(name: &str) -> Option<Intrinsic> {
2423
if !name.starts_with("arm_v") { return None }
2524
Some(match &name["arm_v".len()..] {
2625
"hadd_s8" => Intrinsic {

src/librustc_platform_intrinsics/lib.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@
1212
#![unstable(feature = "rustc_private", issue = "27812")]
1313
#![crate_type = "dylib"]
1414
#![crate_type = "rlib"]
15-
#![feature(staged_api, rustc_private)]
15+
#![feature(staged_api)]
1616
#![cfg_attr(not(stage0), deny(warnings))]
1717
#![allow(bad_style)]
1818

19-
extern crate rustc_llvm as llvm;
20-
extern crate rustc;
21-
22-
use rustc::ty::TyCtxt;
23-
2419
pub struct Intrinsic {
2520
pub inputs: &'static [&'static Type],
2621
pub output: &'static Type,
@@ -102,13 +97,13 @@ mod arm;
10297
mod aarch64;
10398

10499
impl Intrinsic {
105-
pub fn find<'tcx>(tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
100+
pub fn find(name: &str) -> Option<Intrinsic> {
106101
if name.starts_with("x86_") {
107-
x86::find(tcx, name)
102+
x86::find(name)
108103
} else if name.starts_with("arm_") {
109-
arm::find(tcx, name)
104+
arm::find(name)
110105
} else if name.starts_with("aarch64_") {
111-
aarch64::find(tcx, name)
106+
aarch64::find(name)
112107
} else {
113108
None
114109
}

src/librustc_platform_intrinsics/x86.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
use {Intrinsic, Type};
1717
use IntrinsicDef::Named;
18-
use rustc::ty::TyCtxt;
1918

2019
// The default inlining settings trigger a pathological behaviour in
2120
// LLVM, which causes makes compilation very slow. See #28273.
2221
#[inline(never)]
23-
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
22+
pub fn find(name: &str) -> Option<Intrinsic> {
2423
if !name.starts_with("x86_mm") { return None }
2524
Some(match &name["x86_mm".len()..] {
2625
"_movemask_ps" => Intrinsic {

src/librustc_trans/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
818818
}
819819

820820
(_, _) => {
821-
let intr = match Intrinsic::find(tcx, &name) {
821+
let intr = match Intrinsic::find(&name) {
822822
Some(intr) => intr,
823823
None => unreachable!("unknown intrinsic '{}'", name),
824824
};

src/librustc_typeck/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub fn check_platform_intrinsic_type(ccx: &CrateCtxt,
360360
}
361361
}
362362
_ => {
363-
match intrinsics::Intrinsic::find(tcx, &name) {
363+
match intrinsics::Intrinsic::find(&name) {
364364
Some(intr) => {
365365
// this function is a platform specific intrinsic
366366
if i_n_tps != 0 {

src/test/run-make/execution-engine/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern crate rustc;
1616
extern crate rustc_driver;
1717
extern crate rustc_front;
1818
extern crate rustc_lint;
19+
extern crate rustc_llvm as llvm;
1920
extern crate rustc_metadata;
2021
extern crate rustc_resolve;
2122
#[macro_use] extern crate syntax;
@@ -28,7 +29,6 @@ use std::thread::Builder;
2829

2930
use rustc::dep_graph::DepGraph;
3031
use rustc::front::map as ast_map;
31-
use rustc::llvm;
3232
use rustc::middle::cstore::{CrateStore, LinkagePreference};
3333
use rustc::ty;
3434
use rustc::session::config::{self, basic_options, build_configuration, Input, Options};

0 commit comments

Comments
 (0)