diff --git a/src/Cargo.lock b/src/Cargo.lock index 69c3789f337c6..e2d9b060fca70 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1619,6 +1619,33 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_codegen_llvm" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_back 0.0.0", + "rustc_const_math 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_incremental 0.0.0", + "rustc_llvm 0.0.0", + "rustc_platform_intrinsics 0.0.0", + "rustc_trans_utils 0.0.0", + "serialize 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + [[package]] name = "rustc_const_eval" version = "0.0.0" @@ -1672,6 +1699,7 @@ dependencies = [ "rustc_allocator 0.0.0", "rustc_back 0.0.0", "rustc_borrowck 0.0.0", + "rustc_codegen_llvm 0.0.0", "rustc_const_eval 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -1684,7 +1712,6 @@ dependencies = [ "rustc_privacy 0.0.0", "rustc_resolve 0.0.0", "rustc_save_analysis 0.0.0", - "rustc_trans 0.0.0", "rustc_trans_utils 0.0.0", "rustc_typeck 0.0.0", "serialize 0.0.0", @@ -1859,33 +1886,6 @@ dependencies = [ "syntax_pos 0.0.0", ] -[[package]] -name = "rustc_trans" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_allocator 0.0.0", - "rustc_back 0.0.0", - "rustc_const_math 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_incremental 0.0.0", - "rustc_llvm 0.0.0", - "rustc_platform_intrinsics 0.0.0", - "rustc_trans_utils 0.0.0", - "serialize 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - [[package]] name = "rustc_trans_utils" version = "0.0.0" diff --git a/src/doc/rustc-ux-guidelines.md b/src/doc/rustc-ux-guidelines.md index 323d49e469120..5af52da951c7f 100644 --- a/src/doc/rustc-ux-guidelines.md +++ b/src/doc/rustc-ux-guidelines.md @@ -70,7 +70,7 @@ for details on how to format and write long error codes. [librustc_passes](https://github.com/rust-lang/rust/blob/master/src/librustc_passes/diagnostics.rs), [librustc_privacy](https://github.com/rust-lang/rust/blob/master/src/librustc_privacy/diagnostics.rs), [librustc_resolve](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/diagnostics.rs), - [librustc_trans](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/diagnostics.rs), + [librustc_codegen_llvm](https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/diagnostics.rs), [librustc_plugin](https://github.com/rust-lang/rust/blob/master/src/librustc_plugin/diagnostics.rs), [librustc_typeck](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/diagnostics.rs). * Explanations have full markdown support. Use it, especially to highlight diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 0136273ebc941..478b51031b6d7 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -10,7 +10,7 @@ //! rustc compiler intrinsics. //! -//! The corresponding definitions are in librustc_trans/intrinsic.rs. +//! The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs. //! //! # Volatiles //! diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 0b62e1bd5afbf..abccd7efdfa59 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -32,13 +32,13 @@ syntax_pos = { path = "../libsyntax_pos" } # rlib/dylib pair but all crates.io crates tend to just be rlibs. This means # we've got a problem for dependency graphs that look like: # -# foo - rustc_trans -# / \ -# rustc ---- rustc_driver +# foo - rustc_codegen_llvm +# / \ +# rustc ----- rustc_driver # \ / # foo - rustc_metadata # -# Here the crate `foo` is linked into the `rustc_trans` and the +# Here the crate `foo` is linked into the `rustc_codegen_llvm` and the # `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then # go to link `rustc_driver` the compiler notices this and gives us a compiler # error. @@ -46,7 +46,7 @@ syntax_pos = { path = "../libsyntax_pos" } # To work around this problem we just add these crates.io dependencies to the # `rustc` crate which is a shared dependency above. That way the crate `foo` # shows up in the dylib for the `rustc` crate, deduplicating it and allowing -# crates like `rustc_trans` to use `foo` *through* the `rustc` crate. +# crates like `rustc_codegen_llvm` to use `foo` *through* the `rustc` crate. # # tl;dr; this is not needed to get `rustc` to compile, but if you remove it then # later crate stop compiling. If you can remove this and everything diff --git a/src/librustc/README.md b/src/librustc/README.md index ddf71a06d607c..b3524fcbf9c2a 100644 --- a/src/librustc/README.md +++ b/src/librustc/README.md @@ -26,7 +26,7 @@ The crates of rustc =================== Rustc consists of a number of crates, including `syntax`, -`rustc`, `rustc_back`, `rustc_trans`, `rustc_driver`, and +`rustc`, `rustc_back`, `rustc_codegen_llvm`, `rustc_driver`, and many more. The source for each crate can be found in a directory like `src/libXXX`, where `XXX` is the crate name. @@ -38,23 +38,23 @@ incremental improves that may change.) The dependency structure of these crates is roughly a diamond: ``` - rustc_driver - / | \ - / | \ - / | \ - / v \ -rustc_trans rustc_borrowck ... rustc_metadata - \ | / - \ | / - \ | / - \ v / - rustc - | - v - syntax - / \ - / \ - syntax_pos syntax_ext + rustc_driver + / | \ + / | \ + / | \ + / v \ +rustc_codegen_llvm rustc_borrowck ... rustc_metadata + \ | / + \ | / + \ | / + \ v / + rustc + | + v + syntax + / \ + / \ + syntax_pos syntax_ext ``` The `rustc_driver` crate, at the top of this lattice, is effectively diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 0f8312abc3f9f..a5762332f9b45 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -936,6 +936,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, build_debugging_options, "Z", "debugging", DB_OPTIONS, db_type_desc, dbsetters, + trans: Option = (None, parse_opt_string, [TRACKED], + "the backend to use"), verbose: bool = (false, parse_bool, [UNTRACKED], "in general, enable more debug printouts"), span_free_formats: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 9e566d2b9071f..1854abba10abb 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -84,7 +84,7 @@ pub fn profq_msg(msg: ProfileQueriesMsg) { // Do nothing. // // FIXME(matthewhammer): Multi-threaded translation phase triggers the panic below. - // From backtrace: rustc_trans::back::write::spawn_work::{{closure}}. + // From backtrace: rustc_codegen_llvm::back::write::spawn_work::{{closure}}. // // panic!("no channel on which to send profq_msg: {:?}", msg) } diff --git a/src/librustc_trans/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml similarity index 94% rename from src/librustc_trans/Cargo.toml rename to src/librustc_codegen_llvm/Cargo.toml index 5b7879ea58ee7..be664c21d56c7 100644 --- a/src/librustc_trans/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -1,10 +1,10 @@ [package] authors = ["The Rust Project Developers"] -name = "rustc_trans" +name = "rustc_codegen_llvm" version = "0.0.0" [lib] -name = "rustc_trans" +name = "rustc_codegen_llvm" path = "lib.rs" crate-type = ["dylib"] test = false diff --git a/src/librustc_trans/README.md b/src/librustc_codegen_llvm/README.md similarity index 100% rename from src/librustc_trans/README.md rename to src/librustc_codegen_llvm/README.md diff --git a/src/librustc_trans/abi.rs b/src/librustc_codegen_llvm/abi.rs similarity index 100% rename from src/librustc_trans/abi.rs rename to src/librustc_codegen_llvm/abi.rs diff --git a/src/librustc_trans/adt.rs b/src/librustc_codegen_llvm/adt.rs similarity index 100% rename from src/librustc_trans/adt.rs rename to src/librustc_codegen_llvm/adt.rs diff --git a/src/librustc_trans/allocator.rs b/src/librustc_codegen_llvm/allocator.rs similarity index 100% rename from src/librustc_trans/allocator.rs rename to src/librustc_codegen_llvm/allocator.rs diff --git a/src/librustc_trans/asm.rs b/src/librustc_codegen_llvm/asm.rs similarity index 100% rename from src/librustc_trans/asm.rs rename to src/librustc_codegen_llvm/asm.rs diff --git a/src/librustc_trans/assert_module_sources.rs b/src/librustc_codegen_llvm/assert_module_sources.rs similarity index 100% rename from src/librustc_trans/assert_module_sources.rs rename to src/librustc_codegen_llvm/assert_module_sources.rs diff --git a/src/librustc_trans/attributes.rs b/src/librustc_codegen_llvm/attributes.rs similarity index 100% rename from src/librustc_trans/attributes.rs rename to src/librustc_codegen_llvm/attributes.rs diff --git a/src/librustc_trans/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs similarity index 100% rename from src/librustc_trans/back/archive.rs rename to src/librustc_codegen_llvm/back/archive.rs diff --git a/src/librustc_trans/back/bytecode.rs b/src/librustc_codegen_llvm/back/bytecode.rs similarity index 100% rename from src/librustc_trans/back/bytecode.rs rename to src/librustc_codegen_llvm/back/bytecode.rs diff --git a/src/librustc_trans/back/command.rs b/src/librustc_codegen_llvm/back/command.rs similarity index 100% rename from src/librustc_trans/back/command.rs rename to src/librustc_codegen_llvm/back/command.rs diff --git a/src/librustc_trans/back/link.rs b/src/librustc_codegen_llvm/back/link.rs similarity index 100% rename from src/librustc_trans/back/link.rs rename to src/librustc_codegen_llvm/back/link.rs diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_codegen_llvm/back/linker.rs similarity index 100% rename from src/librustc_trans/back/linker.rs rename to src/librustc_codegen_llvm/back/linker.rs diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs similarity index 100% rename from src/librustc_trans/back/lto.rs rename to src/librustc_codegen_llvm/back/lto.rs diff --git a/src/librustc_trans/back/rpath.rs b/src/librustc_codegen_llvm/back/rpath.rs similarity index 100% rename from src/librustc_trans/back/rpath.rs rename to src/librustc_codegen_llvm/back/rpath.rs diff --git a/src/librustc_trans/back/symbol_export.rs b/src/librustc_codegen_llvm/back/symbol_export.rs similarity index 100% rename from src/librustc_trans/back/symbol_export.rs rename to src/librustc_codegen_llvm/back/symbol_export.rs diff --git a/src/librustc_trans/back/symbol_names.rs b/src/librustc_codegen_llvm/back/symbol_names.rs similarity index 100% rename from src/librustc_trans/back/symbol_names.rs rename to src/librustc_codegen_llvm/back/symbol_names.rs diff --git a/src/librustc_trans/back/write.rs b/src/librustc_codegen_llvm/back/write.rs similarity index 100% rename from src/librustc_trans/back/write.rs rename to src/librustc_codegen_llvm/back/write.rs diff --git a/src/librustc_trans/base.rs b/src/librustc_codegen_llvm/base.rs similarity index 100% rename from src/librustc_trans/base.rs rename to src/librustc_codegen_llvm/base.rs diff --git a/src/librustc_trans/build.rs b/src/librustc_codegen_llvm/build.rs similarity index 100% rename from src/librustc_trans/build.rs rename to src/librustc_codegen_llvm/build.rs diff --git a/src/librustc_trans/builder.rs b/src/librustc_codegen_llvm/builder.rs similarity index 100% rename from src/librustc_trans/builder.rs rename to src/librustc_codegen_llvm/builder.rs diff --git a/src/librustc_trans/cabi_aarch64.rs b/src/librustc_codegen_llvm/cabi_aarch64.rs similarity index 100% rename from src/librustc_trans/cabi_aarch64.rs rename to src/librustc_codegen_llvm/cabi_aarch64.rs diff --git a/src/librustc_trans/cabi_arm.rs b/src/librustc_codegen_llvm/cabi_arm.rs similarity index 100% rename from src/librustc_trans/cabi_arm.rs rename to src/librustc_codegen_llvm/cabi_arm.rs diff --git a/src/librustc_trans/cabi_asmjs.rs b/src/librustc_codegen_llvm/cabi_asmjs.rs similarity index 100% rename from src/librustc_trans/cabi_asmjs.rs rename to src/librustc_codegen_llvm/cabi_asmjs.rs diff --git a/src/librustc_trans/cabi_hexagon.rs b/src/librustc_codegen_llvm/cabi_hexagon.rs similarity index 100% rename from src/librustc_trans/cabi_hexagon.rs rename to src/librustc_codegen_llvm/cabi_hexagon.rs diff --git a/src/librustc_trans/cabi_mips.rs b/src/librustc_codegen_llvm/cabi_mips.rs similarity index 100% rename from src/librustc_trans/cabi_mips.rs rename to src/librustc_codegen_llvm/cabi_mips.rs diff --git a/src/librustc_trans/cabi_mips64.rs b/src/librustc_codegen_llvm/cabi_mips64.rs similarity index 100% rename from src/librustc_trans/cabi_mips64.rs rename to src/librustc_codegen_llvm/cabi_mips64.rs diff --git a/src/librustc_trans/cabi_msp430.rs b/src/librustc_codegen_llvm/cabi_msp430.rs similarity index 100% rename from src/librustc_trans/cabi_msp430.rs rename to src/librustc_codegen_llvm/cabi_msp430.rs diff --git a/src/librustc_trans/cabi_nvptx.rs b/src/librustc_codegen_llvm/cabi_nvptx.rs similarity index 100% rename from src/librustc_trans/cabi_nvptx.rs rename to src/librustc_codegen_llvm/cabi_nvptx.rs diff --git a/src/librustc_trans/cabi_nvptx64.rs b/src/librustc_codegen_llvm/cabi_nvptx64.rs similarity index 100% rename from src/librustc_trans/cabi_nvptx64.rs rename to src/librustc_codegen_llvm/cabi_nvptx64.rs diff --git a/src/librustc_trans/cabi_powerpc.rs b/src/librustc_codegen_llvm/cabi_powerpc.rs similarity index 100% rename from src/librustc_trans/cabi_powerpc.rs rename to src/librustc_codegen_llvm/cabi_powerpc.rs diff --git a/src/librustc_trans/cabi_powerpc64.rs b/src/librustc_codegen_llvm/cabi_powerpc64.rs similarity index 100% rename from src/librustc_trans/cabi_powerpc64.rs rename to src/librustc_codegen_llvm/cabi_powerpc64.rs diff --git a/src/librustc_trans/cabi_s390x.rs b/src/librustc_codegen_llvm/cabi_s390x.rs similarity index 100% rename from src/librustc_trans/cabi_s390x.rs rename to src/librustc_codegen_llvm/cabi_s390x.rs diff --git a/src/librustc_trans/cabi_sparc.rs b/src/librustc_codegen_llvm/cabi_sparc.rs similarity index 100% rename from src/librustc_trans/cabi_sparc.rs rename to src/librustc_codegen_llvm/cabi_sparc.rs diff --git a/src/librustc_trans/cabi_sparc64.rs b/src/librustc_codegen_llvm/cabi_sparc64.rs similarity index 100% rename from src/librustc_trans/cabi_sparc64.rs rename to src/librustc_codegen_llvm/cabi_sparc64.rs diff --git a/src/librustc_trans/cabi_x86.rs b/src/librustc_codegen_llvm/cabi_x86.rs similarity index 100% rename from src/librustc_trans/cabi_x86.rs rename to src/librustc_codegen_llvm/cabi_x86.rs diff --git a/src/librustc_trans/cabi_x86_64.rs b/src/librustc_codegen_llvm/cabi_x86_64.rs similarity index 100% rename from src/librustc_trans/cabi_x86_64.rs rename to src/librustc_codegen_llvm/cabi_x86_64.rs diff --git a/src/librustc_trans/cabi_x86_win64.rs b/src/librustc_codegen_llvm/cabi_x86_win64.rs similarity index 100% rename from src/librustc_trans/cabi_x86_win64.rs rename to src/librustc_codegen_llvm/cabi_x86_win64.rs diff --git a/src/librustc_trans/callee.rs b/src/librustc_codegen_llvm/callee.rs similarity index 100% rename from src/librustc_trans/callee.rs rename to src/librustc_codegen_llvm/callee.rs diff --git a/src/librustc_trans/common.rs b/src/librustc_codegen_llvm/common.rs similarity index 100% rename from src/librustc_trans/common.rs rename to src/librustc_codegen_llvm/common.rs diff --git a/src/librustc_trans/consts.rs b/src/librustc_codegen_llvm/consts.rs similarity index 100% rename from src/librustc_trans/consts.rs rename to src/librustc_codegen_llvm/consts.rs diff --git a/src/librustc_trans/context.rs b/src/librustc_codegen_llvm/context.rs similarity index 100% rename from src/librustc_trans/context.rs rename to src/librustc_codegen_llvm/context.rs diff --git a/src/librustc_trans/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs similarity index 100% rename from src/librustc_trans/debuginfo/create_scope_map.rs rename to src/librustc_codegen_llvm/debuginfo/create_scope_map.rs diff --git a/src/librustc_trans/debuginfo/doc.rs b/src/librustc_codegen_llvm/debuginfo/doc.rs similarity index 100% rename from src/librustc_trans/debuginfo/doc.rs rename to src/librustc_codegen_llvm/debuginfo/doc.rs diff --git a/src/librustc_trans/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs similarity index 100% rename from src/librustc_trans/debuginfo/gdb.rs rename to src/librustc_codegen_llvm/debuginfo/gdb.rs diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs similarity index 100% rename from src/librustc_trans/debuginfo/metadata.rs rename to src/librustc_codegen_llvm/debuginfo/metadata.rs diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs similarity index 100% rename from src/librustc_trans/debuginfo/mod.rs rename to src/librustc_codegen_llvm/debuginfo/mod.rs diff --git a/src/librustc_trans/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs similarity index 100% rename from src/librustc_trans/debuginfo/namespace.rs rename to src/librustc_codegen_llvm/debuginfo/namespace.rs diff --git a/src/librustc_trans/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs similarity index 100% rename from src/librustc_trans/debuginfo/source_loc.rs rename to src/librustc_codegen_llvm/debuginfo/source_loc.rs diff --git a/src/librustc_trans/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs similarity index 100% rename from src/librustc_trans/debuginfo/type_names.rs rename to src/librustc_codegen_llvm/debuginfo/type_names.rs diff --git a/src/librustc_trans/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs similarity index 100% rename from src/librustc_trans/debuginfo/utils.rs rename to src/librustc_codegen_llvm/debuginfo/utils.rs diff --git a/src/librustc_trans/declare.rs b/src/librustc_codegen_llvm/declare.rs similarity index 100% rename from src/librustc_trans/declare.rs rename to src/librustc_codegen_llvm/declare.rs diff --git a/src/librustc_trans/diagnostics.rs b/src/librustc_codegen_llvm/diagnostics.rs similarity index 100% rename from src/librustc_trans/diagnostics.rs rename to src/librustc_codegen_llvm/diagnostics.rs diff --git a/src/librustc_trans/glue.rs b/src/librustc_codegen_llvm/glue.rs similarity index 100% rename from src/librustc_trans/glue.rs rename to src/librustc_codegen_llvm/glue.rs diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs similarity index 99% rename from src/librustc_trans/intrinsic.rs rename to src/librustc_codegen_llvm/intrinsic.rs index e80239175681e..f54735273177d 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -85,7 +85,7 @@ fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option { /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs, /// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics, -/// add them to librustc_trans/trans/context.rs +/// add them to librustc_codegen_llvm/trans/context.rs pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, callee_ty: Ty<'tcx>, fn_ty: &FnType, diff --git a/src/librustc_trans/lib.rs b/src/librustc_codegen_llvm/lib.rs similarity index 99% rename from src/librustc_trans/lib.rs rename to src/librustc_codegen_llvm/lib.rs index c0460fb4852e9..111540b703e9b 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -329,7 +329,7 @@ pub struct CrateInfo { used_crates_dynamic: Vec<(CrateNum, LibSource)>, } -__build_diagnostic_array! { librustc_trans, DIAGNOSTICS } +__build_diagnostic_array! { librustc_codegen_llvm, DIAGNOSTICS } pub fn provide_local(providers: &mut Providers) { back::symbol_names::provide(providers); diff --git a/src/librustc_trans/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs similarity index 98% rename from src/librustc_trans/llvm_util.rs rename to src/librustc_codegen_llvm/llvm_util.rs index 4fe726364f227..bfae72850fec9 100644 --- a/src/librustc_trans/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -126,7 +126,7 @@ pub fn print(req: PrintRequest, sess: &Session) { match req { PrintRequest::TargetCPUs => llvm::LLVMRustPrintTargetCPUs(tm), PrintRequest::TargetFeatures => llvm::LLVMRustPrintTargetFeatures(tm), - _ => bug!("rustc_trans can't handle print request: {:?}", req), + _ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req), } } } diff --git a/src/librustc_trans/machine.rs b/src/librustc_codegen_llvm/machine.rs similarity index 100% rename from src/librustc_trans/machine.rs rename to src/librustc_codegen_llvm/machine.rs diff --git a/src/librustc_trans/metadata.rs b/src/librustc_codegen_llvm/metadata.rs similarity index 100% rename from src/librustc_trans/metadata.rs rename to src/librustc_codegen_llvm/metadata.rs diff --git a/src/librustc_trans/meth.rs b/src/librustc_codegen_llvm/meth.rs similarity index 100% rename from src/librustc_trans/meth.rs rename to src/librustc_codegen_llvm/meth.rs diff --git a/src/librustc_trans/mir/analyze.rs b/src/librustc_codegen_llvm/mir/analyze.rs similarity index 100% rename from src/librustc_trans/mir/analyze.rs rename to src/librustc_codegen_llvm/mir/analyze.rs diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs similarity index 100% rename from src/librustc_trans/mir/block.rs rename to src/librustc_codegen_llvm/mir/block.rs diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs similarity index 100% rename from src/librustc_trans/mir/constant.rs rename to src/librustc_codegen_llvm/mir/constant.rs diff --git a/src/librustc_trans/mir/lvalue.rs b/src/librustc_codegen_llvm/mir/lvalue.rs similarity index 100% rename from src/librustc_trans/mir/lvalue.rs rename to src/librustc_codegen_llvm/mir/lvalue.rs diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs similarity index 100% rename from src/librustc_trans/mir/mod.rs rename to src/librustc_codegen_llvm/mir/mod.rs diff --git a/src/librustc_trans/mir/operand.rs b/src/librustc_codegen_llvm/mir/operand.rs similarity index 100% rename from src/librustc_trans/mir/operand.rs rename to src/librustc_codegen_llvm/mir/operand.rs diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs similarity index 100% rename from src/librustc_trans/mir/rvalue.rs rename to src/librustc_codegen_llvm/mir/rvalue.rs diff --git a/src/librustc_trans/mir/statement.rs b/src/librustc_codegen_llvm/mir/statement.rs similarity index 100% rename from src/librustc_trans/mir/statement.rs rename to src/librustc_codegen_llvm/mir/statement.rs diff --git a/src/librustc_trans/partitioning.rs b/src/librustc_codegen_llvm/partitioning.rs similarity index 100% rename from src/librustc_trans/partitioning.rs rename to src/librustc_codegen_llvm/partitioning.rs diff --git a/src/librustc_trans/symbol_names_test.rs b/src/librustc_codegen_llvm/symbol_names_test.rs similarity index 100% rename from src/librustc_trans/symbol_names_test.rs rename to src/librustc_codegen_llvm/symbol_names_test.rs diff --git a/src/librustc_trans/time_graph.rs b/src/librustc_codegen_llvm/time_graph.rs similarity index 100% rename from src/librustc_trans/time_graph.rs rename to src/librustc_codegen_llvm/time_graph.rs diff --git a/src/librustc_trans/trans_item.rs b/src/librustc_codegen_llvm/trans_item.rs similarity index 100% rename from src/librustc_trans/trans_item.rs rename to src/librustc_codegen_llvm/trans_item.rs diff --git a/src/librustc_trans/tvec.rs b/src/librustc_codegen_llvm/tvec.rs similarity index 100% rename from src/librustc_trans/tvec.rs rename to src/librustc_codegen_llvm/tvec.rs diff --git a/src/librustc_trans/type_.rs b/src/librustc_codegen_llvm/type_.rs similarity index 100% rename from src/librustc_trans/type_.rs rename to src/librustc_codegen_llvm/type_.rs diff --git a/src/librustc_trans/type_of.rs b/src/librustc_codegen_llvm/type_of.rs similarity index 100% rename from src/librustc_trans/type_of.rs rename to src/librustc_codegen_llvm/type_of.rs diff --git a/src/librustc_trans/value.rs b/src/librustc_codegen_llvm/value.rs similarity index 100% rename from src/librustc_trans/value.rs rename to src/librustc_codegen_llvm/value.rs diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index d6155f53485e3..f35e77958bdee 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -30,7 +30,7 @@ rustc_plugin = { path = "../librustc_plugin" } rustc_privacy = { path = "../librustc_privacy" } rustc_resolve = { path = "../librustc_resolve" } rustc_save_analysis = { path = "../librustc_save_analysis" } -rustc_trans = { path = "../librustc_trans", optional = true } +rustc_codegen_llvm = { path = "../librustc_codegen_llvm", optional = true } rustc_trans_utils = { path = "../librustc_trans_utils" } rustc_typeck = { path = "../librustc_typeck" } serialize = { path = "../libserialize" } @@ -41,4 +41,4 @@ syntax_pos = { path = "../libsyntax_pos" } ar = "0.3.0" [features] -llvm = ["rustc_trans"] +llvm = ["rustc_codegen_llvm"] diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index cd3740f72e0f4..4a37d3e16edb1 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -32,7 +32,6 @@ use rustc_incremental; use rustc_resolve::{MakeGlobMap, Resolver}; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; -use rustc_trans as trans; use rustc_trans_utils::trans_crate::TransCrate; use rustc_typeck as typeck; use rustc_privacy; @@ -41,7 +40,6 @@ use rustc_plugin as plugin; use rustc_passes::{self, ast_validation, no_asm, loops, consts, static_recursion, hir_stats}; use rustc_const_eval::{self, check_match}; use super::Compilation; -use ::DefaultTransCrate; use serialize::json; @@ -67,7 +65,7 @@ use derive_registrar; use profile; -pub fn compile_input(sess: &Session, +pub fn compile_input(sess: &Session, cstore: &CStore, input: &Input, outdir: &Option, @@ -207,7 +205,7 @@ pub fn compile_input(sess: &Session, None }; - phase_3_run_analysis_passes(sess, + phase_3_run_analysis_passes::(sess, cstore, hir_map, analysis, @@ -244,7 +242,7 @@ pub fn compile_input(sess: &Session, tcx.print_debug_stats(); } - let trans = phase_4_translate_to_llvm::(tcx, rx); + let trans = phase_4_translate_to_llvm::(tcx, rx); if log_enabled!(::log::LogLevel::Info) { println!("Post-trans"); @@ -267,18 +265,19 @@ pub fn compile_input(sess: &Session, } let (phase5_result, trans) = - phase_5_run_llvm_passes::(sess, &dep_graph, trans); + phase_5_run_llvm_passes::(sess, &dep_graph, trans); - controller_entry_point!(after_llvm, - sess, - CompileState::state_after_llvm(input, sess, outdir, output, &trans), - phase5_result); phase5_result?; + if !sess.opts.output_types.keys().any(|&i| i == OutputType::Exe || + i == OutputType::Metadata) { + return Ok(()); + } + // Run the linker on any artifacts that resulted from the LLVM run. // This should produce either a finished executable or library. time(sess.time_passes(), "linking", || { - DefaultTransCrate::link_binary(sess, &trans, &outputs) + Trans::link_binary(sess, &trans, &outputs) }); // Now that we won't touch anything in the incremental compilation directory @@ -338,7 +337,6 @@ pub struct CompileController<'a> { pub after_expand: PhaseController<'a>, pub after_hir_lowering: PhaseController<'a>, pub after_analysis: PhaseController<'a>, - pub after_llvm: PhaseController<'a>, pub compilation_done: PhaseController<'a>, // FIXME we probably want to group the below options together and offer a @@ -357,7 +355,6 @@ impl<'a> CompileController<'a> { after_expand: PhaseController::basic(), after_hir_lowering: PhaseController::basic(), after_analysis: PhaseController::basic(), - after_llvm: PhaseController::basic(), compilation_done: PhaseController::basic(), make_glob_map: MakeGlobMap::No, keep_ast: false, @@ -405,7 +402,6 @@ pub struct CompileState<'a, 'tcx: 'a> { pub resolutions: Option<&'a Resolutions>, pub analysis: Option<&'a ty::CrateAnalysis>, pub tcx: Option>, - pub trans: Option<&'a trans::CrateTranslation>, } impl<'a, 'tcx> CompileState<'a, 'tcx> { @@ -431,7 +427,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { resolutions: None, analysis: None, tcx: None, - trans: None, } } @@ -521,19 +516,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { } } - fn state_after_llvm(input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - trans: &'a trans::CrateTranslation) - -> Self { - CompileState { - trans: Some(trans), - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } - fn state_when_compilation_done(input: &'a Input, session: &'tcx Session, out_dir: &'a Option, @@ -910,7 +892,7 @@ pub fn phase_2_configure_and_expand(sess: &Session, /// Run the resolution, typechecking, region checking and other /// miscellaneous analysis passes on the crate. Return various /// structures carrying the results of the analysis. -pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, +pub fn phase_3_run_analysis_passes<'tcx, Trans: TransCrate, F, R>(sess: &'tcx Session, cstore: &'tcx CrateStore, hir_map: hir_map::Map<'tcx>, mut analysis: ty::CrateAnalysis, @@ -966,7 +948,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, mir::provide(&mut local_providers); reachable::provide(&mut local_providers); rustc_privacy::provide(&mut local_providers); - DefaultTransCrate::provide_local(&mut local_providers); + Trans::provide_local(&mut local_providers); typeck::provide(&mut local_providers); ty::provide(&mut local_providers); traits::provide(&mut local_providers); @@ -979,7 +961,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, let mut extern_providers = ty::maps::Providers::default(); cstore::provide(&mut extern_providers); - DefaultTransCrate::provide_extern(&mut extern_providers); + Trans::provide_extern(&mut extern_providers); ty::provide_extern(&mut extern_providers); traits::provide_extern(&mut extern_providers); // FIXME(eddyb) get rid of this once we replace const_eval with miri. diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index fc503f4eb4be1..84da4bb141886 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -48,7 +48,7 @@ extern crate rustc_mir; extern crate rustc_resolve; extern crate rustc_save_analysis; #[cfg(feature="llvm")] -extern crate rustc_trans; +extern crate rustc_codegen_llvm; extern crate rustc_trans_utils; extern crate rustc_typeck; extern crate serialize; @@ -66,7 +66,7 @@ use rustc_save_analysis as save; use rustc_save_analysis::DumpHandler; use rustc::session::{self, config, Session, build_session, CompileResult}; use rustc::session::CompileIncomplete; -use rustc::session::config::{Input, PrintRequest, OutputType, ErrorOutputType}; +use rustc::session::config::{Input, PrintRequest, ErrorOutputType}; use rustc::session::config::nightly_options; use rustc::session::{early_error, early_warn}; use rustc::lint::Lint; @@ -156,10 +156,10 @@ pub fn run(run_compiler: F) -> isize #[cfg(not(feature="llvm"))] pub use rustc_trans_utils::trans_crate::MetadataOnlyTransCrate as DefaultTransCrate; #[cfg(feature="llvm")] -pub use rustc_trans::LlvmTransCrate as DefaultTransCrate; +pub use rustc_codegen_llvm::LlvmTransCrate as DefaultTransCrate; #[cfg(not(feature="llvm"))] -mod rustc_trans { +mod rustc_codegen_llvm { use syntax_pos::symbol::Symbol; use rustc::session::Session; use rustc::session::config::PrintRequest; @@ -205,7 +205,7 @@ pub fn run_compiler<'a>(args: &[String], let (sopts, cfg) = config::build_session_options_and_crate_config(&matches); if sopts.debugging_opts.debug_llvm { - rustc_trans::enable_llvm_debug(); + rustc_codegen_llvm::enable_llvm_debug(); } let descriptions = diagnostics_registry(); @@ -226,37 +226,65 @@ pub fn run_compiler<'a>(args: &[String], }, }; - let cstore = Rc::new(CStore::new(DefaultTransCrate::metadata_loader())); - let loader = file_loader.unwrap_or(box RealFileLoader); let codemap = Rc::new(CodeMap::with_file_loader(loader, sopts.file_path_mapping())); let mut sess = session::build_session_with_codemap( sopts, input_file_path, descriptions, codemap, emitter_dest, ); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, cfg); target_features::add_configuration(&mut cfg, &sess); sess.parse_sess.config = cfg; - do_or_return!(callbacks.late_callback(&matches, - &sess, - &*cstore, - &input, - &odir, - &ofile), Some(sess)); - let plugins = sess.opts.debugging_opts.extra_plugins.clone(); let control = callbacks.build_controller(&sess, &matches); - (driver::compile_input(&sess, - &cstore, - &input, - &odir, - &ofile, - Some(plugins), - &control), - Some(sess)) + + let trans_name = sess.opts.debugging_opts.trans.clone(); + match trans_name.as_ref().map(|s|&**s) { + None => { + let cstore = Rc::new(CStore::new(DefaultTransCrate::metadata_loader())); + + do_or_return!(callbacks.late_callback(&matches, + &sess, + &*cstore, + &input, + &odir, + &ofile), Some(sess)); + + (driver::compile_input::(&sess, + &cstore, + &input, + &odir, + &ofile, + Some(plugins), + &control), + Some(sess)) + } + Some("llvm") => { + let cstore = Rc::new( + CStore::new(rustc_codegen_llvm::LlvmTransCrate::metadata_loader()) + ); + + do_or_return!(callbacks.late_callback(&matches, + &sess, + &*cstore, + &input, + &odir, + &ofile), Some(sess)); + + (driver::compile_input::(&sess, + &cstore, + &input, + &odir, + &ofile, + Some(plugins), + &control), + Some(sess)) + } + Some(trans_name) => sess.fatal(&format!("Invalid trans {}", trans_name)), + } } // Extract output directory and file from matches. @@ -520,7 +548,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { let mut sess = build_session(sopts.clone(), None, descriptions.clone()); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, cfg.clone()); target_features::add_configuration(&mut cfg, &sess); @@ -609,11 +637,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { control.after_hir_lowering.stop = Compilation::Stop; } - if !sess.opts.output_types.keys().any(|&i| i == OutputType::Exe || - i == OutputType::Metadata) { - control.after_llvm.stop = Compilation::Stop; - } - if save_analysis(sess) { enable_save_analysis(&mut control); } @@ -785,20 +808,20 @@ impl RustcDefaultCalls { } PrintRequest::RelocationModels => { println!("Available relocation models:"); - for &(name, _) in rustc_trans::back::write::RELOC_MODEL_ARGS.iter() { + for &(name, _) in rustc_codegen_llvm::back::write::RELOC_MODEL_ARGS.iter() { println!(" {}", name); } println!(""); } PrintRequest::CodeModels => { println!("Available code models:"); - for &(name, _) in rustc_trans::back::write::CODE_GEN_MODEL_ARGS.iter(){ + for &(name, _) in rustc_codegen_llvm::back::write::CODE_GEN_MODEL_ARGS.iter(){ println!(" {}", name); } println!(""); } PrintRequest::TargetCPUs | PrintRequest::TargetFeatures => { - rustc_trans::print(*req, sess); + rustc_codegen_llvm::print(*req, sess); } PrintRequest::NativeStaticLibs => { println!("Native static libs can be printed only during linking"); @@ -840,7 +863,7 @@ pub fn version(binary: &str, matches: &getopts::Matches) { println!("commit-date: {}", unw(commit_date_str())); println!("host: {}", config::host_triple()); println!("release: {}", unw(release_str())); - rustc_trans::print_version(); + rustc_codegen_llvm::print_version(); } } @@ -1137,7 +1160,7 @@ pub fn handle_options(args: &[String]) -> Option { } if cg_flags.contains(&"passes=list".to_string()) { - rustc_trans::print_passes(); + rustc_codegen_llvm::print_passes(); return None; } @@ -1266,7 +1289,7 @@ pub fn diagnostics_registry() -> errors::registry::Registry { all_errors.extend_from_slice(&rustc_resolve::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); #[cfg(feature="llvm")] - all_errors.extend_from_slice(&rustc_trans::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_codegen_llvm::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_const_eval::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_passes::DIAGNOSTICS); diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index e6d89f77f2163..11ad0702e500e 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -227,7 +227,7 @@ impl PpSourceMode { f(&annotation, hir_map.forest.krate()) } PpmTyped => { - abort_on_err(driver::phase_3_run_analysis_passes(sess, + abort_on_err(driver::phase_3_run_analysis_passes::<::DefaultTransCrate, _, _>(sess, cstore, hir_map.clone(), analysis.clone(), @@ -1036,7 +1036,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let mut out = Vec::new(); - abort_on_err(driver::phase_3_run_analysis_passes(sess, + abort_on_err(driver::phase_3_run_analysis_passes::<::DefaultTransCrate, _, _>(sess, cstore, hir_map.clone(), analysis.clone(), diff --git a/src/librustc_driver/target_features.rs b/src/librustc_driver/target_features.rs index 96264472b5f8e..8a5e25f25686d 100644 --- a/src/librustc_driver/target_features.rs +++ b/src/librustc_driver/target_features.rs @@ -11,7 +11,6 @@ use syntax::ast; use rustc::session::Session; use syntax::symbol::Symbol; -use rustc_trans; /// Add `target_feature = "..."` cfgs for a variety of platform /// specific features (SSE, NEON etc.). @@ -21,7 +20,7 @@ use rustc_trans; pub fn add_configuration(cfg: &mut ast::CrateConfig, sess: &Session) { let tf = Symbol::intern("target_feature"); - for feat in rustc_trans::target_features(sess) { + for feat in ::rustc_codegen_llvm::target_features(sess) { cfg.insert((tf, Some(feat))); } diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 6de36820f0c19..52526c94b3a35 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -16,7 +16,7 @@ use std::sync::mpsc; use driver; use rustc_lint; use rustc_resolve::MakeGlobMap; -use rustc_trans; +use rustc_codegen_llvm; use rustc::middle::free_region::FreeRegionMap; use rustc::middle::region; use rustc::middle::resolve_lifetime; @@ -111,7 +111,7 @@ fn test_env(source_string: &str, None, diagnostic_handler, Rc::new(CodeMap::new(FilePathMapping::empty()))); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let input = config::Input::Str { name: driver::anon_src(), diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 3861a358b23e0..44a901b5775d1 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -72,7 +72,7 @@ fn equate_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, require_same_types(tcx, &cause, tcx.mk_fn_ptr(tcx.fn_sig(def_id)), fty); } -/// Remember to add all intrinsics here, in librustc_trans/trans/intrinsic.rs, +/// Remember to add all intrinsics here, in librustc_codegen_llvm/trans/intrinsic.rs, /// and in libcore/intrinsics.rs pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &hir::ForeignItem) { diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 594cd0878cbfb..c6544bbc80549 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1224,7 +1224,7 @@ extern "rust-intrinsic" { ``` Please check you didn't make a mistake in the function's name. All intrinsic -functions are defined in librustc_trans/trans/intrinsic.rs and in +functions are defined in librustc_codegen_llvm/trans/intrinsic.rs and in libcore/intrinsics.rs in the Rust source code. Example: ``` @@ -1254,7 +1254,7 @@ fn main() { ``` Please check you didn't make a mistake in the function's name. All intrinsic -functions are defined in librustc_trans/trans/intrinsic.rs and in +functions are defined in librustc_codegen_llvm/trans/intrinsic.rs and in libcore/intrinsics.rs in the Rust source code. Example: ``` diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 2ecb7b546fce2..d7e7c255b36f6 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -19,8 +19,8 @@ use rustc::ty::{self, TyCtxt, GlobalArenas}; use rustc::hir::map as hir_map; use rustc::lint; use rustc::util::nodemap::FxHashMap; -use rustc_trans; -use rustc_trans::back::link; +use rustc_codegen_llvm; +use rustc_codegen_llvm::back::link; use rustc_resolve as resolve; use rustc_metadata::cstore::CStore; @@ -143,11 +143,11 @@ pub fn run_core(search_paths: SearchPaths, false, Some(codemap.clone())); - let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader)); + let cstore = Rc::new(CStore::new(box rustc_codegen_llvm::LlvmMetadataLoader)); let mut sess = session::build_session_( sessopts, cpath, diagnostic_handler, codemap, ); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs)); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 20da99a6b1376..fd4316944e05f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -33,7 +33,7 @@ extern crate libc; extern crate rustc; extern crate rustc_data_structures; extern crate rustc_const_math; -extern crate rustc_trans; +extern crate rustc_codegen_llvm; extern crate rustc_driver; extern crate rustc_resolve; extern crate rustc_lint; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 9316805b9322a..c5cd89e42ac95 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -34,8 +34,8 @@ use rustc_driver::driver::phase_2_configure_and_expand; use rustc_driver::pretty::ReplaceBodyWithLoop; use rustc_metadata::cstore::CStore; use rustc_resolve::MakeGlobMap; -use rustc_trans; -use rustc_trans::back::link; +use rustc_codegen_llvm; +use rustc_codegen_llvm::back::link; use syntax::ast; use syntax::codemap::CodeMap; use syntax::feature_gate::UnstableFeatures; @@ -83,11 +83,11 @@ pub fn run(input: &str, let handler = errors::Handler::with_tty_emitter(ColorConfig::Auto, true, false, Some(codemap.clone())); - let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader)); + let cstore = Rc::new(CStore::new(box rustc_codegen_llvm::LlvmMetadataLoader)); let mut sess = session::build_session_( sessopts, Some(input_path.clone()), handler, codemap.clone(), ); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); sess.parse_sess.config = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); @@ -246,11 +246,11 @@ fn run_test(test: &str, cratename: &str, filename: &str, cfgs: Vec, libs // Compile the code let diagnostic_handler = errors::Handler::with_emitter(true, false, box emitter); - let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader)); + let cstore = Rc::new(CStore::new(box rustc_codegen_llvm::LlvmMetadataLoader)); let mut sess = session::build_session_( sessopts, None, diagnostic_handler, codemap, ); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let outdir = Mutex::new(TempDir::new("rustdoctest").ok().expect("rustdoc needs a tempdir")); diff --git a/src/test/run-make/issue-19371/foo.rs b/src/test/run-make/issue-19371/foo.rs index 4db027aaeef71..2e9adb63fd711 100644 --- a/src/test/run-make/issue-19371/foo.rs +++ b/src/test/run-make/issue-19371/foo.rs @@ -15,7 +15,7 @@ extern crate rustc_driver; extern crate rustc_lint; extern crate rustc_metadata; extern crate rustc_errors; -extern crate rustc_trans; +extern crate rustc_codegen_llvm; extern crate syntax; use rustc::session::{build_session, Session}; @@ -60,9 +60,9 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc) { } let descriptions = Registry::new(&rustc::DIAGNOSTICS); - let cstore = Rc::new(CStore::new(Box::new(rustc_trans::LlvmMetadataLoader))); + let cstore = Rc::new(CStore::new(Box::new(rustc_codegen_llvm::LlvmMetadataLoader))); let sess = build_session(opts, None, descriptions); - rustc_trans::init(&sess); + rustc_codegen_llvm::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); (sess, cstore) } diff --git a/src/test/run-make/llvm-pass/plugin.rs b/src/test/run-make/llvm-pass/plugin.rs index 37aab2bbd059a..acefdc7f502ad 100644 --- a/src/test/run-make/llvm-pass/plugin.rs +++ b/src/test/run-make/llvm-pass/plugin.rs @@ -14,7 +14,7 @@ extern crate rustc; extern crate rustc_plugin; -extern crate rustc_trans; +extern crate rustc_codegen_llvm; #[link(name = "llvm-function-pass", kind = "static")] #[link(name = "llvm-module-pass", kind = "static")] diff --git a/src/test/run-make/llvm-phase/test.rs b/src/test/run-make/llvm-phase/test.rs index 2ff4593a801fe..e7ed5fe9ddb38 100644 --- a/src/test/run-make/llvm-phase/test.rs +++ b/src/test/run-make/llvm-phase/test.rs @@ -13,13 +13,13 @@ extern crate rustc; extern crate rustc_driver; extern crate rustc_llvm; -extern crate rustc_trans; +extern crate rustc_codegen_llvm; #[macro_use] extern crate syntax; extern crate getopts; use rustc_driver::{CompilerCalls, Compilation}; use rustc_driver::driver::CompileController; -use rustc_trans::ModuleSource; +use rustc_codegen_llvm::ModuleSource; use rustc::session::Session; use syntax::codemap::FileLoader; use std::env;