mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 16:45:37 +00:00
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
This commit is contained in:
commit
ec666a5977
11
mk/crates.mk
11
mk/crates.mk
@ -53,11 +53,12 @@ TARGET_CRATES := libc std term \
|
|||||||
getopts collections test rand \
|
getopts collections test rand \
|
||||||
core alloc \
|
core alloc \
|
||||||
rustc_unicode rustc_bitflags \
|
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_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
|
||||||
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
|
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
|
||||||
rustc_data_structures rustc_front rustc_platform_intrinsics \
|
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 \
|
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
|
||||||
flate arena graphviz rbml log serialize
|
flate arena graphviz rbml log serialize
|
||||||
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
|
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_const_eval := std syntax
|
||||||
|
|
||||||
DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml rustc_front\
|
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
|
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_borrowck := rustc rustc_front rustc_mir log graphviz syntax
|
||||||
DEPS_rustc_data_structures := std log serialize
|
DEPS_rustc_data_structures := std log serialize
|
||||||
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
|
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_passes := syntax rustc core rustc_front
|
||||||
DEPS_rustc_mir := rustc rustc_front syntax rustc_const_eval
|
DEPS_rustc_mir := rustc rustc_front syntax rustc_const_eval
|
||||||
DEPS_rustc_resolve := arena rustc rustc_front log syntax
|
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_plugin := rustc rustc_metadata syntax rustc_mir
|
||||||
DEPS_rustc_privacy := rustc rustc_front log syntax
|
DEPS_rustc_privacy := rustc rustc_front log syntax
|
||||||
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
|
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
|
||||||
|
@ -759,12 +759,11 @@ class CompilerDefs(object):
|
|||||||
|
|
||||||
use {{Intrinsic, Type}};
|
use {{Intrinsic, Type}};
|
||||||
use IntrinsicDef::Named;
|
use IntrinsicDef::Named;
|
||||||
use rustc::middle::ty::TyCtxt;
|
|
||||||
|
|
||||||
// The default inlining settings trigger a pathological behaviour in
|
// The default inlining settings trigger a pathological behaviour in
|
||||||
// LLVM, which causes makes compilation very slow. See #28273.
|
// LLVM, which causes makes compilation very slow. See #28273.
|
||||||
#[inline(never)]
|
#[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 }}
|
if !name.starts_with("{0}") {{ return None }}
|
||||||
Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix())
|
Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix())
|
||||||
|
|
||||||
|
@ -21,6 +21,5 @@ rustc_bitflags = { path = "../librustc_bitflags" }
|
|||||||
rustc_const_eval = { path = "../librustc_const_eval" }
|
rustc_const_eval = { path = "../librustc_const_eval" }
|
||||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||||
rustc_front = { path = "../librustc_front" }
|
rustc_front = { path = "../librustc_front" }
|
||||||
rustc_llvm = { path = "../librustc_llvm" }
|
|
||||||
serialize = { path = "../libserialize" }
|
serialize = { path = "../libserialize" }
|
||||||
syntax = { path = "../libsyntax" }
|
syntax = { path = "../libsyntax" }
|
||||||
|
@ -50,7 +50,6 @@ extern crate getopts;
|
|||||||
extern crate graphviz;
|
extern crate graphviz;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate rbml;
|
extern crate rbml;
|
||||||
pub extern crate rustc_llvm as llvm;
|
|
||||||
extern crate rustc_back;
|
extern crate rustc_back;
|
||||||
extern crate rustc_front;
|
extern crate rustc_front;
|
||||||
extern crate rustc_data_structures;
|
extern crate rustc_data_structures;
|
||||||
@ -140,10 +139,6 @@ pub mod util {
|
|||||||
pub mod fs;
|
pub mod fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod lib {
|
|
||||||
pub use llvm;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A private module so that macro-expanded idents like
|
// A private module so that macro-expanded idents like
|
||||||
// `::rustc::lint::Lint` will also work in `rustc` itself.
|
// `::rustc::lint::Lint` will also work in `rustc` itself.
|
||||||
//
|
//
|
||||||
|
@ -38,8 +38,6 @@ use std::env;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use llvm;
|
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub target: Target,
|
pub target: Target,
|
||||||
pub int_type: IntTy,
|
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 dump_dep_graph = debugging_opts.dump_dep_graph;
|
||||||
let no_analysis = debugging_opts.no_analysis;
|
let no_analysis = debugging_opts.no_analysis;
|
||||||
|
|
||||||
if debugging_opts.debug_llvm {
|
|
||||||
unsafe { llvm::LLVMSetDebug(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut output_types = HashMap::new();
|
let mut output_types = HashMap::new();
|
||||||
if !debugging_opts.parse_only && !no_trans {
|
if !debugging_opts.parse_only && !no_trans {
|
||||||
for list in matches.opt_strs("emit") {
|
for list in matches.opt_strs("emit") {
|
||||||
|
@ -11,7 +11,6 @@ crate-type = ["dylib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
syntax = { path = "../libsyntax" }
|
syntax = { path = "../libsyntax" }
|
||||||
serialize = { path = "../libserialize" }
|
serialize = { path = "../libserialize" }
|
||||||
rustc_llvm = { path = "../librustc_llvm" }
|
|
||||||
rustc_front = { path = "../librustc_front" }
|
rustc_front = { path = "../librustc_front" }
|
||||||
log = { path = "../liblog" }
|
log = { path = "../liblog" }
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate rustc_llvm;
|
|
||||||
extern crate rustc_front;
|
extern crate rustc_front;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
||||||
|
@ -166,6 +166,10 @@ pub fn run_compiler<'a>(args: &[String],
|
|||||||
|
|
||||||
let sopts = config::build_session_options(&matches);
|
let sopts = config::build_session_options(&matches);
|
||||||
|
|
||||||
|
if sopts.debugging_opts.debug_llvm {
|
||||||
|
unsafe { llvm::LLVMSetDebug(1); }
|
||||||
|
}
|
||||||
|
|
||||||
let descriptions = diagnostics_registry();
|
let descriptions = diagnostics_registry();
|
||||||
|
|
||||||
do_or_return!(callbacks.early_callback(&matches,
|
do_or_return!(callbacks.early_callback(&matches,
|
||||||
|
@ -7,7 +7,3 @@ version = "0.0.0"
|
|||||||
name = "rustc_platform_intrinsics"
|
name = "rustc_platform_intrinsics"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rustc_llvm = { path = "../librustc_llvm" }
|
|
||||||
rustc = { path = "../librustc" }
|
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
|
|
||||||
use {Intrinsic, Type};
|
use {Intrinsic, Type};
|
||||||
use IntrinsicDef::Named;
|
use IntrinsicDef::Named;
|
||||||
use rustc::ty::TyCtxt;
|
|
||||||
|
|
||||||
// The default inlining settings trigger a pathological behaviour in
|
// The default inlining settings trigger a pathological behaviour in
|
||||||
// LLVM, which causes makes compilation very slow. See #28273.
|
// LLVM, which causes makes compilation very slow. See #28273.
|
||||||
#[inline(never)]
|
#[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 }
|
if !name.starts_with("aarch64_v") { return None }
|
||||||
Some(match &name["aarch64_v".len()..] {
|
Some(match &name["aarch64_v".len()..] {
|
||||||
"hadd_s8" => Intrinsic {
|
"hadd_s8" => Intrinsic {
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
|
|
||||||
use {Intrinsic, Type};
|
use {Intrinsic, Type};
|
||||||
use IntrinsicDef::Named;
|
use IntrinsicDef::Named;
|
||||||
use rustc::ty::TyCtxt;
|
|
||||||
|
|
||||||
// The default inlining settings trigger a pathological behaviour in
|
// The default inlining settings trigger a pathological behaviour in
|
||||||
// LLVM, which causes makes compilation very slow. See #28273.
|
// LLVM, which causes makes compilation very slow. See #28273.
|
||||||
#[inline(never)]
|
#[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 }
|
if !name.starts_with("arm_v") { return None }
|
||||||
Some(match &name["arm_v".len()..] {
|
Some(match &name["arm_v".len()..] {
|
||||||
"hadd_s8" => Intrinsic {
|
"hadd_s8" => Intrinsic {
|
||||||
|
@ -12,15 +12,10 @@
|
|||||||
#![unstable(feature = "rustc_private", issue = "27812")]
|
#![unstable(feature = "rustc_private", issue = "27812")]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![feature(staged_api, rustc_private)]
|
#![feature(staged_api)]
|
||||||
#![cfg_attr(not(stage0), deny(warnings))]
|
#![cfg_attr(not(stage0), deny(warnings))]
|
||||||
#![allow(bad_style)]
|
#![allow(bad_style)]
|
||||||
|
|
||||||
extern crate rustc_llvm as llvm;
|
|
||||||
extern crate rustc;
|
|
||||||
|
|
||||||
use rustc::ty::TyCtxt;
|
|
||||||
|
|
||||||
pub struct Intrinsic {
|
pub struct Intrinsic {
|
||||||
pub inputs: &'static [&'static Type],
|
pub inputs: &'static [&'static Type],
|
||||||
pub output: &'static Type,
|
pub output: &'static Type,
|
||||||
@ -102,13 +97,13 @@ mod arm;
|
|||||||
mod aarch64;
|
mod aarch64;
|
||||||
|
|
||||||
impl Intrinsic {
|
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_") {
|
if name.starts_with("x86_") {
|
||||||
x86::find(tcx, name)
|
x86::find(name)
|
||||||
} else if name.starts_with("arm_") {
|
} else if name.starts_with("arm_") {
|
||||||
arm::find(tcx, name)
|
arm::find(name)
|
||||||
} else if name.starts_with("aarch64_") {
|
} else if name.starts_with("aarch64_") {
|
||||||
aarch64::find(tcx, name)
|
aarch64::find(name)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
|
|
||||||
use {Intrinsic, Type};
|
use {Intrinsic, Type};
|
||||||
use IntrinsicDef::Named;
|
use IntrinsicDef::Named;
|
||||||
use rustc::ty::TyCtxt;
|
|
||||||
|
|
||||||
// The default inlining settings trigger a pathological behaviour in
|
// The default inlining settings trigger a pathological behaviour in
|
||||||
// LLVM, which causes makes compilation very slow. See #28273.
|
// LLVM, which causes makes compilation very slow. See #28273.
|
||||||
#[inline(never)]
|
#[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 }
|
if !name.starts_with("x86_mm") { return None }
|
||||||
Some(match &name["x86_mm".len()..] {
|
Some(match &name["x86_mm".len()..] {
|
||||||
"_movemask_ps" => Intrinsic {
|
"_movemask_ps" => Intrinsic {
|
||||||
|
@ -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,
|
Some(intr) => intr,
|
||||||
None => unreachable!("unknown intrinsic '{}'", name),
|
None => unreachable!("unknown intrinsic '{}'", name),
|
||||||
};
|
};
|
||||||
|
@ -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) => {
|
Some(intr) => {
|
||||||
// this function is a platform specific intrinsic
|
// this function is a platform specific intrinsic
|
||||||
if i_n_tps != 0 {
|
if i_n_tps != 0 {
|
||||||
|
@ -16,6 +16,7 @@ extern crate rustc;
|
|||||||
extern crate rustc_driver;
|
extern crate rustc_driver;
|
||||||
extern crate rustc_front;
|
extern crate rustc_front;
|
||||||
extern crate rustc_lint;
|
extern crate rustc_lint;
|
||||||
|
extern crate rustc_llvm as llvm;
|
||||||
extern crate rustc_metadata;
|
extern crate rustc_metadata;
|
||||||
extern crate rustc_resolve;
|
extern crate rustc_resolve;
|
||||||
#[macro_use] extern crate syntax;
|
#[macro_use] extern crate syntax;
|
||||||
@ -28,7 +29,6 @@ use std::thread::Builder;
|
|||||||
|
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
use rustc::front::map as ast_map;
|
use rustc::front::map as ast_map;
|
||||||
use rustc::llvm;
|
|
||||||
use rustc::middle::cstore::{CrateStore, LinkagePreference};
|
use rustc::middle::cstore::{CrateStore, LinkagePreference};
|
||||||
use rustc::ty;
|
use rustc::ty;
|
||||||
use rustc::session::config::{self, basic_options, build_configuration, Input, Options};
|
use rustc::session::config::{self, basic_options, build_configuration, Input, Options};
|
||||||
|
Loading…
Reference in New Issue
Block a user