diff --git a/src/Cargo.lock b/src/Cargo.lock index 76ca287b815..00cc530e632 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1896,6 +1896,52 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_codegen_llvm" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_apfloat 0.0.0", + "rustc_codegen_utils 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_mir 0.0.0", + "rustc_platform_intrinsics 0.0.0", + "rustc_target 0.0.0", + "serialize 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", + "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_codegen_utils" +version = "0.0.0" +dependencies = [ + "ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_incremental 0.0.0", + "rustc_mir 0.0.0", + "rustc_target 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + [[package]] name = "rustc_cratesio_shim" version = "0.0.0" @@ -1932,6 +1978,7 @@ dependencies = [ "rustc-rayon 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", "rustc_borrowck 0.0.0", + "rustc_codegen_utils 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_incremental 0.0.0", @@ -1945,7 +1992,6 @@ dependencies = [ "rustc_save_analysis 0.0.0", "rustc_target 0.0.0", "rustc_traits 0.0.0", - "rustc_trans_utils 0.0.0", "rustc_typeck 0.0.0", "scoped-tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", @@ -2155,52 +2201,6 @@ dependencies = [ "syntax_pos 0.0.0", ] -[[package]] -name = "rustc_trans" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_allocator 0.0.0", - "rustc_apfloat 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_mir 0.0.0", - "rustc_platform_intrinsics 0.0.0", - "rustc_target 0.0.0", - "rustc_trans_utils 0.0.0", - "serialize 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_trans_utils" -version = "0.0.0" -dependencies = [ - "ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_incremental 0.0.0", - "rustc_mir 0.0.0", - "rustc_target 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - [[package]] name = "rustc_tsan" version = "0.0.0" diff --git a/src/Cargo.toml b/src/Cargo.toml index 35858ee2868..1518e8d910f 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -4,7 +4,7 @@ members = [ "rustc", "libstd", "libtest", - "librustc_trans", + "librustc_codegen_llvm", "tools/cargotest", "tools/clippy", "tools/compiletest", diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e5824010ef2..cc1e66332a3 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -844,7 +844,7 @@ impl<'a> Builder<'a> { // default via `-ldylib=winapi_foo`. That is, they're linked with the // `dylib` type with a `winapi_` prefix (so the winapi ones don't // conflict with the system MinGW ones). This consequently means that - // the binaries we ship of things like rustc_trans (aka the rustc_trans + // the binaries we ship of things like rustc_codegen_llvm (aka the rustc_codegen_llvm // DLL) when linked against *again*, for example with procedural macros // or plugins, will trigger the propagation logic of `-ldylib`, passing // `-lwinapi_foo` to the linker again. This isn't actually available in diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 64354ae29aa..a516af58b1e 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -118,7 +118,7 @@ impl Step for CodegenBackend { const DEFAULT: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.all_krates("rustc_trans") + run.all_krates("rustc_codegen_llvm") } fn make_run(run: RunConfig) { @@ -139,12 +139,12 @@ impl Step for CodegenBackend { let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check"); let features = builder.rustc_features().to_string(); - cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_trans/Cargo.toml")); + cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); rustc_cargo_env(builder, &mut cargo); // We won't build LLVM if it's not available, as it shouldn't affect `check`. - let _folder = builder.fold_output(|| format!("stage{}-rustc_trans", compiler.stage)); + let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); run_cargo(builder, cargo.arg("--features").arg(features), &codegen_backend_stamp(builder, compiler, target, backend), @@ -259,14 +259,14 @@ pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned, backend: Interned) -> PathBuf { builder.cargo_out(compiler, Mode::Librustc, target) - .join(format!(".librustc_trans-{}-check.stamp", backend)) + .join(format!(".librustc_codegen_llvm-{}-check.stamp", backend)) } /// Cargo's output path for rustdoc in a given stage, compiled by a particular diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 1248c2b50be..8e0227f8fe1 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -603,7 +603,7 @@ impl Step for CodegenBackend { const DEFAULT: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.all_krates("rustc_trans") + run.all_krates("rustc_codegen_llvm") } fn make_run(run: RunConfig) { @@ -637,7 +637,7 @@ impl Step for CodegenBackend { let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build"); let mut features = builder.rustc_features().to_string(); cargo.arg("--manifest-path") - .arg(builder.src.join("src/librustc_trans/Cargo.toml")); + .arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); rustc_cargo_env(builder, &mut cargo); features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend); @@ -645,7 +645,7 @@ impl Step for CodegenBackend { let tmp_stamp = builder.cargo_out(compiler, Mode::Librustc, target) .join(".tmp.stamp"); - let _folder = builder.fold_output(|| format!("stage{}-rustc_trans", compiler.stage)); + let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); let files = run_cargo(builder, cargo.arg("--features").arg(features), &tmp_stamp, @@ -656,7 +656,7 @@ impl Step for CodegenBackend { let mut files = files.into_iter() .filter(|f| { let filename = f.file_name().unwrap().to_str().unwrap(); - is_dylib(filename) && filename.contains("rustc_trans-") + is_dylib(filename) && filename.contains("rustc_codegen_llvm-") }); let codegen_backend = match files.next() { Some(f) => f, @@ -697,7 +697,7 @@ pub fn build_codegen_backend(builder: &Builder, compiler.stage, &compiler.host, target, backend)); // Pass down configuration from the LLVM build into the build of - // librustc_llvm and librustc_trans. + // librustc_llvm and librustc_codegen_llvm. if builder.is_rust_llvm(target) { cargo.env("LLVM_RUSTLLVM", "1"); } @@ -762,7 +762,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder, t!(t!(File::open(&stamp)).read_to_string(&mut dylib)); let file = Path::new(&dylib); let filename = file.file_name().unwrap().to_str().unwrap(); - // change `librustc_trans-xxxxxx.so` to `librustc_trans-llvm.so` + // change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so` let target_filename = { let dash = filename.find("-").unwrap(); let dot = filename.find(".").unwrap(); @@ -808,14 +808,14 @@ pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned, backend: Interned) -> PathBuf { builder.cargo_out(compiler, Mode::Librustc, target) - .join(format!(".librustc_trans-{}.stamp", backend)) + .join(format!(".librustc_codegen_llvm-{}.stamp", backend)) } pub fn compiler_file(builder: &Builder, diff --git a/src/doc/rustc-ux-guidelines.md b/src/doc/rustc-ux-guidelines.md index b62762ef69e..93e94e55863 100644 --- a/src/doc/rustc-ux-guidelines.md +++ b/src/doc/rustc-ux-guidelines.md @@ -69,7 +69,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/liballoc/alloc.rs b/src/liballoc/alloc.rs index f59c9f7fd61..09d16b26520 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -134,7 +134,7 @@ unsafe impl Alloc for Global { } /// The allocator for unique pointers. -// This function must not unwind. If it does, MIR trans will fail. +// This function must not unwind. If it does, MIR codegen will fail. #[cfg(not(test))] #[lang = "exchange_malloc"] #[inline] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 7d3e7af1a18..5ec6cb6c710 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 af108188ce0..8f9a8bd5c01 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -35,13 +35,13 @@ byteorder = { version = "1.1", features = ["i128"]} # 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 +# 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. @@ -49,7 +49,7 @@ byteorder = { version = "1.1", features = ["i128"]} # 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/cfg/construct.rs b/src/librustc/cfg/construct.rs index 7e03288f572..20e4b1343c1 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -452,13 +452,13 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { // The CFG for match expression is quite complex, so no ASCII // art for it (yet). // - // The CFG generated below matches roughly what trans puts - // out. Each pattern and guard is visited in parallel, with + // The CFG generated below matches roughly what MIR contains. + // Each pattern and guard is visited in parallel, with // arms containing multiple patterns generating multiple nodes // for the same guard expression. The guard expressions chain // into each other from top to bottom, with a specific // exception to allow some additional valid programs - // (explained below). Trans differs slightly in that the + // (explained below). MIR differs slightly in that the // pattern matching may continue after a guard but the visible // behaviour should be the same. // diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 4847a7f4ddb..9cd9d44874b 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -565,7 +565,7 @@ define_dep_nodes!( <'tcx> [] IsUnreachableLocalDefinition(DefId), [] IsMirAvailable(DefId), [] ItemAttrs(DefId), - [] TransFnAttrs(DefId), + [] CodegenFnAttrs(DefId), [] FnArgNames(DefId), [] RenderedConst(DefId), [] DylibDepFormats(CrateNum), @@ -637,8 +637,8 @@ define_dep_nodes!( <'tcx> [eval_always] AllTraits, [input] AllCrateNums, [] ExportedSymbols(CrateNum), - [eval_always] CollectAndPartitionTranslationItems, - [] IsTranslatedItem(DefId), + [eval_always] CollectAndPartitionMonoItems, + [] IsCodegenedItem(DefId), [] CodegenUnit(InternedString), [] CompileCodegenUnit(InternedString), [input] OutputFilenames, diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 797332e699d..26470ddc82a 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -856,10 +856,10 @@ impl DepGraph { /// each partition. In the first run, we create partitions based on /// the symbols that need to be compiled. For each partition P, we /// hash the symbols in P and create a `WorkProduct` record associated -/// with `DepNode::TransPartition(P)`; the hash is the set of symbols +/// with `DepNode::CodegenUnit(P)`; the hash is the set of symbols /// in P. /// -/// The next time we compile, if the `DepNode::TransPartition(P)` is +/// The next time we compile, if the `DepNode::CodegenUnit(P)` is /// judged to be clean (which means none of the things we read to /// generate the partition were found to be dirty), it will be loaded /// into previous work products. We will then regenerate the set of diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 24a1256c9d3..591cb9d5ad6 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -58,7 +58,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { /// Check any attribute. fn check_attributes(&self, item: &hir::Item, target: Target) { if target == Target::Fn { - self.tcx.trans_fn_attrs(self.tcx.hir.local_def_id(item.id)); + self.tcx.codegen_fn_attrs(self.tcx.hir.local_def_id(item.id)); } else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) { self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function") .span_label(item.span, "not a function") diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index c48fb7ab7eb..edd5e668d5e 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2244,8 +2244,8 @@ pub fn provide(providers: &mut Providers) { } #[derive(Clone, RustcEncodable, RustcDecodable, Hash)] -pub struct TransFnAttrs { - pub flags: TransFnAttrFlags, +pub struct CodegenFnAttrs { + pub flags: CodegenFnAttrFlags, pub inline: InlineAttr, pub export_name: Option, pub target_features: Vec, @@ -2254,7 +2254,7 @@ pub struct TransFnAttrs { bitflags! { #[derive(RustcEncodable, RustcDecodable)] - pub struct TransFnAttrFlags: u8 { + pub struct CodegenFnAttrFlags: u8 { const COLD = 0b0000_0001; const ALLOCATOR = 0b0000_0010; const UNWIND = 0b0000_0100; @@ -2266,10 +2266,10 @@ bitflags! { } } -impl TransFnAttrs { - pub fn new() -> TransFnAttrs { - TransFnAttrs { - flags: TransFnAttrFlags::empty(), +impl CodegenFnAttrs { + pub fn new() -> CodegenFnAttrs { + CodegenFnAttrs { + flags: CodegenFnAttrFlags::empty(), inline: InlineAttr::None, export_name: None, target_features: vec![], @@ -2287,7 +2287,6 @@ impl TransFnAttrs { /// True if `#[no_mangle]` or `#[export_name(...)]` is present. pub fn contains_extern_indicator(&self) -> bool { - self.flags.contains(TransFnAttrFlags::NO_MANGLE) || self.export_name.is_some() + self.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || self.export_name.is_some() } } - diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index ed01704e6a4..30f725a6b50 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1155,12 +1155,12 @@ impl<'a> ToStableHashKey> for hir::TraitCandidate { } } -impl<'hir> HashStable> for hir::TransFnAttrs +impl<'hir> HashStable> for hir::CodegenFnAttrs { fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) { - let hir::TransFnAttrs { + let hir::CodegenFnAttrs { flags, inline, export_name, @@ -1176,7 +1176,7 @@ impl<'hir> HashStable> for hir::TransFnAttrs } } -impl<'hir> HashStable> for hir::TransFnAttrFlags +impl<'hir> HashStable> for hir::CodegenFnAttrFlags { fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index a0c6bbbb239..d58eb64c366 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -30,7 +30,7 @@ pub const ATTR_CLEAN: &'static str = "rustc_clean"; pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed"; pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need"; pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused"; -pub const ATTR_PARTITION_TRANSLATED: &'static str = "rustc_partition_translated"; +pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened"; pub const DEP_GRAPH_ASSERT_ATTRS: &'static [&'static str] = &[ @@ -39,7 +39,7 @@ pub const DEP_GRAPH_ASSERT_ATTRS: &'static [&'static str] = &[ ATTR_DIRTY, ATTR_CLEAN, ATTR_PARTITION_REUSED, - ATTR_PARTITION_TRANSLATED, + ATTR_PARTITION_CODEGENED, ]; pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[ @@ -49,5 +49,5 @@ pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[ ATTR_DIRTY, ATTR_CLEAN, ATTR_PARTITION_REUSED, - ATTR_PARTITION_TRANSLATED, + ATTR_PARTITION_CODEGENED, ]; diff --git a/src/librustc/infer/anon_types/mod.rs b/src/librustc/infer/anon_types/mod.rs index d681e2e3d34..4cc5e885b8a 100644 --- a/src/librustc/infer/anon_types/mod.rs +++ b/src/librustc/infer/anon_types/mod.rs @@ -614,7 +614,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx> // compiler; those regions are ignored for the // outlives relation, and hence don't affect trait // selection or auto traits, and they are erased - // during trans. + // during codegen. let generics = self.tcx.generics_of(def_id); let substs = self.tcx.mk_substs(substs.substs.iter().enumerate().map( diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index f90baa2ccd9..381bb161e42 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -10,15 +10,15 @@ //! Implementation of lint checking. //! -//! The lint checking is mostly consolidated into one pass which runs just -//! before translation to LLVM bytecode. Throughout compilation, lint warnings +//! The lint checking is mostly consolidated into one pass which runs +//! after all other analyses. Throughout compilation, lint warnings //! can be added via the `add_lint` method on the Session structure. This //! requires a span and an id of the node that the lint is being added to. The //! lint isn't actually emitted at that time because it is unknown what the //! actual lint level at that location is. //! -//! To actually emit lint warnings/errors, a separate pass is used just before -//! translation. A context keeps track of the current state of all lint levels. +//! To actually emit lint warnings/errors, a separate pass is used. +//! A context keeps track of the current state of all lint levels. //! Upon entering a node of the ast which can modify the lint settings, the //! previous lint state is pushed onto a stack and the ast is then recursed //! upon. As the ast is traversed, this keeps track of the current lint level diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index d6c6f9dc0f6..7645d3486c2 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -16,15 +16,15 @@ //! other phases of the compiler, which are generally required to hold in order //! to compile the program at all. //! -//! Most lints can be written as `LintPass` instances. These run just before -//! translation to LLVM bytecode. The `LintPass`es built into rustc are defined +//! Most lints can be written as `LintPass` instances. These run after +//! all other analyses. The `LintPass`es built into rustc are defined //! within `builtin.rs`, which has further comments on how to add such a lint. //! rustc can also load user-defined lint plugins via the plugin mechanism. //! //! Some of rustc's lints are defined elsewhere in the compiler and work by //! calling `add_lint()` on the overall `Session` object. This works when //! it happens before the main lint pass, which emits the lints stored by -//! `add_lint()`. To emit lints after the main lint pass (from trans, for +//! `add_lint()`. To emit lints after the main lint pass (from codegen, for //! example) requires more effort. See `emit_lint` and `GatherNodeLevels` //! in `context.rs`. diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 4996a6acff8..4c99b46ddff 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -109,7 +109,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let sess = &tcx.sess; - if !sess.opts.output_types.should_trans() { + if !sess.opts.output_types.should_codegen() { return Vec::new(); } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index a4c38333da1..e9d27c182a2 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -46,9 +46,9 @@ //! //! ## By-reference upvars //! -//! One part of the translation which may be non-obvious is that we translate +//! One part of the codegen which may be non-obvious is that we translate //! closure upvars into the dereference of a borrowed pointer; this more closely -//! resembles the runtime translation. So, for example, if we had: +//! resembles the runtime codegen. So, for example, if we had: //! //! let mut x = 3; //! let y = 5; diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 0aeb15b49fb..249651ef65d 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -15,7 +15,7 @@ // makes all other generics or inline functions that it references // reachable as well. -use hir::TransFnAttrs; +use hir::CodegenFnAttrs; use hir::map as hir_map; use hir::def::Def; use hir::def_id::{DefId, CrateNum}; @@ -44,7 +44,7 @@ fn generics_require_inlining(generics: &hir::Generics) -> bool { // Returns true if the given item must be inlined because it may be // monomorphized or it was marked with `#[inline]`. This will only return // true for functions. -fn item_might_be_inlined(item: &hir::Item, attrs: TransFnAttrs) -> bool { +fn item_might_be_inlined(item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { return true } @@ -61,15 +61,15 @@ fn item_might_be_inlined(item: &hir::Item, attrs: TransFnAttrs) -> bool { fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { - let trans_fn_attrs = tcx.trans_fn_attrs(impl_item.hir_id.owner_def_id()); - if trans_fn_attrs.requests_inline() || + let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); + if codegen_fn_attrs.requests_inline() || generics_require_inlining(&impl_item.generics) { return true } if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_src) { match tcx.hir.find(impl_node_id) { Some(hir_map::NodeItem(item)) => - item_might_be_inlined(&item, trans_fn_attrs), + item_might_be_inlined(&item, codegen_fn_attrs), Some(..) | None => span_bug!(impl_item.span, "impl did is not an item") } @@ -163,7 +163,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { Some(hir_map::NodeItem(item)) => { match item.node { hir::ItemFn(..) => - item_might_be_inlined(&item, self.tcx.trans_fn_attrs(def_id)), + item_might_be_inlined(&item, self.tcx.codegen_fn_attrs(def_id)), _ => false, } } @@ -179,7 +179,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { match impl_item.node { hir::ImplItemKind::Const(..) => true, hir::ImplItemKind::Method(..) => { - let attrs = self.tcx.trans_fn_attrs(def_id); + let attrs = self.tcx.codegen_fn_attrs(def_id); if generics_require_inlining(&impl_item.generics) || attrs.requests_inline() { true @@ -233,7 +233,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { false }; let def_id = self.tcx.hir.local_def_id(item.id); - let is_extern = self.tcx.trans_fn_attrs(def_id).contains_extern_indicator(); + let is_extern = self.tcx.codegen_fn_attrs(def_id).contains_extern_indicator(); if reachable || is_extern { self.reachable_symbols.insert(search_item); } @@ -251,7 +251,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { match item.node { hir::ItemFn(.., body) => { let def_id = self.tcx.hir.local_def_id(item.id); - if item_might_be_inlined(&item, self.tcx.trans_fn_attrs(def_id)) { + if item_might_be_inlined(&item, self.tcx.codegen_fn_attrs(def_id)) { self.visit_nested_body(body); } } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 52217600759..71d7abed6c9 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -1279,7 +1279,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, loop { // Note: give all the expressions matching `ET` with the // extended temporary lifetime, not just the innermost rvalue, - // because in trans if we must compile e.g. `*rvalue()` + // because in codegen if we must compile e.g. `*rvalue()` // into a temporary, we request the temporary scope of the // outer expression. visitor.scope_tree.record_rvalue_scope(expr.hir_id.local_id, blk_scope); diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index afdd1c167c6..31885c1e020 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -249,7 +249,7 @@ pub struct Allocation { pub undef_mask: UndefMask, /// The alignment of the allocation to detect unaligned reads. pub align: Align, - /// Whether the allocation (of a static) should be put into mutable memory when translating + /// Whether the allocation (of a static) should be put into mutable memory when codegenning /// /// Only happens for `static mut` or `static` with interior mutability pub runtime_mutability: Mutability, diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 2cd4bf9d18c..7bd84a607e7 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -75,7 +75,7 @@ impl<'tcx> ConstValue<'tcx> { /// /// For optimization of a few very common cases, there is also a representation for a pair of /// primitive values (`ByValPair`). It allows Miri to avoid making allocations for checked binary -/// operations and fat pointers. This idea was taken from rustc's trans. +/// operations and fat pointers. This idea was taken from rustc's codegen. #[derive(Clone, Copy, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash)] pub enum Value { ByRef(Pointer, Align), diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index eb12444bcb4..40e9b687f0c 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -696,7 +696,7 @@ pub struct BasicBlockData<'tcx> { pub terminator: Option>, /// If true, this block lies on an unwind path. This is used - /// during trans where distinct kinds of basic blocks may be + /// during codegen where distinct kinds of basic blocks may be /// generated (particularly for MSVC cleanup). Unwind blocks must /// only branch to other unwind blocks. pub is_cleanup: bool, @@ -1614,7 +1614,7 @@ pub enum CastKind { UnsafeFnPointer, /// "Unsize" -- convert a thin-or-fat pointer to a fat pointer. - /// trans must figure out the details once full monomorphization + /// codegen must figure out the details once full monomorphization /// is known. For example, this could be used to cast from a /// `&[i32;N]` to a `&[i32]`, or a `Box` to a `Box` /// (presuming `T: Trait`). diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index d01059a3e01..9de9347d0ce 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -184,11 +184,11 @@ impl<'a, 'tcx> HashStable> for CodegenUnit<'tcx> { name.hash_stable(hcx, hasher); - let mut items: Vec<(Fingerprint, _)> = items.iter().map(|(trans_item, &attrs)| { + let mut items: Vec<(Fingerprint, _)> = items.iter().map(|(mono_item, &attrs)| { let mut hasher = StableHasher::new(); - trans_item.hash_stable(hcx, &mut hasher); - let trans_item_fingerprint = hasher.finish(); - (trans_item_fingerprint, attrs) + mono_item.hash_stable(hcx, &mut hasher); + let mono_item_fingerprint = hasher.finish(); + (mono_item_fingerprint, attrs) }).collect(); items.sort_unstable_by_key(|i| i.0); @@ -238,4 +238,3 @@ impl Stats { self.fn_stats.extend(stats.fn_stats); } } - diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 489197e0381..2344cd11f66 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -270,7 +270,7 @@ impl OutputTypes { } // True if any of the output types require codegen or linking. - pub fn should_trans(&self) -> bool { + pub fn should_codegen(&self) -> bool { self.0.keys().any(|k| match *k { OutputType::Bitcode | OutputType::Assembly @@ -1135,14 +1135,14 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "count where LLVM instrs originate"), time_llvm_passes: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true, "The output of `-Z time-llvm-passes` will only reflect timings of \ - re-translated modules when used with incremental compilation" )], + re-codegened modules when used with incremental compilation" )], "measure time of each LLVM pass"), input_stats: bool = (false, parse_bool, [UNTRACKED], "gather statistics about the input"), - trans_stats: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true, - "The output of `-Z trans-stats` might not be accurate when incremental \ + codegen_stats: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true, + "The output of `-Z codegen-stats` might not be accurate when incremental \ compilation is enabled")], - "gather trans statistics"), + "gather codegen statistics"), asm_comments: bool = (false, parse_bool, [TRACKED], "generate comments into the assembly (may change behavior)"), no_verify: bool = (false, parse_bool, [TRACKED], @@ -1183,8 +1183,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, Use with RUST_REGION_GRAPH=help for more info"), parse_only: bool = (false, parse_bool, [UNTRACKED], "parse only; do not compile, assemble, or link"), - no_trans: bool = (false, parse_bool, [TRACKED], - "run all passes except translation; no output"), + no_codegen: bool = (false, parse_bool, [TRACKED], + "run all passes except codegen; no output"), treat_err_as_bug: bool = (false, parse_bool, [TRACKED], "treat all errors that occur as bugs"), external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED], @@ -1235,8 +1235,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "show spans for compiler debugging (expr|pat|ty)"), print_type_sizes: bool = (false, parse_bool, [UNTRACKED], "print layout information for each type encountered"), - print_trans_items: Option = (None, parse_opt_string, [UNTRACKED], - "print the result of the translation item collection pass"), + print_mono_items: Option = (None, parse_opt_string, [UNTRACKED], + "print the result of the monomorphization collection pass"), mir_opt_level: usize = (1, parse_uint, [TRACKED], "set the MIR optimization level (0-3, default: 1)"), mutable_noalias: bool = (false, parse_bool, [TRACKED], @@ -1244,7 +1244,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, arg_align_attributes: bool = (false, parse_bool, [TRACKED], "emit align metadata for reference arguments"), dump_mir: Option = (None, parse_opt_string, [UNTRACKED], - "dump MIR state at various points in translation"), + "dump MIR state at various points in transforms"), dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED], "the directory the MIR is dumped into"), dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], @@ -1296,8 +1296,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "dump facts from NLL analysis into side files"), disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED], "disable user provided type assertion in NLL"), - trans_time_graph: bool = (false, parse_bool, [UNTRACKED], - "generate a graphical HTML report of time spent in trans and LLVM"), + codegen_time_graph: bool = (false, parse_bool, [UNTRACKED], + "generate a graphical HTML report of time spent in codegen and LLVM"), thinlto: Option = (None, parse_opt_bool, [TRACKED], "enable ThinLTO when possible"), inline_in_all_cgus: Option = (None, parse_opt_bool, [TRACKED], @@ -1309,7 +1309,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, the max/min integer respectively, and NaN is mapped to 0"), lower_128bit_ops: Option = (None, parse_opt_bool, [TRACKED], "rewrite operators on i128 and u128 into lang item calls (typically provided \ - by compiler-builtins) so translation doesn't need to support them, + by compiler-builtins) so codegen doesn't need to support them, overriding the default for the current target"), human_readable_cgu_names: bool = (false, parse_bool, [TRACKED], "generate human-readable, predictable names for codegen units"), @@ -3047,7 +3047,7 @@ mod tests { assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.input_stats = true; assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); - opts.debugging_opts.trans_stats = true; + opts.debugging_opts.codegen_stats = true; assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.borrowck_stats = true; assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); @@ -3093,7 +3093,7 @@ mod tests { assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.keep_ast = true; assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); - opts.debugging_opts.print_trans_items = Some(String::from("abc")); + opts.debugging_opts.print_mono_items = Some(String::from("abc")); assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.dump_mir = Some(String::from("abc")); assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); @@ -3120,7 +3120,7 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); - opts.debugging_opts.no_trans = true; + opts.debugging_opts.no_codegen = true; assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index bbf873290a9..6c8d4f5669e 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -98,7 +98,7 @@ pub struct Session { /// arguments passed to the compiler. Its value together with the crate-name /// forms a unique global identifier for the crate. It is used to allow /// multiple crates with the same name to coexist. See the - /// trans::back::symbol_names module for more information. + /// rustc_codegen_llvm::back::symbol_names module for more information. pub crate_disambiguator: Once, features: Once, @@ -504,8 +504,8 @@ impl Session { pub fn time_llvm_passes(&self) -> bool { self.opts.debugging_opts.time_llvm_passes } - pub fn trans_stats(&self) -> bool { - self.opts.debugging_opts.trans_stats + pub fn codegen_stats(&self) -> bool { + self.opts.debugging_opts.codegen_stats } pub fn meta_stats(&self) -> bool { self.opts.debugging_opts.meta_stats @@ -894,11 +894,11 @@ impl Session { // Why is 16 codegen units the default all the time? // // The main reason for enabling multiple codegen units by default is to - // leverage the ability for the trans backend to do translation and - // codegen in parallel. This allows us, especially for large crates, to + // leverage the ability for the codegen backend to do codegen and + // optimization in parallel. This allows us, especially for large crates, to // make good use of all available resources on the machine once we've // hit that stage of compilation. Large crates especially then often - // take a long time in trans/codegen and this helps us amortize that + // take a long time in codegen/optimization and this helps us amortize that // cost. // // Note that a high number here doesn't mean that we'll be spawning a diff --git a/src/librustc/traits/trans/mod.rs b/src/librustc/traits/codegen/mod.rs similarity index 96% rename from src/librustc/traits/trans/mod.rs rename to src/librustc/traits/codegen/mod.rs index 31e851126d7..cf404202ac1 100644 --- a/src/librustc/traits/trans/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file contains various trait resolution methods used by trans. +// This file contains various trait resolution methods used by codegen. // They all assume regions can be erased and monomorphic types. It // seems likely that they should eventually be merged into more // general routines. @@ -30,7 +30,7 @@ use ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn trans_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -38,7 +38,7 @@ pub fn trans_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, // Remove any references to regions; this helps improve caching. let trait_ref = ty.erase_regions(&trait_ref); - debug!("trans::fulfill_obligation(trait_ref={:?}, def_id={:?})", + debug!("codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})", (param_env, trait_ref), trait_ref.def_id()); // Do the initial selection for the obligation. This yields the @@ -60,12 +60,12 @@ pub fn trans_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, // leading to an ambiguous result. So report this as an // overflow bug, since I believe this is the only case // where ambiguity can result. - bug!("Encountered ambiguity selecting `{:?}` during trans, \ + bug!("Encountered ambiguity selecting `{:?}` during codegen, \ presuming due to overflow", trait_ref) } Err(e) => { - bug!("Encountered error `{:?}` selecting `{:?}` during trans", + bug!("Encountered error `{:?}` selecting `{:?}` during codegen", e, trait_ref) } }; diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index f4f0c47899d..b5115eab7dc 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -64,7 +64,7 @@ mod on_unimplemented; mod select; mod specialize; mod structural_impls; -pub mod trans; +pub mod codegen; mod util; pub mod query; @@ -473,8 +473,8 @@ pub enum Vtable<'tcx, N> { /// /// The type parameter `N` indicates the type used for "nested /// obligations" that are required by the impl. During type check, this -/// is `Obligation`, as one might expect. During trans, however, this -/// is `()`, because trans only requires a shallow resolution of an +/// is `Obligation`, as one might expect. During codegen, however, this +/// is `()`, because codegen only requires a shallow resolution of an /// impl, and nested obligations are satisfied later. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct VtableImplData<'tcx, N> { @@ -856,7 +856,7 @@ fn vtable_methods<'a, 'tcx>( // It's possible that the method relies on where clauses that // do not hold for this particular set of type parameters. // Note that this method could then never be called, so we - // do not want to try and trans it, in that case (see #23435). + // do not want to try and codegen it, in that case (see #23435). let predicates = tcx.predicates_of(def_id).instantiate_own(tcx, substs); if !normalize_and_test_predicates(tcx, predicates.predicates) { debug!("vtable_methods: predicates do not hold"); @@ -992,7 +992,7 @@ pub fn provide(providers: &mut ty::maps::Providers) { is_object_safe: object_safety::is_object_safe_provider, specialization_graph_of: specialize::specialization_graph_provider, specializes: specialize::specializes, - trans_fulfill_obligation: trans::trans_fulfill_obligation, + codegen_fulfill_obligation: codegen::codegen_fulfill_obligation, vtable_methods, substitute_normalize_and_test_predicates, ..*providers diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index bfa32f8e7fa..270e06a872b 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -65,7 +65,7 @@ pub enum Reveal { /// } UserFacing, - /// At trans time, all monomorphic projections will succeed. + /// At codegen time, all monomorphic projections will succeed. /// Also, `impl Trait` is normalized to the concrete type, /// which has to be already collected by type-checking. /// @@ -346,7 +346,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, let ty = ty.super_fold_with(self); match ty.sty { ty::TyAnon(def_id, substs) if !substs.has_escaping_regions() => { // (*) - // Only normalize `impl Trait` after type-checking, usually in trans. + // Only normalize `impl Trait` after type-checking, usually in codegen. match self.param_env.reveal { Reveal::UserFacing => ty, @@ -1054,7 +1054,7 @@ fn assemble_candidates_from_impls<'cx, 'gcx, 'tcx>( super::VtableImpl(impl_data) => { // We have to be careful when projecting out of an // impl because of specialization. If we are not in - // trans (i.e., projection mode is not "any"), and the + // codegen (i.e., projection mode is not "any"), and the // impl's type is declared as default, then we disable // projection (even if the trait ref is fully // monomorphic). In the case where trait ref is not diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index f074e061653..1e9e9c056c9 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -104,7 +104,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx match ty.sty { ty::TyAnon(def_id, substs) if !substs.has_escaping_regions() => { // (*) - // Only normalize `impl Trait` after type-checking, usually in trans. + // Only normalize `impl Trait` after type-checking, usually in codegen. match self.param_env.reveal { Reveal::UserFacing => ty, diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index a9734e9c298..1cb96a3e33f 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -57,7 +57,7 @@ impl<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { /// /// NB. Currently, higher-ranked type bounds inhibit /// normalization. Therefore, each time we erase them in - /// translation, we need to normalize the contents. + /// codegen, we need to normalize the contents. pub fn normalize_erasing_late_bound_regions( self, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index b9593047af4..2e2f7a2ad31 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -275,7 +275,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { } } -// For trans only. +// For codegen only. impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> { type Lifted = traits::Vtable<'tcx, ()>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index a0c31e8b509..3263da8fda3 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -91,8 +91,8 @@ pub enum Adjust<'tcx> { /// pointers. We don't store the details of how the transform is /// done (in fact, we don't know that, because it might depend on /// the precise type parameters). We just store the target - /// type. Trans figures out what has to be done at monomorphization - /// time based on the precise source/target type at hand. + /// type. Codegen backends and miri figure out what has to be done + /// based on the precise source/target type at hand. Unsize, } diff --git a/src/librustc/ty/cast.rs b/src/librustc/ty/cast.rs index 908335424e7..7593d4ed24e 100644 --- a/src/librustc/ty/cast.rs +++ b/src/librustc/ty/cast.rs @@ -9,7 +9,7 @@ // except according to those terms. // Helpers for handling cast expressions, used in both -// typeck and trans. +// typeck and codegen. use ty::{self, Ty}; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 3c345fcd9ee..ee55b8dd767 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -401,7 +401,7 @@ pub struct TypeckTables<'tcx> { /// For each fn, records the "liberated" types of its arguments /// and return type. Liberated means that all bound regions /// (including late-bound regions) are replaced with free - /// equivalents. This table is not used in trans (since regions + /// equivalents. This table is not used in codegen (since regions /// are erased there) and hence is not serialized to metadata. liberated_fn_sigs: ItemLocalMap>, @@ -921,7 +921,7 @@ pub struct GlobalCtxt<'tcx> { /// A general purpose channel to throw data out the back towards LLVM worker /// threads. /// - /// This is intended to only get used during the trans phase of the compiler + /// This is intended to only get used during the codegen phase of the compiler /// when satisfying the query for a particular codegen unit. Internally in /// the query it'll send data along this channel to get processed later. pub tx_to_llvm_workers: Lock>>, diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index 4f8fca67949..f483b4c174a 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -68,7 +68,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'a, 'gcx, 't // // Note that we *CAN* replace early-bound regions -- the // type system never "sees" those, they get substituted - // away. In trans, they will always be erased to 'erased + // away. In codegen, they will always be erased to 'erased // whenever a substitution occurs. match *r { ty::ReLateBound(..) => r, @@ -76,4 +76,3 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'a, 'gcx, 't } } } - diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 250f33d9dba..8aca7177d55 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -424,7 +424,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { collector.regions } - /// Replace any late-bound regions bound in `value` with `'erased`. Useful in trans but also + /// Replace any late-bound regions bound in `value` with `'erased`. Useful in codegen but also /// method lookup and a few other places where precise region relationships are not required. pub fn erase_late_bound_regions(self, value: &Binder) -> T where T : TypeFoldable<'tcx> diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index e7b71ca2b22..e97f782fccf 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -104,13 +104,13 @@ impl<'tcx> InstanceDef<'tcx> { return true } if let ty::InstanceDef::DropGlue(..) = *self { - // Drop glue wants to be instantiated at every translation + // Drop glue wants to be instantiated at every codegen // unit, but without an #[inline] hint. We should make this // available to normal end-users. return true } - let trans_fn_attrs = tcx.trans_fn_attrs(self.def_id()); - trans_fn_attrs.requests_inline() || tcx.is_const_fn(self.def_id()) + let codegen_fn_attrs = tcx.codegen_fn_attrs(self.def_id()); + codegen_fn_attrs.requests_inline() || tcx.is_const_fn(self.def_id()) } } @@ -145,7 +145,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> Instance<'tcx> { assert!(!substs.has_escaping_regions(), - "substs of instance {:?} not normalized for trans: {:?}", + "substs of instance {:?} not normalized for codegen: {:?}", def_id, substs); Instance { def: InstanceDef::Item(def_id), substs: substs } } @@ -175,7 +175,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { /// `RevealMode` in the parameter environment.) /// /// Presuming that coherence and type-check have succeeded, if this method is invoked - /// in a monomorphic context (i.e., like during trans), then it is guaranteed to return + /// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return /// `Some`. pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -259,7 +259,7 @@ fn resolve_associated_item<'a, 'tcx>( def_id, trait_id, rcvr_substs); let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs); - let vtbl = tcx.trans_fulfill_obligation((param_env, ty::Binder::bind(trait_ref))); + let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref))); // Now that we know which impl is being used, we can dispatch to // the actual function: @@ -321,7 +321,7 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind, } (ty::ClosureKind::Fn, ty::ClosureKind::FnMut) => { // The closure fn `llfn` is a `fn(&self, ...)`. We want a - // `fn(&mut self, ...)`. In fact, at trans time, these are + // `fn(&mut self, ...)`. In fact, at codegen time, these are // basically the same thing, so we can just return llfn. Ok(false) } @@ -334,7 +334,7 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind, // fn call_once(self, ...) { call_mut(&self, ...) } // fn call_once(mut self, ...) { call_mut(&mut self, ...) } // - // These are both the same at trans time. + // These are both the same at codegen time. Ok(true) } (ty::ClosureKind::FnMut, _) | diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index bbfc6d883e9..dbc32f4dbdd 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -949,14 +949,14 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { // because this discriminant will be loaded, and then stored into variable of // type calculated by typeck. Consider such case (a bug): typeck decided on // byte-sized discriminant, but layout thinks we need a 16-bit to store all - // discriminant values. That would be a bug, because then, in trans, in order + // discriminant values. That would be a bug, because then, in codegen, in order // to store this 16-bit discriminant into 8-bit sized temporary some of the // space necessary to represent would have to be discarded (or layout is wrong // on thinking it needs 16 bits) bug!("layout decided on a larger discriminant type ({:?}) than typeck ({:?})", min_ity, typeck_ity); // However, it is fine to make discr type however large (as an optimisation) - // after this point – we’ll just truncate the value we load in trans. + // after this point – we’ll just truncate the value we load in codegen. } // Check to see if we should use a different type for the @@ -1121,7 +1121,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { // If we are running with `-Zprint-type-sizes`, record layouts for // dumping later. Ignore layouts that are done with non-empty // environments or non-monomorphic layouts, as the user only wants - // to see the stuff resulting from the final trans session. + // to see the stuff resulting from the final codegen session. if !self.tcx.sess.opts.debugging_opts.print_type_sizes || layout.ty.has_param_types() || diff --git a/src/librustc/ty/maps/config.rs b/src/librustc/ty/maps/config.rs index ad48519e136..19c97a918bb 100644 --- a/src/librustc/ty/maps/config.rs +++ b/src/librustc/ty/maps/config.rs @@ -349,7 +349,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::is_mir_available<'tcx> { } } -impl<'tcx> QueryDescription<'tcx> for queries::trans_fulfill_obligation<'tcx> { +impl<'tcx> QueryDescription<'tcx> for queries::codegen_fulfill_obligation<'tcx> { fn describe(tcx: TyCtxt, key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String { format!("checking if `{}` fulfills its obligations", tcx.item_path_str(key.1.def_id())) } @@ -637,9 +637,9 @@ impl<'tcx> QueryDescription<'tcx> for queries::exported_symbols<'tcx> { } } -impl<'tcx> QueryDescription<'tcx> for queries::collect_and_partition_translation_items<'tcx> { +impl<'tcx> QueryDescription<'tcx> for queries::collect_and_partition_mono_items<'tcx> { fn describe(_tcx: TyCtxt, _: CrateNum) -> String { - format!("collect_and_partition_translation_items") + format!("collect_and_partition_mono_items") } } @@ -795,5 +795,5 @@ impl_disk_cacheable_query!(def_symbol_name, |_| true); impl_disk_cacheable_query!(type_of, |def_id| def_id.is_local()); impl_disk_cacheable_query!(predicates_of, |def_id| def_id.is_local()); impl_disk_cacheable_query!(used_trait_imports, |def_id| def_id.is_local()); -impl_disk_cacheable_query!(trans_fn_attrs, |_| true); +impl_disk_cacheable_query!(codegen_fn_attrs, |_| true); impl_disk_cacheable_query!(specialization_graph_of, |_| true); diff --git a/src/librustc/ty/maps/mod.rs b/src/librustc/ty/maps/mod.rs index 6e419627dd8..6556e47720c 100644 --- a/src/librustc/ty/maps/mod.rs +++ b/src/librustc/ty/maps/mod.rs @@ -11,7 +11,7 @@ use dep_graph::{DepConstructor, DepNode}; use hir::def_id::{CrateNum, DefId, DefIndex}; use hir::def::{Def, Export}; -use hir::{self, TraitCandidate, ItemLocalId, TransFnAttrs}; +use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs}; use hir::svh::Svh; use infer::canonical::{self, Canonical}; use lint; @@ -181,7 +181,7 @@ define_maps! { <'tcx> [] fn mir_validated: MirValidated(DefId) -> &'tcx Steal>, /// MIR after our optimization passes have run. This is MIR that is ready - /// for trans. This is also the only query that can fetch non-local MIR, at present. + /// for codegen. This is also the only query that can fetch non-local MIR, at present. [] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>, /// The result of unsafety-checking this def-id. @@ -255,7 +255,7 @@ define_maps! { <'tcx> [] fn lookup_stability: LookupStability(DefId) -> Option<&'tcx attr::Stability>, [] fn lookup_deprecation_entry: LookupDeprecationEntry(DefId) -> Option, [] fn item_attrs: ItemAttrs(DefId) -> Lrc<[ast::Attribute]>, - [] fn trans_fn_attrs: trans_fn_attrs(DefId) -> TransFnAttrs, + [] fn codegen_fn_attrs: codegen_fn_attrs(DefId) -> CodegenFnAttrs, [] fn fn_arg_names: FnArgNames(DefId) -> Vec, /// Gets the rendered value of the specified constant or associated constant. /// Used by rustdoc. @@ -268,7 +268,7 @@ define_maps! { <'tcx> [] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>) -> Lrc)>>>, - [] fn trans_fulfill_obligation: fulfill_obligation_dep_node( + [] fn codegen_fulfill_obligation: fulfill_obligation_dep_node( (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()>, [] fn trait_impls_of: TraitImpls(DefId) -> Lrc, [] fn specialization_graph_of: SpecializationGraph(DefId) -> Lrc, @@ -402,10 +402,10 @@ define_maps! { <'tcx> [] fn exported_symbols: ExportedSymbols(CrateNum) -> Arc, SymbolExportLevel)>>, - [] fn collect_and_partition_translation_items: - collect_and_partition_translation_items_node(CrateNum) + [] fn collect_and_partition_mono_items: + collect_and_partition_mono_items_node(CrateNum) -> (Arc, Arc>>>), - [] fn is_translated_item: IsTranslatedItem(DefId) -> bool, + [] fn is_codegened_item: IsCodegenedItem(DefId) -> bool, [] fn codegen_unit: CodegenUnit(InternedString) -> Arc>, [] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats, [] fn output_filenames: output_filenames_node(CrateNum) @@ -475,8 +475,8 @@ fn features_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { DepConstructor::Features } -fn trans_fn_attrs<'tcx>(id: DefId) -> DepConstructor<'tcx> { - DepConstructor::TransFnAttrs { 0: id } +fn codegen_fn_attrs<'tcx>(id: DefId) -> DepConstructor<'tcx> { + DepConstructor::CodegenFnAttrs { 0: id } } fn erase_regions_ty<'tcx>(ty: Ty<'tcx>) -> DepConstructor<'tcx> { @@ -609,8 +609,8 @@ fn all_traits_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { DepConstructor::AllTraits } -fn collect_and_partition_translation_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { - DepConstructor::CollectAndPartitionTranslationItems +fn collect_and_partition_mono_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { + DepConstructor::CollectAndPartitionMonoItems } fn output_filenames_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { diff --git a/src/librustc/ty/maps/on_disk_cache.rs b/src/librustc/ty/maps/on_disk_cache.rs index cea2a03fd53..9ca90a06c4e 100644 --- a/src/librustc/ty/maps/on_disk_cache.rs +++ b/src/librustc/ty/maps/on_disk_cache.rs @@ -224,7 +224,7 @@ impl<'sess> OnDiskCache<'sess> { encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; - encode_query_results::(tcx, enc, qri)?; + encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; @@ -234,7 +234,7 @@ impl<'sess> OnDiskCache<'sess> { encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; - encode_query_results::(tcx, enc, qri)?; + encode_query_results::(tcx, enc, qri)?; encode_query_results::(tcx, enc, qri)?; // const eval is special, it only encodes successfully evaluated constants diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs index 65dcb7311d3..065b7939ac3 100644 --- a/src/librustc/ty/maps/plumbing.rs +++ b/src/librustc/ty/maps/plumbing.rs @@ -871,7 +871,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, // Since we cannot reconstruct the query key of a DepNode::CodegenUnit, we // would always end up having to evaluate the first caller of the // `codegen_unit` query that *is* reconstructible. This might very well be - // the `compile_codegen_unit` query, thus re-translating the whole CGU just + // the `compile_codegen_unit` query, thus re-codegenning the whole CGU just // to re-trigger calling the `codegen_unit` query with the right key. At // that point we would already have re-done all the work we are trying to // avoid doing in the first place. @@ -1046,7 +1046,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, } DepKind::IsMirAvailable => { force!(is_mir_available, def_id!()); } DepKind::ItemAttrs => { force!(item_attrs, def_id!()); } - DepKind::TransFnAttrs => { force!(trans_fn_attrs, def_id!()); } + DepKind::CodegenFnAttrs => { force!(codegen_fn_attrs, def_id!()); } DepKind::FnArgNames => { force!(fn_arg_names, def_id!()); } DepKind::RenderedConst => { force!(rendered_const, def_id!()); } DepKind::DylibDepFormats => { force!(dylib_dependency_formats, krate!()); } @@ -1121,10 +1121,10 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::AllTraits => { force!(all_traits, LOCAL_CRATE); } DepKind::AllCrateNums => { force!(all_crate_nums, LOCAL_CRATE); } DepKind::ExportedSymbols => { force!(exported_symbols, krate!()); } - DepKind::CollectAndPartitionTranslationItems => { - force!(collect_and_partition_translation_items, LOCAL_CRATE); + DepKind::CollectAndPartitionMonoItems => { + force!(collect_and_partition_mono_items, LOCAL_CRATE); } - DepKind::IsTranslatedItem => { force!(is_translated_item, def_id!()); } + DepKind::IsCodegenedItem => { force!(is_codegened_item, def_id!()); } DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); } DepKind::TargetFeaturesWhitelist => { force!(target_features_whitelist, LOCAL_CRATE); } @@ -1207,6 +1207,6 @@ impl_load_from_cache!( GenericsOfItem => generics_of, PredicatesOfItem => predicates_of, UsedTraitImports => used_trait_imports, - TransFnAttrs => trans_fn_attrs, + CodegenFnAttrs => codegen_fn_attrs, SpecializationGraph => specialization_graph_of, ); diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index eb638d7c9a1..ce7feae0719 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -118,7 +118,7 @@ mod sty; // Data types /// The complete set of all analyses described in this module. This is -/// produced by the driver and fed to trans and later passes. +/// produced by the driver and fed to codegen and later passes. /// /// NB: These contents are being migrated into queries using the /// *on-demand* infrastructure. @@ -1426,7 +1426,7 @@ pub struct ParamEnv<'tcx> { /// into Obligations, and elaborated and normalized. pub caller_bounds: &'tcx Slice>, - /// Typically, this is `Reveal::UserFacing`, but during trans we + /// Typically, this is `Reveal::UserFacing`, but during codegen we /// want `Reveal::All` -- note that this is always paired with an /// empty environment. To get that, use `ParamEnv::reveal()`. pub reveal: traits::Reveal, @@ -1444,7 +1444,7 @@ impl<'tcx> ParamEnv<'tcx> { /// Construct a trait environment with no where clauses in scope /// where the values of all `impl Trait` and other hidden types /// are revealed. This is suitable for monomorphized, post-typeck - /// environments like trans or doing optimizations. + /// environments like codegen or doing optimizations. /// /// NB. If you want to have predicates in scope, use `ParamEnv::new`, /// or invoke `param_env.with_reveal_all()`. @@ -1462,7 +1462,7 @@ impl<'tcx> ParamEnv<'tcx> { /// Returns a new parameter environment with the same clauses, but /// which "reveals" the true results of projections in all cases /// (even for associated types that are specializable). This is - /// the desired behavior during trans and certain other special + /// the desired behavior during codegen and certain other special /// contexts; normally though we want to use `Reveal::UserFacing`, /// which is the default. pub fn with_reveal_all(self) -> Self { diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 5c0217fc3f5..4493c668593 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -243,7 +243,7 @@ pub enum TypeVariants<'tcx> { /// out later. /// /// All right, you say, but why include the type parameters from the -/// original function then? The answer is that trans may need them +/// original function then? The answer is that codegen may need them /// when monomorphizing, and they may not appear in the upvars. A /// closure could capture no variables but still make use of some /// in-scope type parameter with a bound (e.g., if our example above @@ -273,7 +273,7 @@ pub struct ClosureSubsts<'tcx> { /// Lifetime and type parameters from the enclosing function, /// concatenated with the types of the upvars. /// - /// These are separated out because trans wants to pass them around + /// These are separated out because codegen wants to pass them around /// when monomorphizing. pub substs: &'tcx Substs<'tcx>, } @@ -1093,7 +1093,7 @@ pub enum RegionKind { /// variable with no constraints. ReEmpty, - /// Erased region, used by trait selection, in MIR and during trans. + /// Erased region, used by trait selection, in MIR and during codegen. ReErased, /// These are regions bound in the "defining type" for a diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index eaae874635f..c66dd79cbf5 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1135,7 +1135,7 @@ define_print! { })? } else { // cross-crate closure types should only be - // visible in trans bug reports, I imagine. + // visible in codegen bug reports, I imagine. write!(f, "@{:?}", did)?; let mut sep = " "; for (index, upvar_ty) in upvar_tys.enumerate() { @@ -1175,7 +1175,7 @@ define_print! { })? } else { // cross-crate closure types should only be - // visible in trans bug reports, I imagine. + // visible in codegen bug reports, I imagine. write!(f, "@{:?}", did)?; let mut sep = " "; for (index, upvar_ty) in upvar_tys.enumerate() { diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 29f03c06ab7..6fc0ed47b80 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -1126,7 +1126,7 @@ fn foo(a: [D; 10], b: [D; 10], i: i32, t: bool) -> D { } ``` -There are a number of ways that the trans backend could choose to +There are a number of ways that the codegen backend could choose to compile this (e.g. a `[bool; 10]` array for each such moved array; or an `Option` for each moved array). From the viewpoint of the borrow-checker, the important thing is to record what kind of fragment diff --git a/src/librustc_trans/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml similarity index 91% rename from src/librustc_trans/Cargo.toml rename to src/librustc_codegen_llvm/Cargo.toml index 64d3a4f4d53..7cf0a1c1bec 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 @@ -27,7 +27,7 @@ rustc_errors = { path = "../librustc_errors" } rustc_incremental = { path = "../librustc_incremental" } rustc_llvm = { path = "../librustc_llvm" } rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" } -rustc_trans_utils = { path = "../librustc_trans_utils" } +rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_mir = { path = "../librustc_mir" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } @@ -43,7 +43,7 @@ env_logger = { version = "0.5", default-features = false } # `rustc` driver script communicate this. jemalloc = ["rustc_target/jemalloc"] -# This is used to convince Cargo to separately cache builds of `rustc_trans` +# This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm` # when this option is enabled or not. That way we can build two, cache two # artifacts, and have nice speedy rebuilds. emscripten = ["rustc_llvm/emscripten"] diff --git a/src/librustc_codegen_llvm/README.md b/src/librustc_codegen_llvm/README.md new file mode 100644 index 00000000000..8d1c9a52b24 --- /dev/null +++ b/src/librustc_codegen_llvm/README.md @@ -0,0 +1,7 @@ +The `codegen` crate contains the code to convert from MIR into LLVM IR, +and then from LLVM IR into machine code. In general it contains code +that runs towards the end of the compilation process. + +For more information about how codegen works, see the [rustc guide]. + +[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/codegen.html 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/allocator.rs b/src/librustc_codegen_llvm/allocator.rs similarity index 98% rename from src/librustc_trans/allocator.rs rename to src/librustc_codegen_llvm/allocator.rs index 871fe98ec01..eeb02e948f1 100644 --- a/src/librustc_trans/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -20,7 +20,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy}; use ModuleLlvm; use llvm::{self, False, True}; -pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) { +pub(crate) unsafe fn codegen(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) { let llcx = mods.llcx; let llmod = mods.llmod; let usize = match &tcx.sess.target.target.target_pointer_width[..] { diff --git a/src/librustc_trans/asm.rs b/src/librustc_codegen_llvm/asm.rs similarity index 96% rename from src/librustc_trans/asm.rs rename to src/librustc_codegen_llvm/asm.rs index 751f8148a2a..82f068106ff 100644 --- a/src/librustc_trans/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! # Translation of inline assembly. - use llvm::{self, ValueRef}; use common::*; use type_::Type; @@ -26,7 +24,7 @@ use syntax::ast::AsmDialect; use libc::{c_uint, c_char}; // Take an inline assembly expression and splat it out via LLVM -pub fn trans_inline_asm<'a, 'tcx>( +pub fn codegen_inline_asm<'a, 'tcx>( bx: &Builder<'a, 'tcx>, ia: &hir::InlineAsm, outputs: Vec>, @@ -120,7 +118,7 @@ pub fn trans_inline_asm<'a, 'tcx>( } } -pub fn trans_global_asm<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, +pub fn codegen_global_asm<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ga: &hir::GlobalAsm) { let asm = CString::new(ga.asm.as_str().as_bytes()).unwrap(); unsafe { diff --git a/src/librustc_trans/attributes.rs b/src/librustc_codegen_llvm/attributes.rs similarity index 93% rename from src/librustc_trans/attributes.rs rename to src/librustc_codegen_llvm/attributes.rs index 5baed57092d..b64e102ba78 100644 --- a/src/librustc_trans/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -11,7 +11,7 @@ use std::ffi::{CStr, CString}; -use rustc::hir::{self, TransFnAttrFlags}; +use rustc::hir::{self, CodegenFnAttrFlags}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::session::Session; @@ -118,34 +118,34 @@ pub fn llvm_target_features(sess: &Session) -> impl Iterator { /// Composite function which sets LLVM attributes for function depending on its AST (#[attribute]) /// attributes. pub fn from_fn_attrs(cx: &CodegenCx, llfn: ValueRef, id: DefId) { - let trans_fn_attrs = cx.tcx.trans_fn_attrs(id); + let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(id); - inline(llfn, trans_fn_attrs.inline); + inline(llfn, codegen_fn_attrs.inline); set_frame_pointer_elimination(cx, llfn); set_probestack(cx, llfn); - if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) { Attribute::Cold.apply_llfn(Function, llfn); } - if trans_fn_attrs.flags.contains(TransFnAttrFlags::NAKED) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) { naked(llfn, true); } - if trans_fn_attrs.flags.contains(TransFnAttrFlags::ALLOCATOR) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) { Attribute::NoAlias.apply_llfn( llvm::AttributePlace::ReturnValue, llfn); } - if trans_fn_attrs.flags.contains(TransFnAttrFlags::UNWIND) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::UNWIND) { unwind(llfn, true); } - if trans_fn_attrs.flags.contains(TransFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) { unwind(llfn, false); } let features = llvm_target_features(cx.tcx.sess) .map(|s| s.to_string()) .chain( - trans_fn_attrs.target_features + codegen_fn_attrs.target_features .iter() .map(|f| { let feature = &*f.as_str(); 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 92% rename from src/librustc_trans/back/link.rs rename to src/librustc_codegen_llvm/back/link.rs index 299075ed03a..dbfd430a3e2 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -24,7 +24,7 @@ use rustc::session::search_paths::PathKind; use rustc::session::Session; use rustc::middle::cstore::{NativeLibrary, LibSource, NativeLibraryKind}; use rustc::middle::dependency_format::Linkage; -use {CrateTranslation, CrateInfo}; +use {CodegenResults, CrateInfo}; use rustc::util::common::time; use rustc::util::fs::fix_windows_verbatim_for_gcc; use rustc::hir::def_id::CrateNum; @@ -52,7 +52,7 @@ pub const METADATA_MODULE_NAME: &'static str = "crate.metadata"; // same as for metadata above, but for allocator shim pub const ALLOCATOR_MODULE_NAME: &'static str = "crate.allocator"; -pub use rustc_trans_utils::link::{find_crate_name, filename_for_input, default_output_for_target, +pub use rustc_codegen_utils::link::{find_crate_name, filename_for_input, default_output_for_target, invalid_output_for_target, build_link_meta, out_filename, check_file_is_writeable}; @@ -141,14 +141,14 @@ pub fn remove(sess: &Session, path: &Path) { /// Perform the linkage portion of the compilation phase. This will generate all /// of the requested outputs for this compilation session. pub(crate) fn link_binary(sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, outputs: &OutputFilenames, crate_name: &str) -> Vec { let mut out_filenames = Vec::new(); for &crate_type in sess.crate_types.borrow().iter() { - // Ignore executable crates if we have -Z no-trans, as they will error. + // Ignore executable crates if we have -Z no-codegen, as they will error. let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata); - if (sess.opts.debugging_opts.no_trans || !sess.opts.output_types.should_trans()) && + if (sess.opts.debugging_opts.no_codegen || !sess.opts.output_types.should_codegen()) && !output_metadata && crate_type == config::CrateTypeExecutable { continue; @@ -159,7 +159,7 @@ pub(crate) fn link_binary(sess: &Session, crate_type, sess.opts.target_triple); } let mut out_files = link_binary_output(sess, - trans, + codegen_results, crate_type, outputs, crate_name); @@ -168,20 +168,20 @@ pub(crate) fn link_binary(sess: &Session, // Remove the temporary object file and metadata if we aren't saving temps if !sess.opts.cg.save_temps { - if sess.opts.output_types.should_trans() && + if sess.opts.output_types.should_codegen() && !preserve_objects_for_their_debuginfo(sess) { - for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) { + for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) { remove(sess, obj); } } - for obj in trans.modules.iter().filter_map(|m| m.bytecode_compressed.as_ref()) { + for obj in codegen_results.modules.iter().filter_map(|m| m.bytecode_compressed.as_ref()) { remove(sess, obj); } - if let Some(ref obj) = trans.metadata_module.object { + if let Some(ref obj) = codegen_results.metadata_module.object { remove(sess, obj); } - if let Some(ref allocator) = trans.allocator_module { + if let Some(ref allocator) = codegen_results.allocator_module { if let Some(ref obj) = allocator.object { remove(sess, obj); } @@ -304,11 +304,11 @@ pub(crate) fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) } fn link_binary_output(sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, crate_type: config::CrateType, outputs: &OutputFilenames, crate_name: &str) -> Vec { - for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) { + for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) { check_file_is_writeable(obj, sess); } @@ -325,7 +325,7 @@ fn link_binary_output(sess: &Session, Ok(tmpdir) => tmpdir, Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)), }; - let metadata = emit_metadata(sess, trans, &metadata_tmpdir); + let metadata = emit_metadata(sess, codegen_results, &metadata_tmpdir); if let Err(e) = fs::rename(metadata, &out_filename) { sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e)); } @@ -337,21 +337,21 @@ fn link_binary_output(sess: &Session, Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)), }; - if outputs.outputs.should_trans() { + if outputs.outputs.should_codegen() { let out_filename = out_filename(sess, crate_type, outputs, crate_name); match crate_type { config::CrateTypeRlib => { link_rlib(sess, - trans, + codegen_results, RlibFlavor::Normal, &out_filename, &tmpdir).build(); } config::CrateTypeStaticlib => { - link_staticlib(sess, trans, &out_filename, &tmpdir); + link_staticlib(sess, codegen_results, &out_filename, &tmpdir); } _ => { - link_natively(sess, crate_type, &out_filename, trans, tmpdir.path()); + link_natively(sess, crate_type, &out_filename, codegen_results, tmpdir.path()); } } out_filenames.push(out_filename); @@ -388,10 +388,10 @@ fn archive_config<'a>(sess: &'a Session, /// building an `.rlib` (stomping over one another), or writing an `.rmeta` into a /// directory being searched for `extern crate` (observing an incomplete file). /// The returned path is the temporary file containing the complete metadata. -fn emit_metadata<'a>(sess: &'a Session, trans: &CrateTranslation, tmpdir: &TempDir) +fn emit_metadata<'a>(sess: &'a Session, codegen_results: &CodegenResults, tmpdir: &TempDir) -> PathBuf { let out_filename = tmpdir.path().join(METADATA_FILENAME); - let result = fs::write(&out_filename, &trans.metadata.raw_data); + let result = fs::write(&out_filename, &codegen_results.metadata.raw_data); if let Err(e) = result { sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e)); @@ -412,14 +412,14 @@ enum RlibFlavor { // all of the object files from native libraries. This is done by unzipping // native libraries and inserting all of the contents into this archive. fn link_rlib<'a>(sess: &'a Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, flavor: RlibFlavor, out_filename: &Path, tmpdir: &TempDir) -> ArchiveBuilder<'a> { info!("preparing rlib to {:?}", out_filename); let mut ab = ArchiveBuilder::new(archive_config(sess, out_filename, None)); - for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) { + for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) { ab.add_file(obj); } @@ -439,7 +439,7 @@ fn link_rlib<'a>(sess: &'a Session, // feature then we'll need to figure out how to record what objects were // loaded from the libraries found here and then encode that into the // metadata of the rlib we're generating somehow. - for lib in trans.crate_info.used_libraries.iter() { + for lib in codegen_results.crate_info.used_libraries.iter() { match lib.kind { NativeLibraryKind::NativeStatic => {} NativeLibraryKind::NativeStaticNobundle | @@ -478,11 +478,15 @@ fn link_rlib<'a>(sess: &'a Session, RlibFlavor::Normal => { // Instead of putting the metadata in an object file section, rlibs // contain the metadata in a separate file. - ab.add_file(&emit_metadata(sess, trans, tmpdir)); + ab.add_file(&emit_metadata(sess, codegen_results, tmpdir)); // For LTO purposes, the bytecode of this library is also inserted // into the archive. - for bytecode in trans.modules.iter().filter_map(|m| m.bytecode_compressed.as_ref()) { + for bytecode in codegen_results + .modules + .iter() + .filter_map(|m| m.bytecode_compressed.as_ref()) + { ab.add_file(bytecode); } @@ -495,7 +499,7 @@ fn link_rlib<'a>(sess: &'a Session, } RlibFlavor::StaticlibBase => { - let obj = trans.allocator_module + let obj = codegen_results.allocator_module .as_ref() .and_then(|m| m.object.as_ref()); if let Some(obj) = obj { @@ -520,19 +524,19 @@ fn link_rlib<'a>(sess: &'a Session, // link in the metadata object file (and also don't prepare the archive with a // metadata file). fn link_staticlib(sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, out_filename: &Path, tempdir: &TempDir) { let mut ab = link_rlib(sess, - trans, + codegen_results, RlibFlavor::StaticlibBase, out_filename, tempdir); let mut all_native_libs = vec![]; - let res = each_linked_rlib(sess, &trans.crate_info, &mut |cnum, path| { - let name = &trans.crate_info.crate_name[&cnum]; - let native_libs = &trans.crate_info.native_libraries[&cnum]; + let res = each_linked_rlib(sess, &codegen_results.crate_info, &mut |cnum, path| { + let name = &codegen_results.crate_info.crate_name[&cnum]; + let native_libs = &codegen_results.crate_info.native_libraries[&cnum]; // Here when we include the rlib into our staticlib we need to make a // decision whether to include the extra object files along the way. @@ -554,10 +558,10 @@ fn link_staticlib(sess: &Session, ab.add_rlib(path, &name.as_str(), is_full_lto_enabled(sess) && - !ignored_for_lto(sess, &trans.crate_info, cnum), + !ignored_for_lto(sess, &codegen_results.crate_info, cnum), skip_object_files).unwrap(); - all_native_libs.extend(trans.crate_info.native_libraries[&cnum].iter().cloned()); + all_native_libs.extend(codegen_results.crate_info.native_libraries[&cnum].iter().cloned()); }); if let Err(e) = res { sess.fatal(&e); @@ -609,7 +613,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLibrary]) { fn link_natively(sess: &Session, crate_type: config::CrateType, out_filename: &Path, - trans: &CrateTranslation, + codegen_results: &CodegenResults, tmpdir: &Path) { info!("preparing {:?} to {:?}", crate_type, out_filename); let flavor = sess.linker_flavor(); @@ -662,9 +666,9 @@ fn link_natively(sess: &Session, } { - let mut linker = trans.linker_info.to_linker(cmd, &sess); + let mut linker = codegen_results.linker_info.to_linker(cmd, &sess); link_args(&mut *linker, sess, crate_type, tmpdir, - out_filename, trans); + out_filename, codegen_results); cmd = linker.finalize(); } if let Some(args) = sess.target.target.options.late_link_args.get(&flavor) { @@ -842,9 +846,9 @@ fn link_natively(sess: &Session, } if sess.opts.target_triple == TargetTriple::from_triple("wasm32-unknown-unknown") { - wasm::rewrite_imports(&out_filename, &trans.crate_info.wasm_imports); + wasm::rewrite_imports(&out_filename, &codegen_results.crate_info.wasm_imports); wasm::add_custom_sections(&out_filename, - &trans.crate_info.wasm_custom_sections); + &codegen_results.crate_info.wasm_custom_sections); } } @@ -995,7 +999,7 @@ fn link_args(cmd: &mut Linker, crate_type: config::CrateType, tmpdir: &Path, out_filename: &Path, - trans: &CrateTranslation) { + codegen_results: &CodegenResults) { // Linker plugins should be specified early in the list of arguments cmd.cross_lang_lto(); @@ -1008,14 +1012,14 @@ fn link_args(cmd: &mut Linker, let t = &sess.target.target; cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); - for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) { + for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) { cmd.add_object(obj); } cmd.output_filename(out_filename); if crate_type == config::CrateTypeExecutable && sess.target.target.options.is_like_windows { - if let Some(ref s) = trans.windows_subsystem { + if let Some(ref s) = codegen_results.windows_subsystem { cmd.subsystem(s); } } @@ -1032,12 +1036,12 @@ fn link_args(cmd: &mut Linker, // object file, so we link that in here. if crate_type == config::CrateTypeDylib || crate_type == config::CrateTypeProcMacro { - if let Some(obj) = trans.metadata_module.object.as_ref() { + if let Some(obj) = codegen_results.metadata_module.object.as_ref() { cmd.add_object(obj); } } - let obj = trans.allocator_module + let obj = codegen_results.allocator_module .as_ref() .and_then(|m| m.object.as_ref()); if let Some(obj) = obj { @@ -1051,7 +1055,7 @@ fn link_args(cmd: &mut Linker, cmd.gc_sections(keep_metadata); } - let used_link_args = &trans.crate_info.link_args; + let used_link_args = &codegen_results.crate_info.link_args; if crate_type == config::CrateTypeExecutable { let mut position_independent_executable = false; @@ -1140,9 +1144,9 @@ fn link_args(cmd: &mut Linker, // link line. And finally upstream native libraries can't depend on anything // in this DAG so far because they're only dylibs and dylibs can only depend // on other dylibs (e.g. other native deps). - add_local_native_libraries(cmd, sess, trans); - add_upstream_rust_crates(cmd, sess, trans, crate_type, tmpdir); - add_upstream_native_libraries(cmd, sess, trans, crate_type); + add_local_native_libraries(cmd, sess, codegen_results); + add_upstream_rust_crates(cmd, sess, codegen_results, crate_type, tmpdir); + add_upstream_native_libraries(cmd, sess, codegen_results, crate_type); // Tell the linker what we're doing. if crate_type != config::CrateTypeExecutable { @@ -1171,7 +1175,7 @@ fn link_args(cmd: &mut Linker, path }; let mut rpath_config = RPathConfig { - used_crates: &trans.crate_info.used_crates_dynamic, + used_crates: &codegen_results.crate_info.used_crates_dynamic, out_filename: out_filename.to_path_buf(), has_rpath: sess.target.target.options.has_rpath, is_like_osx: sess.target.target.options.is_like_osx, @@ -1203,7 +1207,7 @@ fn link_args(cmd: &mut Linker, // may have their native library pulled in above. fn add_local_native_libraries(cmd: &mut Linker, sess: &Session, - trans: &CrateTranslation) { + codegen_results: &CodegenResults) { sess.target_filesearch(PathKind::All).for_each_lib_search_path(|path, k| { match k { PathKind::Framework => { cmd.framework_path(path); } @@ -1211,7 +1215,7 @@ fn add_local_native_libraries(cmd: &mut Linker, } }); - let relevant_libs = trans.crate_info.used_libraries.iter().filter(|l| { + let relevant_libs = codegen_results.crate_info.used_libraries.iter().filter(|l| { relevant_lib(sess, l) }); @@ -1234,7 +1238,7 @@ fn add_local_native_libraries(cmd: &mut Linker, // the intermediate rlib version) fn add_upstream_rust_crates(cmd: &mut Linker, sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, crate_type: config::CrateType, tmpdir: &Path) { // All of the heavy lifting has previously been accomplished by the @@ -1250,7 +1254,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // Invoke get_used_crates to ensure that we get a topological sorting of // crates. - let deps = &trans.crate_info.used_crates_dynamic; + let deps = &codegen_results.crate_info.used_crates_dynamic; // There's a few internal crates in the standard library (aka libcore and // libstd) which actually have a circular dependence upon one another. This @@ -1273,7 +1277,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, let mut group_end = None; let mut group_start = None; let mut end_with = FxHashSet(); - let info = &trans.crate_info; + let info = &codegen_results.crate_info; for &(cnum, _) in deps.iter().rev() { if let Some(missing) = info.missing_lang_items.get(&cnum) { end_with.extend(missing.iter().cloned()); @@ -1305,24 +1309,24 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // We may not pass all crates through to the linker. Some crates may // appear statically in an existing dylib, meaning we'll pick up all the // symbols from the dylib. - let src = &trans.crate_info.used_crate_source[&cnum]; + let src = &codegen_results.crate_info.used_crate_source[&cnum]; match data[cnum.as_usize() - 1] { - _ if trans.crate_info.profiler_runtime == Some(cnum) => { - add_static_crate(cmd, sess, trans, tmpdir, crate_type, cnum); + _ if codegen_results.crate_info.profiler_runtime == Some(cnum) => { + add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum); } - _ if trans.crate_info.sanitizer_runtime == Some(cnum) => { - link_sanitizer_runtime(cmd, sess, trans, tmpdir, cnum); + _ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) => { + link_sanitizer_runtime(cmd, sess, codegen_results, tmpdir, cnum); } // compiler-builtins are always placed last to ensure that they're // linked correctly. - _ if trans.crate_info.compiler_builtins == Some(cnum) => { + _ if codegen_results.crate_info.compiler_builtins == Some(cnum) => { assert!(compiler_builtins.is_none()); compiler_builtins = Some(cnum); } Linkage::NotLinked | Linkage::IncludedFromDylib => {} Linkage::Static => { - add_static_crate(cmd, sess, trans, tmpdir, crate_type, cnum); + add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum); } Linkage::Dynamic => { add_dynamic_crate(cmd, sess, &src.dylib.as_ref().unwrap().0) @@ -1340,7 +1344,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // was already "included" in a dylib (e.g. `libstd` when `-C prefer-dynamic` // is used) if let Some(cnum) = compiler_builtins { - add_static_crate(cmd, sess, trans, tmpdir, crate_type, cnum); + add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum); } // Converts a library file-stem into a cc -l argument @@ -1358,10 +1362,10 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // linking it. fn link_sanitizer_runtime(cmd: &mut Linker, sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, tmpdir: &Path, cnum: CrateNum) { - let src = &trans.crate_info.used_crate_source[&cnum]; + let src = &codegen_results.crate_info.used_crate_source[&cnum]; let cratepath = &src.rlib.as_ref().unwrap().0; if sess.target.target.options.is_like_osx { @@ -1427,23 +1431,23 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // we're at the end of the dependency chain. fn add_static_crate(cmd: &mut Linker, sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, tmpdir: &Path, crate_type: config::CrateType, cnum: CrateNum) { - let src = &trans.crate_info.used_crate_source[&cnum]; + let src = &codegen_results.crate_info.used_crate_source[&cnum]; let cratepath = &src.rlib.as_ref().unwrap().0; // See the comment above in `link_staticlib` and `link_rlib` for why if // there's a static library that's not relevant we skip all object // files. - let native_libs = &trans.crate_info.native_libraries[&cnum]; + let native_libs = &codegen_results.crate_info.native_libraries[&cnum]; let skip_native = native_libs.iter().any(|lib| { lib.kind == NativeLibraryKind::NativeStatic && !relevant_lib(sess, lib) }); if (!is_full_lto_enabled(sess) || - ignored_for_lto(sess, &trans.crate_info, cnum)) && + ignored_for_lto(sess, &codegen_results.crate_info, cnum)) && crate_type != config::CrateTypeDylib && !skip_native { cmd.link_rlib(&fix_windows_verbatim_for_gcc(cratepath)); @@ -1499,7 +1503,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, let skip_because_lto = is_full_lto_enabled(sess) && is_rust_object && (sess.target.target.options.no_builtins || - !trans.crate_info.is_no_builtins.contains(&cnum)); + !codegen_results.crate_info.is_no_builtins.contains(&cnum)); if skip_because_cfg_say_so || skip_because_lto { archive.remove_file(&f); @@ -1521,7 +1525,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // compiler-builtins crate (e.g. compiler-rt) because it'll get // repeatedly linked anyway. if crate_type == config::CrateTypeDylib && - trans.crate_info.compiler_builtins != Some(cnum) { + codegen_results.crate_info.compiler_builtins != Some(cnum) { cmd.link_whole_rlib(&fix_windows_verbatim_for_gcc(&dst)); } else { cmd.link_rlib(&fix_windows_verbatim_for_gcc(&dst)); @@ -1567,7 +1571,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // also be resolved in the target crate. fn add_upstream_native_libraries(cmd: &mut Linker, sess: &Session, - trans: &CrateTranslation, + codegen_results: &CodegenResults, crate_type: config::CrateType) { // Be sure to use a topological sorting of crates because there may be // interdependencies between native libraries. When passing -nodefaultlibs, @@ -1581,9 +1585,9 @@ fn add_upstream_native_libraries(cmd: &mut Linker, let formats = sess.dependency_formats.borrow(); let data = formats.get(&crate_type).unwrap(); - let crates = &trans.crate_info.used_crates_static; + let crates = &codegen_results.crate_info.used_crates_static; for &(cnum, _) in crates { - for lib in trans.crate_info.native_libraries[&cnum].iter() { + for lib in codegen_results.crate_info.native_libraries[&cnum].iter() { if !relevant_lib(sess, &lib) { continue } diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_codegen_llvm/back/linker.rs similarity index 99% rename from src/librustc_trans/back/linker.rs rename to src/librustc_codegen_llvm/back/linker.rs index 2a84ffe79b2..dd1983bdc17 100644 --- a/src/librustc_trans/back/linker.rs +++ b/src/librustc_codegen_llvm/back/linker.rs @@ -641,7 +641,7 @@ impl<'a> Linker for MsvcLinker<'a> { // // The linker will read this `*.def` file and export all the symbols from // the dynamic library. Note that this is not as simple as just exporting - // all the symbols in the current crate (as specified by `trans.reachable`) + // all the symbols in the current crate (as specified by `codegen.reachable`) // but rather we also need to possibly export the symbols of upstream // crates. Upstream rlibs may be linked statically to this dynamic library, // in which case they may continue to transitively be used and hence need diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs similarity index 90% rename from src/librustc_trans/back/lto.rs rename to src/librustc_codegen_llvm/back/lto.rs index bbb5f7eecc8..96eda50d788 100644 --- a/src/librustc_trans/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -21,7 +21,7 @@ use rustc::middle::exported_symbols::SymbolExportLevel; use rustc::session::config::{self, Lto}; use rustc::util::common::time_ext; use time_graph::Timeline; -use {ModuleTranslation, ModuleLlvm, ModuleKind, ModuleSource}; +use {ModuleCodegen, ModuleLlvm, ModuleKind, ModuleSource}; use libc; @@ -42,45 +42,45 @@ pub fn crate_type_allows_lto(crate_type: config::CrateType) -> bool { } } -pub(crate) enum LtoModuleTranslation { +pub(crate) enum LtoModuleCodegen { Fat { - module: Option, + module: Option, _serialized_bitcode: Vec, }, Thin(ThinModule), } -impl LtoModuleTranslation { +impl LtoModuleCodegen { pub fn name(&self) -> &str { match *self { - LtoModuleTranslation::Fat { .. } => "everything", - LtoModuleTranslation::Thin(ref m) => m.name(), + LtoModuleCodegen::Fat { .. } => "everything", + LtoModuleCodegen::Thin(ref m) => m.name(), } } /// Optimize this module within the given codegen context. /// - /// This function is unsafe as it'll return a `ModuleTranslation` still - /// points to LLVM data structures owned by this `LtoModuleTranslation`. + /// This function is unsafe as it'll return a `ModuleCodegen` still + /// points to LLVM data structures owned by this `LtoModuleCodegen`. /// It's intended that the module returned is immediately code generated and /// dropped, and then this LTO module is dropped. pub(crate) unsafe fn optimize(&mut self, cgcx: &CodegenContext, timeline: &mut Timeline) - -> Result + -> Result { match *self { - LtoModuleTranslation::Fat { ref mut module, .. } => { - let trans = module.take().unwrap(); - let config = cgcx.config(trans.kind); - let llmod = trans.llvm().unwrap().llmod; - let tm = trans.llvm().unwrap().tm; + LtoModuleCodegen::Fat { ref mut module, .. } => { + let module = module.take().unwrap(); + let config = cgcx.config(module.kind); + let llmod = module.llvm().unwrap().llmod; + let tm = module.llvm().unwrap().tm; run_pass_manager(cgcx, tm, llmod, config, false); timeline.record("fat-done"); - Ok(trans) + Ok(module) } - LtoModuleTranslation::Thin(ref mut thin) => thin.optimize(cgcx, timeline), + LtoModuleCodegen::Thin(ref mut thin) => thin.optimize(cgcx, timeline), } } @@ -89,16 +89,16 @@ impl LtoModuleTranslation { pub fn cost(&self) -> u64 { match *self { // Only one module with fat LTO, so the cost doesn't matter. - LtoModuleTranslation::Fat { .. } => 0, - LtoModuleTranslation::Thin(ref m) => m.cost(), + LtoModuleCodegen::Fat { .. } => 0, + LtoModuleCodegen::Thin(ref m) => m.cost(), } } } pub(crate) fn run(cgcx: &CodegenContext, - modules: Vec, + modules: Vec, timeline: &mut Timeline) - -> Result, FatalError> + -> Result, FatalError> { let diag_handler = cgcx.create_diag_handler(); let export_threshold = match cgcx.lto { @@ -201,11 +201,11 @@ pub(crate) fn run(cgcx: &CodegenContext, fn fat_lto(cgcx: &CodegenContext, diag_handler: &Handler, - mut modules: Vec, + mut modules: Vec, mut serialized_modules: Vec<(SerializedModule, CString)>, symbol_white_list: &[*const libc::c_char], timeline: &mut Timeline) - -> Result, FatalError> + -> Result, FatalError> { info!("going for a fat lto"); @@ -228,18 +228,18 @@ fn fat_lto(cgcx: &CodegenContext, (cost, i) }) .max() - .expect("must be trans'ing at least one module"); + .expect("must be codegen'ing at least one module"); let module = modules.remove(costliest_module); - let llmod = module.llvm().expect("can't lto pre-translated modules").llmod; + let llmod = module.llvm().expect("can't lto pre-codegened modules").llmod; info!("using {:?} as a base module", module.llmod_id); - // For all other modules we translated we'll need to link them into our own - // bitcode. All modules were translated in their own LLVM context, however, + // For all other modules we codegened we'll need to link them into our own + // bitcode. All modules were codegened in their own LLVM context, however, // and we want to move everything to the same LLVM context. Currently the // way we know of to do that is to serialize them to a string and them parse // them later. Not great but hey, that's why it's "fat" LTO, right? for module in modules { - let llvm = module.llvm().expect("can't lto pre-translated modules"); + let llvm = module.llvm().expect("can't lto pre-codegened modules"); let buffer = ModuleBuffer::new(llvm.llmod); let llmod_id = CString::new(&module.llmod_id[..]).unwrap(); serialized_modules.push((SerializedModule::Local(buffer), llmod_id)); @@ -284,7 +284,7 @@ fn fat_lto(cgcx: &CodegenContext, } timeline.record("passes"); - Ok(vec![LtoModuleTranslation::Fat { + Ok(vec![LtoModuleCodegen::Fat { module: Some(module), _serialized_bitcode: serialized_bitcode, }]) @@ -344,14 +344,14 @@ impl Drop for Linker { /// /// With all that in mind, the function here is designed at specifically just /// calculating the *index* for ThinLTO. This index will then be shared amongst -/// all of the `LtoModuleTranslation` units returned below and destroyed once +/// all of the `LtoModuleCodegen` units returned below and destroyed once /// they all go out of scope. fn thin_lto(diag_handler: &Handler, - modules: Vec, + modules: Vec, serialized_modules: Vec<(SerializedModule, CString)>, symbol_white_list: &[*const libc::c_char], timeline: &mut Timeline) - -> Result, FatalError> + -> Result, FatalError> { unsafe { info!("going for that thin, thin LTO"); @@ -369,7 +369,7 @@ fn thin_lto(diag_handler: &Handler, // analysis! for (i, module) in modules.iter().enumerate() { info!("local module: {} - {}", i, module.llmod_id); - let llvm = module.llvm().expect("can't lto pretranslated module"); + let llvm = module.llvm().expect("can't lto precodegened module"); let name = CString::new(module.llmod_id.clone()).unwrap(); let buffer = ThinBuffer::new(llvm.llmod); thin_modules.push(llvm::ThinLTOModule { @@ -431,7 +431,7 @@ fn thin_lto(diag_handler: &Handler, // Throw our data in an `Arc` as we'll be sharing it across threads. We // also put all memory referenced by the C++ data (buffers, ids, etc) // into the arc as well. After this we'll create a thin module - // translation per module in this data. + // codegen per module in this data. let shared = Arc::new(ThinShared { data, thin_buffers, @@ -439,7 +439,7 @@ fn thin_lto(diag_handler: &Handler, module_names, }); Ok((0..shared.module_names.len()).map(|i| { - LtoModuleTranslation::Thin(ThinModule { + LtoModuleCodegen::Thin(ThinModule { shared: shared.clone(), idx: i, }) @@ -622,7 +622,7 @@ impl ThinModule { } unsafe fn optimize(&mut self, cgcx: &CodegenContext, timeline: &mut Timeline) - -> Result + -> Result { let diag_handler = cgcx.create_diag_handler(); let tm = (cgcx.tm_factory)().map_err(|e| { @@ -632,7 +632,7 @@ impl ThinModule { // Right now the implementation we've got only works over serialized // modules, so we create a fresh new LLVM context and parse the module // into that context. One day, however, we may do this for upstream - // crates but for locally translated modules we may be able to reuse + // crates but for locally codegened modules we may be able to reuse // that LLVM Context and Module. let llcx = llvm::LLVMRustContextCreate(cgcx.fewer_names); let llmod = llvm::LLVMRustParseBitcodeForThinLTO( @@ -645,8 +645,8 @@ impl ThinModule { let msg = format!("failed to parse bitcode for thin LTO module"); return Err(write::llvm_err(&diag_handler, msg)); } - let mtrans = ModuleTranslation { - source: ModuleSource::Translated(ModuleLlvm { + let module = ModuleCodegen { + source: ModuleSource::Codegened(ModuleLlvm { llmod, llcx, tm, @@ -655,7 +655,7 @@ impl ThinModule { name: self.name().to_string(), kind: ModuleKind::Regular, }; - cgcx.save_temp_bitcode(&mtrans, "thin-lto-input"); + cgcx.save_temp_bitcode(&module, "thin-lto-input"); // Before we do much else find the "main" `DICompileUnit` that we'll be // using below. If we find more than one though then rustc has changed @@ -673,7 +673,7 @@ impl ThinModule { // are disabled by removing all landing pads. if cgcx.no_landing_pads { llvm::LLVMRustMarkAllFunctionsNounwind(llmod); - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-nounwind"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-nounwind"); timeline.record("nounwind"); } @@ -689,25 +689,25 @@ impl ThinModule { let msg = format!("failed to prepare thin LTO module"); return Err(write::llvm_err(&diag_handler, msg)) } - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-rename"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-rename"); timeline.record("rename"); if !llvm::LLVMRustPrepareThinLTOResolveWeak(self.shared.data.0, llmod) { let msg = format!("failed to prepare thin LTO module"); return Err(write::llvm_err(&diag_handler, msg)) } - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-resolve"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-resolve"); timeline.record("resolve"); if !llvm::LLVMRustPrepareThinLTOInternalize(self.shared.data.0, llmod) { let msg = format!("failed to prepare thin LTO module"); return Err(write::llvm_err(&diag_handler, msg)) } - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-internalize"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-internalize"); timeline.record("internalize"); if !llvm::LLVMRustPrepareThinLTOImport(self.shared.data.0, llmod) { let msg = format!("failed to prepare thin LTO module"); return Err(write::llvm_err(&diag_handler, msg)) } - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-import"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-import"); timeline.record("import"); // Ok now this is a bit unfortunate. This is also something you won't @@ -740,7 +740,7 @@ impl ThinModule { // so it appears). Hopefully we can remove this once upstream bugs are // fixed in LLVM. llvm::LLVMRustThinLTOPatchDICompileUnit(llmod, cu1); - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-patch"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-patch"); timeline.record("patch"); // Alright now that we've done everything related to the ThinLTO @@ -748,10 +748,10 @@ impl ThinModule { // `run_pass_manager` as the "fat" LTO above except that we tell it to // populate a thin-specific pass manager, which presumably LLVM treats a // little differently. - info!("running thin lto passes over {}", mtrans.name); - let config = cgcx.config(mtrans.kind); + info!("running thin lto passes over {}", module.name); + let config = cgcx.config(module.kind); run_pass_manager(cgcx, tm, llmod, config, true); - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-pm"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-pm"); timeline.record("thin-done"); // FIXME: this is a hack around a bug in LLVM right now. Discovered in @@ -765,9 +765,9 @@ impl ThinModule { // shouldn't be necessary eventually and we can safetly delete these few // lines. llvm::LLVMRustThinLTORemoveAvailableExternally(llmod); - cgcx.save_temp_bitcode(&mtrans, "thin-lto-after-rm-ae"); + cgcx.save_temp_bitcode(&module, "thin-lto-after-rm-ae"); timeline.record("no-ae"); - Ok(mtrans) + Ok(module) } } 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 96% rename from src/librustc_trans/back/symbol_export.rs rename to src/librustc_codegen_llvm/back/symbol_export.rs index d7785522069..81ac684aee2 100644 --- a/src/librustc_trans/back/symbol_export.rs +++ b/src/librustc_codegen_llvm/back/symbol_export.rs @@ -13,7 +13,7 @@ use std::sync::Arc; use monomorphize::Instance; use rustc::hir; -use rustc::hir::TransFnAttrFlags; +use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX}; use rustc::ich::Fingerprint; use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadata_symbol_name}; @@ -63,7 +63,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { assert_eq!(cnum, LOCAL_CRATE); - if !tcx.sess.opts.output_types.should_trans() { + if !tcx.sess.opts.output_types.should_codegen() { return Lrc::new(DefIdMap()) } @@ -118,7 +118,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let def_id = tcx.hir.local_def_id(node_id); let generics = tcx.generics_of(def_id); if !generics.requires_monomorphization(tcx) && - // Functions marked with #[inline] are only ever translated + // Functions marked with #[inline] are only ever codegened // with "internal" linkage and are never exported. !Instance::mono(tcx, def_id).def.requires_local(tcx) { Some(def_id) @@ -195,7 +195,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { assert_eq!(cnum, LOCAL_CRATE); - if !tcx.sess.opts.output_types.should_trans() { + if !tcx.sess.opts.output_types.should_codegen() { return Arc::new(vec![]) } @@ -255,7 +255,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let need_visibility = tcx.sess.target.target.options.dynamic_linking && !tcx.sess.target.target.options.only_cdylib; - let (_, cgus) = tcx.collect_and_partition_translation_items(LOCAL_CRATE); + let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); for (mono_item, &(linkage, visibility)) in cgus.iter() .flat_map(|cgu| cgu.items().iter()) { @@ -383,9 +383,10 @@ fn symbol_export_level(tcx: TyCtxt, sym_def_id: DefId) -> SymbolExportLevel { // special symbols in the standard library for various plumbing between // core/std/allocators/etc. For example symbols used to hook up allocation // are not considered for export - let trans_fn_attrs = tcx.trans_fn_attrs(sym_def_id); - let is_extern = trans_fn_attrs.contains_extern_indicator(); - let std_internal = trans_fn_attrs.flags.contains(TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL); + let codegen_fn_attrs = tcx.codegen_fn_attrs(sym_def_id); + let is_extern = codegen_fn_attrs.contains_extern_indicator(); + let std_internal = + codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL); if is_extern && !std_internal { SymbolExportLevel::C diff --git a/src/librustc_trans/back/wasm.rs b/src/librustc_codegen_llvm/back/wasm.rs similarity index 100% rename from src/librustc_trans/back/wasm.rs rename to src/librustc_codegen_llvm/back/wasm.rs diff --git a/src/librustc_trans/back/write.rs b/src/librustc_codegen_llvm/back/write.rs similarity index 94% rename from src/librustc_trans/back/write.rs rename to src/librustc_codegen_llvm/back/write.rs index acfe7c33028..1151e013131 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -28,7 +28,7 @@ use time_graph::{self, TimeGraph, Timeline}; use llvm; use llvm::{ModuleRef, TargetMachineRef, PassManagerRef, DiagnosticInfoRef}; use llvm::{SMDiagnosticRef, ContextRef}; -use {CrateTranslation, ModuleSource, ModuleTranslation, CompiledModule, ModuleKind}; +use {CodegenResults, ModuleSource, ModuleCodegen, CompiledModule, ModuleKind}; use CrateInfo; use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::ty::TyCtxt; @@ -383,16 +383,16 @@ impl CodegenContext { } } - pub(crate) fn save_temp_bitcode(&self, trans: &ModuleTranslation, name: &str) { + pub(crate) fn save_temp_bitcode(&self, module: &ModuleCodegen, name: &str) { if !self.save_temps { return } unsafe { let ext = format!("{}.bc", name); - let cgu = Some(&trans.name[..]); + let cgu = Some(&module.name[..]); let path = self.output_filenames.temp_path_ext(&ext, cgu); let cstr = path2cstr(&path); - let llmod = trans.llvm().unwrap().llmod; + let llmod = module.llvm().unwrap().llmod; llvm::LLVMWriteBitcodeToFile(llmod, cstr.as_ptr()); } } @@ -491,13 +491,13 @@ unsafe extern "C" fn diagnostic_handler(info: DiagnosticInfoRef, user: *mut c_vo // Unsafe due to LLVM calls. unsafe fn optimize(cgcx: &CodegenContext, diag_handler: &Handler, - mtrans: &ModuleTranslation, + module: &ModuleCodegen, config: &ModuleConfig, timeline: &mut Timeline) -> Result<(), FatalError> { - let (llmod, llcx, tm) = match mtrans.source { - ModuleSource::Translated(ref llvm) => (llvm.llmod, llvm.llcx, llvm.tm), + let (llmod, llcx, tm) = match module.source { + ModuleSource::Codegened(ref llvm) => (llvm.llmod, llvm.llcx, llvm.tm), ModuleSource::Preexisting(_) => { bug!("optimize_and_codegen: called with ModuleSource::Preexisting") } @@ -505,7 +505,7 @@ unsafe fn optimize(cgcx: &CodegenContext, let _handlers = DiagnosticHandlers::new(cgcx, diag_handler, llcx); - let module_name = mtrans.name.clone(); + let module_name = module.name.clone(); let module_name = Some(&module_name[..]); if config.emit_no_opt_bc { @@ -594,12 +594,12 @@ unsafe fn optimize(cgcx: &CodegenContext, } fn generate_lto_work(cgcx: &CodegenContext, - modules: Vec) + modules: Vec) -> Vec<(WorkItem, u64)> { let mut timeline = cgcx.time_graph.as_ref().map(|tg| { - tg.start(TRANS_WORKER_TIMELINE, - TRANS_WORK_PACKAGE_KIND, + tg.start(CODEGEN_WORKER_TIMELINE, + CODEGEN_WORK_PACKAGE_KIND, "generate lto") }).unwrap_or(Timeline::noop()); let lto_modules = lto::run(cgcx, modules, &mut timeline) @@ -613,19 +613,19 @@ fn generate_lto_work(cgcx: &CodegenContext, unsafe fn codegen(cgcx: &CodegenContext, diag_handler: &Handler, - mtrans: ModuleTranslation, + module: ModuleCodegen, config: &ModuleConfig, timeline: &mut Timeline) -> Result { timeline.record("codegen"); - let (llmod, llcx, tm) = match mtrans.source { - ModuleSource::Translated(ref llvm) => (llvm.llmod, llvm.llcx, llvm.tm), + let (llmod, llcx, tm) = match module.source { + ModuleSource::Codegened(ref llvm) => (llvm.llmod, llvm.llcx, llvm.tm), ModuleSource::Preexisting(_) => { bug!("codegen: called with ModuleSource::Preexisting") } }; - let module_name = mtrans.name.clone(); + let module_name = module.name.clone(); let module_name = Some(&module_name[..]); let handlers = DiagnosticHandlers::new(cgcx, diag_handler, llcx); @@ -696,7 +696,7 @@ unsafe fn codegen(cgcx: &CodegenContext, if config.emit_bc_compressed { let dst = bc_out.with_extension(RLIB_BYTECODE_EXTENSION); - let data = bytecode::encode(&mtrans.llmod_id, data); + let data = bytecode::encode(&module.llmod_id, data); if let Err(e) = fs::write(&dst, data) { diag_handler.err(&format!("failed to write bytecode: {}", e)); } @@ -805,7 +805,7 @@ unsafe fn codegen(cgcx: &CodegenContext, } drop(handlers); - Ok(mtrans.into_compiled_module(config.emit_obj, + Ok(module.into_compiled_module(config.emit_obj, config.emit_bc, config.emit_bc_compressed, &cgcx.output_filenames)) @@ -880,13 +880,13 @@ fn need_crate_bitcode_for_rlib(sess: &Session) -> bool { sess.opts.output_types.contains_key(&OutputType::Exe) } -pub fn start_async_translation(tcx: TyCtxt, +pub fn start_async_codegen(tcx: TyCtxt, time_graph: Option, link: LinkMeta, metadata: EncodedMetadata, coordinator_receive: Receiver>, total_cgus: usize) - -> OngoingCrateTranslation { + -> OngoingCodegen { let sess = tcx.sess; let crate_name = tcx.crate_name(LOCAL_CRATE); let no_builtins = attr::contains_name(&tcx.hir.krate().attrs, "no_builtins"); @@ -991,12 +991,12 @@ pub fn start_async_translation(tcx: TyCtxt, allocator_config.time_passes = false; let (shared_emitter, shared_emitter_main) = SharedEmitter::new(); - let (trans_worker_send, trans_worker_receive) = channel(); + let (codegen_worker_send, codegen_worker_receive) = channel(); let coordinator_thread = start_executing_work(tcx, &crate_info, shared_emitter, - trans_worker_send, + codegen_worker_send, coordinator_receive, total_cgus, sess.jobserver.clone(), @@ -1005,7 +1005,7 @@ pub fn start_async_translation(tcx: TyCtxt, Arc::new(metadata_config), Arc::new(allocator_config)); - OngoingCrateTranslation { + OngoingCodegen { crate_name, link, metadata, @@ -1015,7 +1015,7 @@ pub fn start_async_translation(tcx: TyCtxt, time_graph, coordinator_send: tcx.tx_to_llvm_workers.lock().clone(), - trans_worker_receive, + codegen_worker_receive, shared_emitter_main, future: coordinator_thread, output_filenames: tcx.output_filenames(LOCAL_CRATE), @@ -1204,15 +1204,15 @@ fn produce_final_output_artifacts(sess: &Session, // These are used in linking steps and will be cleaned up afterward. } -pub(crate) fn dump_incremental_data(trans: &CrateTranslation) { +pub(crate) fn dump_incremental_data(codegen_results: &CodegenResults) { println!("[incremental] Re-using {} out of {} modules", - trans.modules.iter().filter(|m| m.pre_existing).count(), - trans.modules.len()); + codegen_results.modules.iter().filter(|m| m.pre_existing).count(), + codegen_results.modules.len()); } enum WorkItem { - Optimize(ModuleTranslation), - LTO(lto::LtoModuleTranslation), + Optimize(ModuleCodegen), + LTO(lto::LtoModuleCodegen), } impl WorkItem { @@ -1233,7 +1233,7 @@ impl WorkItem { enum WorkItemResult { Compiled(CompiledModule), - NeedsLTO(ModuleTranslation), + NeedsLTO(ModuleCodegen), } fn execute_work_item(cgcx: &CodegenContext, @@ -1243,8 +1243,8 @@ fn execute_work_item(cgcx: &CodegenContext, { let diag_handler = cgcx.create_diag_handler(); let config = cgcx.config(work_item.kind()); - let mtrans = match work_item { - WorkItem::Optimize(mtrans) => mtrans, + let module = match work_item { + WorkItem::Optimize(module) => module, WorkItem::LTO(mut lto) => { unsafe { let module = lto.optimize(cgcx, timeline)?; @@ -1253,10 +1253,10 @@ fn execute_work_item(cgcx: &CodegenContext, } } }; - let module_name = mtrans.name.clone(); + let module_name = module.name.clone(); - let pre_existing = match mtrans.source { - ModuleSource::Translated(_) => None, + let pre_existing = match module.source { + ModuleSource::Codegened(_) => None, ModuleSource::Preexisting(ref wp) => Some(wp.clone()), }; @@ -1264,7 +1264,7 @@ fn execute_work_item(cgcx: &CodegenContext, let incr_comp_session_dir = cgcx.incr_comp_session_dir .as_ref() .unwrap(); - let name = &mtrans.name; + let name = &module.name; let mut object = None; let mut bytecode = None; let mut bytecode_compressed = None; @@ -1290,7 +1290,7 @@ fn execute_work_item(cgcx: &CodegenContext, let source_file = in_incr_comp_dir(&incr_comp_session_dir, &saved_file); debug!("copying pre-existing module `{}` from {:?} to {}", - mtrans.name, + module.name, source_file, obj_out.display()); match link_or_copy(&source_file, &obj_out) { @@ -1308,7 +1308,7 @@ fn execute_work_item(cgcx: &CodegenContext, assert_eq!(bytecode_compressed.is_some(), config.emit_bc_compressed); Ok(WorkItemResult::Compiled(CompiledModule { - llmod_id: mtrans.llmod_id.clone(), + llmod_id: module.llmod_id.clone(), name: module_name, kind: ModuleKind::Regular, pre_existing: true, @@ -1320,7 +1320,7 @@ fn execute_work_item(cgcx: &CodegenContext, debug!("llvm-optimizing {:?}", module_name); unsafe { - optimize(cgcx, &diag_handler, &mtrans, config, timeline)?; + optimize(cgcx, &diag_handler, &module, config, timeline)?; // After we've done the initial round of optimizations we need to // decide whether to synchronously codegen this module or ship it @@ -1328,7 +1328,7 @@ fn execute_work_item(cgcx: &CodegenContext, // has to wait for all the initial modules to be optimized). // // Here we dispatch based on the `cgcx.lto` and kind of module we're - // translating... + // codegenning... let needs_lto = match cgcx.lto { Lto::No => false, @@ -1353,14 +1353,14 @@ fn execute_work_item(cgcx: &CodegenContext, // Additionally here's where we also factor in the current LLVM // version. If it doesn't support ThinLTO we skip this. Lto::ThinLocal => { - mtrans.kind != ModuleKind::Allocator && + module.kind != ModuleKind::Allocator && llvm::LLVMRustThinLTOAvailable() } }; // Metadata modules never participate in LTO regardless of the lto // settings. - let needs_lto = needs_lto && mtrans.kind != ModuleKind::Metadata; + let needs_lto = needs_lto && module.kind != ModuleKind::Metadata; // Don't run LTO passes when cross-lang LTO is enabled. The linker // will do that for us in this case. @@ -1368,9 +1368,9 @@ fn execute_work_item(cgcx: &CodegenContext, !cgcx.opts.debugging_opts.cross_lang_lto.embed_bitcode(); if needs_lto { - Ok(WorkItemResult::NeedsLTO(mtrans)) + Ok(WorkItemResult::NeedsLTO(module)) } else { - let module = codegen(cgcx, &diag_handler, mtrans, config, timeline)?; + let module = codegen(cgcx, &diag_handler, module, config, timeline)?; Ok(WorkItemResult::Compiled(module)) } } @@ -1380,19 +1380,19 @@ fn execute_work_item(cgcx: &CodegenContext, enum Message { Token(io::Result), NeedsLTO { - result: ModuleTranslation, + result: ModuleCodegen, worker_id: usize, }, Done { result: Result, worker_id: usize, }, - TranslationDone { + CodegenDone { llvm_work_item: WorkItem, cost: u64, }, - TranslationComplete, - TranslateItem, + CodegenComplete, + CodegenItem, } struct Diagnostic { @@ -1404,14 +1404,14 @@ struct Diagnostic { #[derive(PartialEq, Clone, Copy, Debug)] enum MainThreadWorkerState { Idle, - Translating, + Codegenning, LLVMing, } fn start_executing_work(tcx: TyCtxt, crate_info: &CrateInfo, shared_emitter: SharedEmitter, - trans_worker_send: Sender, + codegen_worker_send: Sender, coordinator_receive: Receiver>, total_cgus: usize, jobserver: Client, @@ -1520,7 +1520,7 @@ fn start_executing_work(tcx: TyCtxt, // - Error reporting only can happen on the main thread because that's the // only place where we have access to the compiler `Session`. // - LLVM work can be done on any thread. - // - Translation can only happen on the main thread. + // - Codegen can only happen on the main thread. // - Each thread doing substantial work most be in possession of a `Token` // from the `Jobserver`. // - The compiler process always holds one `Token`. Any additional `Tokens` @@ -1536,7 +1536,7 @@ fn start_executing_work(tcx: TyCtxt, // any error messages it has received. It might even abort compilation if // has received a fatal error. In this case we rely on all other threads // being torn down automatically with the main thread. - // Since the main thread will often be busy doing translation work, error + // Since the main thread will often be busy doing codegen work, error // reporting will be somewhat delayed, since the message queue can only be // checked in between to work packages. // @@ -1552,10 +1552,10 @@ fn start_executing_work(tcx: TyCtxt, // thread about what work to do when, and it will spawn off LLVM worker // threads as open LLVM WorkItems become available. // - // The job of the main thread is to translate CGUs into LLVM work package + // The job of the main thread is to codegen CGUs into LLVM work package // (since the main thread is the only thread that can do this). The main // thread will block until it receives a message from the coordinator, upon - // which it will translate one CGU, send it to the coordinator and block + // which it will codegen one CGU, send it to the coordinator and block // again. This way the coordinator can control what the main thread is // doing. // @@ -1573,7 +1573,7 @@ fn start_executing_work(tcx: TyCtxt, // if possible. These two goals are at odds with each other: If memory // consumption were not an issue, we could just let the main thread produce // LLVM WorkItems at full speed, assuring maximal utilization of - // Tokens/LLVM worker threads. However, since translation usual is faster + // Tokens/LLVM worker threads. However, since codegen usual is faster // than LLVM processing, the queue of LLVM WorkItems would fill up and each // WorkItem potentially holds on to a substantial amount of memory. // @@ -1637,7 +1637,7 @@ fn start_executing_work(tcx: TyCtxt, // The final job the coordinator thread is responsible for is managing LTO // and how that works. When LTO is requested what we'll to is collect all // optimized LLVM modules into a local vector on the coordinator. Once all - // modules have been translated and optimized we hand this to the `lto` + // modules have been codegened and optimized we hand this to the `lto` // module for further optimization. The `lto` module will return back a list // of more modules to work on, which the coordinator will continue to spawn // work for. @@ -1663,15 +1663,15 @@ fn start_executing_work(tcx: TyCtxt, }; // This is where we collect codegen units that have gone all the way - // through translation and LLVM. + // through codegen and LLVM. let mut compiled_modules = vec![]; let mut compiled_metadata_module = None; let mut compiled_allocator_module = None; let mut needs_lto = Vec::new(); let mut started_lto = false; - // This flag tracks whether all items have gone through translations - let mut translation_done = false; + // This flag tracks whether all items have gone through codegens + let mut codegen_done = false; // This is the queue of LLVM work items that still need processing. let mut work_items = Vec::<(WorkItem, u64)>::new(); @@ -1687,23 +1687,23 @@ fn start_executing_work(tcx: TyCtxt, // Run the message loop while there's still anything that needs message // processing: - while !translation_done || + while !codegen_done || work_items.len() > 0 || running > 0 || needs_lto.len() > 0 || main_thread_worker_state != MainThreadWorkerState::Idle { - // While there are still CGUs to be translated, the coordinator has + // While there are still CGUs to be codegened, the coordinator has // to decide how to utilize the compiler processes implicit Token: - // For translating more CGU or for running them through LLVM. - if !translation_done { + // For codegenning more CGU or for running them through LLVM. + if !codegen_done { if main_thread_worker_state == MainThreadWorkerState::Idle { if !queue_full_enough(work_items.len(), running, max_workers) { - // The queue is not full enough, translate more items: - if let Err(_) = trans_worker_send.send(Message::TranslateItem) { - panic!("Could not send Message::TranslateItem to main thread") + // The queue is not full enough, codegen more items: + if let Err(_) = codegen_worker_send.send(Message::CodegenItem) { + panic!("Could not send Message::CodegenItem to main thread") } - main_thread_worker_state = MainThreadWorkerState::Translating; + main_thread_worker_state = MainThreadWorkerState::Codegenning; } else { // The queue is full enough to not let the worker // threads starve. Use the implicit Token to do some @@ -1721,7 +1721,7 @@ fn start_executing_work(tcx: TyCtxt, } } } else { - // If we've finished everything related to normal translation + // If we've finished everything related to normal codegen // then it must be the case that we've got some LTO work to do. // Perform the serial work here of figuring out what we're // going to LTO and then push a bunch of work items onto our @@ -1742,7 +1742,7 @@ fn start_executing_work(tcx: TyCtxt, } } - // In this branch, we know that everything has been translated, + // In this branch, we know that everything has been codegened, // so it's just a matter of determining whether the implicit // Token is free to use for LLVM work. match main_thread_worker_state { @@ -1768,9 +1768,9 @@ fn start_executing_work(tcx: TyCtxt, main_thread_worker_state = MainThreadWorkerState::LLVMing; } } - MainThreadWorkerState::Translating => { - bug!("trans worker should not be translating after \ - translation was already completed") + MainThreadWorkerState::Codegenning => { + bug!("codegen worker should not be codegenning after \ + codegen was already completed") } MainThreadWorkerState::LLVMing => { // Already making good use of that token @@ -1812,7 +1812,7 @@ fn start_executing_work(tcx: TyCtxt, // If the main thread token is used for LLVM work // at the moment, we turn that thread into a regular // LLVM worker thread, so the main thread is free - // to react to translation demand. + // to react to codegen demand. main_thread_worker_state = MainThreadWorkerState::Idle; running += 1; } @@ -1826,7 +1826,7 @@ fn start_executing_work(tcx: TyCtxt, } } - Message::TranslationDone { llvm_work_item, cost } => { + Message::CodegenDone { llvm_work_item, cost } => { // We keep the queue sorted by estimated processing cost, // so that more expensive items are processed earlier. This // is good for throughput as it gives the main thread more @@ -1844,14 +1844,14 @@ fn start_executing_work(tcx: TyCtxt, helper.request_token(); assert_eq!(main_thread_worker_state, - MainThreadWorkerState::Translating); + MainThreadWorkerState::Codegenning); main_thread_worker_state = MainThreadWorkerState::Idle; } - Message::TranslationComplete => { - translation_done = true; + Message::CodegenComplete => { + codegen_done = true; assert_eq!(main_thread_worker_state, - MainThreadWorkerState::Translating); + MainThreadWorkerState::Codegenning); main_thread_worker_state = MainThreadWorkerState::Idle; } @@ -1902,8 +1902,8 @@ fn start_executing_work(tcx: TyCtxt, // Exit the coordinator thread return Err(()) } - Message::TranslateItem => { - bug!("the coordinator should not receive translation requests") + Message::CodegenItem => { + bug!("the coordinator should not receive codegen requests") } } } @@ -1934,7 +1934,7 @@ fn start_executing_work(tcx: TyCtxt, }); // A heuristic that determines if we have enough LLVM WorkItems in the - // queue so that the main thread can do LLVM work instead of translation + // queue so that the main thread can do LLVM work instead of codegen fn queue_full_enough(items_in_queue: usize, workers_running: usize, max_workers: usize) -> bool { @@ -1955,10 +1955,10 @@ fn start_executing_work(tcx: TyCtxt, } } -pub const TRANS_WORKER_ID: usize = ::std::usize::MAX; -pub const TRANS_WORKER_TIMELINE: time_graph::TimelineId = - time_graph::TimelineId(TRANS_WORKER_ID); -pub const TRANS_WORK_PACKAGE_KIND: time_graph::WorkPackageKind = +pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; +pub const CODEGEN_WORKER_TIMELINE: time_graph::TimelineId = + time_graph::TimelineId(CODEGEN_WORKER_ID); +pub const CODEGEN_WORK_PACKAGE_KIND: time_graph::WorkPackageKind = time_graph::WorkPackageKind(&["#DE9597", "#FED1D3", "#FDC5C7", "#B46668", "#88494B"]); const LLVM_WORK_PACKAGE_KIND: time_graph::WorkPackageKind = time_graph::WorkPackageKind(&["#7DB67A", "#C6EEC4", "#ACDAAA", "#579354", "#3E6F3C"]); @@ -2231,7 +2231,7 @@ impl SharedEmitterMain { } } -pub struct OngoingCrateTranslation { +pub struct OngoingCodegen { crate_name: Symbol, link: LinkMeta, metadata: EncodedMetadata, @@ -2240,17 +2240,17 @@ pub struct OngoingCrateTranslation { crate_info: CrateInfo, time_graph: Option, coordinator_send: Sender>, - trans_worker_receive: Receiver, + codegen_worker_receive: Receiver, shared_emitter_main: SharedEmitterMain, future: thread::JoinHandle>, output_filenames: Arc, } -impl OngoingCrateTranslation { +impl OngoingCodegen { pub(crate) fn join( self, sess: &Session - ) -> (CrateTranslation, FxHashMap) { + ) -> (CodegenResults, FxHashMap) { self.shared_emitter_main.check(sess, true); let compiled_modules = match self.future.join() { Ok(Ok(compiled_modules)) => compiled_modules, @@ -2259,7 +2259,7 @@ impl OngoingCrateTranslation { panic!("expected abort due to worker thread errors") }, Err(_) => { - sess.fatal("Error during translation/LLVM phase."); + sess.fatal("Error during codegen/LLVM phase."); } }; @@ -2282,7 +2282,7 @@ impl OngoingCrateTranslation { unsafe { llvm::LLVMRustPrintPassTimings(); } } - let trans = CrateTranslation { + (CodegenResults { crate_name: self.crate_name, link: self.link, metadata: self.metadata, @@ -2293,35 +2293,33 @@ impl OngoingCrateTranslation { modules: compiled_modules.modules, allocator_module: compiled_modules.allocator_module, metadata_module: compiled_modules.metadata_module, - }; - - (trans, work_products) + }, work_products) } - pub(crate) fn submit_pre_translated_module_to_llvm(&self, + pub(crate) fn submit_pre_codegened_module_to_llvm(&self, tcx: TyCtxt, - mtrans: ModuleTranslation) { - self.wait_for_signal_to_translate_item(); + module: ModuleCodegen) { + self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); // These are generally cheap and won't through off scheduling. let cost = 0; - submit_translated_module_to_llvm(tcx, mtrans, cost); + submit_codegened_module_to_llvm(tcx, module, cost); } - pub fn translation_finished(&self, tcx: TyCtxt) { - self.wait_for_signal_to_translate_item(); + pub fn codegen_finished(&self, tcx: TyCtxt) { + self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); - drop(self.coordinator_send.send(Box::new(Message::TranslationComplete))); + drop(self.coordinator_send.send(Box::new(Message::CodegenComplete))); } pub fn check_for_errors(&self, sess: &Session) { self.shared_emitter_main.check(sess, false); } - pub fn wait_for_signal_to_translate_item(&self) { - match self.trans_worker_receive.recv() { - Ok(Message::TranslateItem) => { + pub fn wait_for_signal_to_codegen_item(&self) { + match self.codegen_worker_receive.recv() { + Ok(Message::CodegenItem) => { // Nothing to do } Ok(_) => panic!("unexpected message"), @@ -2333,11 +2331,11 @@ impl OngoingCrateTranslation { } } -pub(crate) fn submit_translated_module_to_llvm(tcx: TyCtxt, - mtrans: ModuleTranslation, +pub(crate) fn submit_codegened_module_to_llvm(tcx: TyCtxt, + module: ModuleCodegen, cost: u64) { - let llvm_work_item = WorkItem::Optimize(mtrans); - drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::TranslationDone { + let llvm_work_item = WorkItem::Optimize(module); + drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone { llvm_work_item, cost, }))); diff --git a/src/librustc_trans/base.rs b/src/librustc_codegen_llvm/base.rs similarity index 90% rename from src/librustc_trans/base.rs rename to src/librustc_codegen_llvm/base.rs index feca36fa6c2..d04cb72d52d 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Translate the completed AST to the LLVM IR. +//! Codegen the completed AST to the LLVM IR. //! -//! Some functions here, such as trans_block and trans_expr, return a value -- -//! the result of the translation to LLVM -- while others, such as trans_fn -//! and trans_item, are called only for the side effect of adding a +//! Some functions here, such as codegen_block and codegen_expr, return a value -- +//! the result of the codegen to LLVM -- while others, such as codegen_fn +//! and mono_item, are called only for the side effect of adding a //! particular definition to the LLVM IR output we're producing. //! -//! Hopefully useful general knowledge about trans: +//! Hopefully useful general knowledge about codegen: //! //! * There's no way to find out the Ty type of a ValueRef. Doing so //! would be "trying to get the eggs out of an omelette" (credit: @@ -25,12 +25,12 @@ use super::ModuleLlvm; use super::ModuleSource; -use super::ModuleTranslation; +use super::ModuleCodegen; use super::ModuleKind; use abi; use back::link; -use back::write::{self, OngoingCrateTranslation, create_target_machine}; +use back::write::{self, OngoingCodegen, create_target_machine}; use llvm::{ContextRef, ModuleRef, ValueRef, Vector, get_param}; use llvm; use metadata; @@ -66,9 +66,9 @@ use meth; use mir; use monomorphize::Instance; use monomorphize::partitioning::{self, PartitioningStrategy, CodegenUnit, CodegenUnitExt}; -use rustc_trans_utils::symbol_names_test; +use rustc_codegen_utils::symbol_names_test; use time_graph; -use trans_item::{MonoItem, BaseMonoItemExt, MonoItemExt, DefPathBasedNames}; +use mono_item::{MonoItem, BaseMonoItemExt, MonoItemExt, DefPathBasedNames}; use type_::Type; use type_of::LayoutLlvmExt; use rustc::util::nodemap::{FxHashMap, FxHashSet, DefIdSet}; @@ -93,7 +93,7 @@ use syntax::ast; use mir::operand::OperandValue; -pub use rustc_trans_utils::check_for_rustc_errors_attr; +pub use rustc_codegen_utils::check_for_rustc_errors_attr; pub struct StatRecorder<'a, 'tcx: 'a> { cx: &'a CodegenCx<'a, 'tcx>, @@ -114,7 +114,7 @@ impl<'a, 'tcx> StatRecorder<'a, 'tcx> { impl<'a, 'tcx> Drop for StatRecorder<'a, 'tcx> { fn drop(&mut self) { - if self.cx.sess().trans_stats() { + if self.cx.sess().codegen_stats() { let mut stats = self.cx.stats.borrow_mut(); let iend = stats.n_llvm_insns; stats.fn_stats.push((self.name.take().unwrap(), iend - self.istart)); @@ -458,8 +458,8 @@ pub fn call_memset<'a, 'tcx>(bx: &Builder<'a, 'tcx>, bx.call(llintrinsicfn, &[ptr, fill_byte, size, align, volatile], None) } -pub fn trans_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'tcx>) { - let _s = if cx.sess().trans_stats() { +pub fn codegen_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'tcx>) { + let _s = if cx.sess().codegen_stats() { let mut instance_name = String::new(); DefPathBasedNames::new(cx.tcx, true, true) .push_def_path(instance.def_id(), &mut instance_name); @@ -471,7 +471,7 @@ pub fn trans_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'tc // this is an info! to allow collecting monomorphization statistics // and to allow finding the last function before LLVM aborts from // release builds. - info!("trans_instance({})", instance); + info!("codegen_instance({})", instance); let fn_ty = instance.ty(cx.tcx); let sig = common::ty_fn_sig(cx, fn_ty); @@ -506,7 +506,7 @@ pub fn trans_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'tc } let mir = cx.tcx.instance_mir(instance.def); - mir::trans_mir(cx, lldecl, &mir, instance, sig); + mir::codegen_mir(cx, lldecl, &mir, instance, sig); } pub fn set_link_section(cx: &CodegenCx, @@ -712,9 +712,9 @@ pub fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter { } } -pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, rx: mpsc::Receiver>) - -> OngoingCrateTranslation { + -> OngoingCodegen { check_for_rustc_errors_attr(tcx); @@ -734,17 +734,17 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let crate_hash = tcx.crate_hash(LOCAL_CRATE); let link_meta = link::build_link_meta(crate_hash); - // Translate the metadata. + // Codegen the metadata. let llmod_id = "metadata"; let (metadata_llcx, metadata_llmod, metadata) = time(tcx.sess, "write metadata", || { write_metadata(tcx, llmod_id, &link_meta) }); - let metadata_module = ModuleTranslation { + let metadata_module = ModuleCodegen { name: link::METADATA_MODULE_NAME.to_string(), llmod_id: llmod_id.to_string(), - source: ModuleSource::Translated(ModuleLlvm { + source: ModuleSource::Codegened(ModuleLlvm { llcx: metadata_llcx, llmod: metadata_llmod, tm: create_target_machine(tcx.sess, false), @@ -752,16 +752,16 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, kind: ModuleKind::Metadata, }; - let time_graph = if tcx.sess.opts.debugging_opts.trans_time_graph { + let time_graph = if tcx.sess.opts.debugging_opts.codegen_time_graph { Some(time_graph::TimeGraph::new()) } else { None }; - // Skip crate items and just output metadata in -Z no-trans mode. - if tcx.sess.opts.debugging_opts.no_trans || - !tcx.sess.opts.output_types.should_trans() { - let ongoing_translation = write::start_async_translation( + // Skip crate items and just output metadata in -Z no-codegen mode. + if tcx.sess.opts.debugging_opts.no_codegen || + !tcx.sess.opts.output_types.should_codegen() { + let ongoing_codegen = write::start_async_codegen( tcx, time_graph.clone(), link_meta, @@ -769,20 +769,20 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, rx, 1); - ongoing_translation.submit_pre_translated_module_to_llvm(tcx, metadata_module); - ongoing_translation.translation_finished(tcx); + ongoing_codegen.submit_pre_codegened_module_to_llvm(tcx, metadata_module); + ongoing_codegen.codegen_finished(tcx); assert_and_save_dep_graph(tcx); - ongoing_translation.check_for_errors(tcx.sess); + ongoing_codegen.check_for_errors(tcx.sess); - return ongoing_translation; + return ongoing_codegen; } - // Run the translation item collector and partition the collected items into + // Run the monomorphization collector and partition the collected items into // codegen units. let codegen_units = - tcx.collect_and_partition_translation_items(LOCAL_CRATE).1; + tcx.collect_and_partition_mono_items(LOCAL_CRATE).1; let codegen_units = (*codegen_units).clone(); // Force all codegen_unit queries so they are already either red or green @@ -796,7 +796,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - let ongoing_translation = write::start_async_translation( + let ongoing_codegen = write::start_async_codegen( tcx, time_graph.clone(), link_meta, @@ -804,7 +804,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, rx, codegen_units.len()); - // Translate an allocator shim, if any + // Codegen an allocator shim, if any let allocator_module = if let Some(kind) = *tcx.sess.allocator_kind.get() { unsafe { let llmod_id = "allocator"; @@ -816,13 +816,13 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tm: create_target_machine(tcx.sess, false), }; time(tcx.sess, "write allocator module", || { - allocator::trans(tcx, &modules, kind) + allocator::codegen(tcx, &modules, kind) }); - Some(ModuleTranslation { + Some(ModuleCodegen { name: link::ALLOCATOR_MODULE_NAME.to_string(), llmod_id: llmod_id.to_string(), - source: ModuleSource::Translated(modules), + source: ModuleSource::Codegened(modules), kind: ModuleKind::Allocator, }) } @@ -831,10 +831,10 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; if let Some(allocator_module) = allocator_module { - ongoing_translation.submit_pre_translated_module_to_llvm(tcx, allocator_module); + ongoing_codegen.submit_pre_codegened_module_to_llvm(tcx, allocator_module); } - ongoing_translation.submit_pre_translated_module_to_llvm(tcx, metadata_module); + ongoing_codegen.submit_pre_codegened_module_to_llvm(tcx, metadata_module); // We sort the codegen units by size. This way we can schedule work for LLVM // a bit more efficiently. @@ -844,12 +844,12 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, codegen_units }; - let mut total_trans_time = Duration::new(0, 0); + let mut total_codegen_time = Duration::new(0, 0); let mut all_stats = Stats::default(); for cgu in codegen_units.into_iter() { - ongoing_translation.wait_for_signal_to_translate_item(); - ongoing_translation.check_for_errors(tcx.sess); + ongoing_codegen.wait_for_signal_to_codegen_item(); + ongoing_codegen.check_for_errors(tcx.sess); // First, if incremental compilation is enabled, we try to re-use the // codegen unit from the cache. @@ -878,14 +878,14 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // 1. http://llvm.org/bugs/show_bug.cgi?id=11479 let llmod_id = format!("{}.rs", cgu.name()); - let module = ModuleTranslation { + let module = ModuleCodegen { name: cgu.name().to_string(), source: ModuleSource::Preexisting(buf), kind: ModuleKind::Regular, llmod_id, }; tcx.dep_graph.mark_loaded_from_cache(dep_node_index, true); - write::submit_translated_module_to_llvm(tcx, module, 0); + write::submit_codegened_module_to_llvm(tcx, module, 0); // Continue to next cgu, this one is done. continue } @@ -896,23 +896,23 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } let _timing_guard = time_graph.as_ref().map(|time_graph| { - time_graph.start(write::TRANS_WORKER_TIMELINE, - write::TRANS_WORK_PACKAGE_KIND, + time_graph.start(write::CODEGEN_WORKER_TIMELINE, + write::CODEGEN_WORK_PACKAGE_KIND, &format!("codegen {}", cgu.name())) }); let start_time = Instant::now(); all_stats.extend(tcx.compile_codegen_unit(*cgu.name())); - total_trans_time += start_time.elapsed(); - ongoing_translation.check_for_errors(tcx.sess); + total_codegen_time += start_time.elapsed(); + ongoing_codegen.check_for_errors(tcx.sess); } - ongoing_translation.translation_finished(tcx); + ongoing_codegen.codegen_finished(tcx); - // Since the main thread is sometimes blocked during trans, we keep track + // Since the main thread is sometimes blocked during codegen, we keep track // -Ztime-passes output manually. print_time_passes_entry(tcx.sess.time_passes(), - "translate to LLVM IR", - total_trans_time); + "codegen to LLVM IR", + total_codegen_time); if tcx.sess.opts.incremental.is_some() { ::rustc_incremental::assert_module_sources::assert_module_sources(tcx); @@ -920,8 +920,8 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, symbol_names_test::report_symbol_names(tcx); - if tcx.sess.trans_stats() { - println!("--- trans stats ---"); + if tcx.sess.codegen_stats() { + println!("--- codegen stats ---"); println!("n_glues_created: {}", all_stats.n_glues_created); println!("n_null_glues: {}", all_stats.n_null_glues); println!("n_real_glues: {}", all_stats.n_real_glues); @@ -942,10 +942,10 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - ongoing_translation.check_for_errors(tcx.sess); + ongoing_codegen.check_for_errors(tcx.sess); assert_and_save_dep_graph(tcx); - ongoing_translation + ongoing_codegen } fn assert_and_save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { @@ -958,14 +958,14 @@ fn assert_and_save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { || rustc_incremental::save_dep_graph(tcx)); } -fn collect_and_partition_translation_items<'a, 'tcx>( +fn collect_and_partition_mono_items<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum, ) -> (Arc, Arc>>>) { assert_eq!(cnum, LOCAL_CRATE); - let collection_mode = match tcx.sess.opts.debugging_opts.print_trans_items { + let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items { Some(ref s) => { let mode_string = s.to_lowercase(); let mode_string = mode_string.trim(); @@ -992,7 +992,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>( }; let (items, inlining_map) = - time(tcx.sess, "translation item collection", || { + time(tcx.sess, "monomorphization collection", || { collector::collect_crate_mono_items(tcx, collection_mode) }); @@ -1016,20 +1016,20 @@ fn collect_and_partition_translation_items<'a, 'tcx>( .collect::>() }); - let translation_items: DefIdSet = items.iter().filter_map(|trans_item| { - match *trans_item { + let mono_items: DefIdSet = items.iter().filter_map(|mono_item| { + match *mono_item { MonoItem::Fn(ref instance) => Some(instance.def_id()), MonoItem::Static(def_id) => Some(def_id), _ => None, } }).collect(); - if tcx.sess.opts.debugging_opts.print_trans_items.is_some() { + if tcx.sess.opts.debugging_opts.print_mono_items.is_some() { let mut item_to_cgus = FxHashMap(); for cgu in &codegen_units { - for (&trans_item, &linkage) in cgu.items() { - item_to_cgus.entry(trans_item) + for (&mono_item, &linkage) in cgu.items() { + item_to_cgus.entry(mono_item) .or_insert(Vec::new()) .push((cgu.name().clone(), linkage)); } @@ -1073,11 +1073,11 @@ fn collect_and_partition_translation_items<'a, 'tcx>( item_keys.sort(); for item in item_keys { - println!("TRANS_ITEM {}", item); + println!("MONO_ITEM {}", item); } } - (Arc::new(translation_items), Arc::new(codegen_units)) + (Arc::new(mono_items), Arc::new(codegen_units)) } impl CrateInfo { @@ -1174,10 +1174,10 @@ impl CrateInfo { } } -fn is_translated_item(tcx: TyCtxt, id: DefId) -> bool { - let (all_trans_items, _) = - tcx.collect_and_partition_translation_items(LOCAL_CRATE); - all_trans_items.contains(&id) +fn is_codegened_item(tcx: TyCtxt, id: DefId) -> bool { + let (all_mono_items, _) = + tcx.collect_and_partition_mono_items(LOCAL_CRATE); + all_mono_items.contains(&id) } fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -1185,23 +1185,23 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let cgu = tcx.codegen_unit(cgu); let start_time = Instant::now(); - let (stats, module) = module_translation(tcx, cgu); - let time_to_translate = start_time.elapsed(); + let (stats, module) = module_codegen(tcx, cgu); + let time_to_codegen = start_time.elapsed(); // We assume that the cost to run LLVM on a CGU is proportional to - // the time we needed for translating it. - let cost = time_to_translate.as_secs() * 1_000_000_000 + - time_to_translate.subsec_nanos() as u64; + // the time we needed for codegenning it. + let cost = time_to_codegen.as_secs() * 1_000_000_000 + + time_to_codegen.subsec_nanos() as u64; - write::submit_translated_module_to_llvm(tcx, + write::submit_codegened_module_to_llvm(tcx, module, cost); return stats; - fn module_translation<'a, 'tcx>( + fn module_codegen<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, cgu: Arc>) - -> (Stats, ModuleTranslation) + -> (Stats, ModuleCodegen) { let cgu_name = cgu.name().to_string(); @@ -1218,18 +1218,18 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.crate_disambiguator(LOCAL_CRATE) .to_fingerprint().to_hex()); - // Instantiate translation items without filling out definitions yet... + // Instantiate monomorphizations without filling out definitions yet... let cx = CodegenCx::new(tcx, cgu, &llmod_id); let module = { - let trans_items = cx.codegen_unit + let mono_items = cx.codegen_unit .items_in_deterministic_order(cx.tcx); - for &(trans_item, (linkage, visibility)) in &trans_items { - trans_item.predefine(&cx, linkage, visibility); + for &(mono_item, (linkage, visibility)) in &mono_items { + mono_item.predefine(&cx, linkage, visibility); } // ... and now that we have everything pre-defined, fill out those definitions. - for &(trans_item, _) in &trans_items { - trans_item.define(&cx); + for &(mono_item, _) in &mono_items { + mono_item.define(&cx); } // If this codegen unit contains the main function, also create the @@ -1273,9 +1273,9 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tm: create_target_machine(cx.sess(), false), }; - ModuleTranslation { + ModuleCodegen { name: cgu_name, - source: ModuleSource::Translated(llvm_module), + source: ModuleSource::Codegened(llvm_module), kind: ModuleKind::Regular, llmod_id, } @@ -1286,13 +1286,13 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } pub fn provide(providers: &mut Providers) { - providers.collect_and_partition_translation_items = - collect_and_partition_translation_items; + providers.collect_and_partition_mono_items = + collect_and_partition_mono_items; - providers.is_translated_item = is_translated_item; + providers.is_codegened_item = is_codegened_item; providers.codegen_unit = |tcx, name| { - let (_, all) = tcx.collect_and_partition_translation_items(LOCAL_CRATE); + let (_, all) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); all.iter() .find(|cgu| *cgu.name() == name) .cloned() @@ -1369,9 +1369,9 @@ pub fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility { mod temp_stable_hash_impls { use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, HashStable}; - use ModuleTranslation; + use ModuleCodegen; - impl HashStable for ModuleTranslation { + impl HashStable for ModuleCodegen { fn hash_stable(&self, _: &mut HCX, _: &mut StableHasher) { 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 99% rename from src/librustc_trans/builder.rs rename to src/librustc_codegen_llvm/builder.rs index 4153c61e526..7b4998e8588 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -108,7 +108,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } fn count_insn(&self, category: &str) { - if self.cx.sess().trans_stats() { + if self.cx.sess().codegen_stats() { self.cx.stats.borrow_mut().n_llvm_insns += 1; } if self.cx.sess().count_llvm_insns() { diff --git a/src/librustc_trans/callee.rs b/src/librustc_codegen_llvm/callee.rs similarity index 96% rename from src/librustc_trans/callee.rs rename to src/librustc_codegen_llvm/callee.rs index 9263d9a5f5d..a3dbc450ce7 100644 --- a/src/librustc_trans/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Handles translation of callees as well as other call-related +//! Handles codegen of callees as well as other call-related //! things. Callees are a superset of normal rust values and sometimes //! have different representations. In particular, top-level fn items //! and methods are represented as just a fn ptr and not a full @@ -28,7 +28,7 @@ use rustc::ty::layout::LayoutOf; use rustc::ty::subst::Substs; use rustc_target::spec::PanicStrategy; -/// Translates a reference to a fn/method item, monomorphizing and +/// Codegens a reference to a fn/method item, monomorphizing and /// inlining as it goes. /// /// # Parameters @@ -116,9 +116,9 @@ pub fn get_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, // just declared. // // This is sort of subtle. Inside our codegen unit we started off - // compilation by predefining all our own `TransItem` instances. That - // is, everything we're translating ourselves is already defined. That - // means that anything we're actually translating in this codegen unit + // compilation by predefining all our own `MonoItem` instances. That + // is, everything we're codegenning ourselves is already defined. That + // means that anything we're actually codegenning in this codegen unit // will have hit the above branch in `get_declared_value`. As a result, // we're guaranteed here that we're declaring a symbol that won't get // defined, or in other words we're referencing a value from another @@ -181,7 +181,7 @@ pub fn get_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } } else { // This is a non-generic function - if cx.tcx.is_translated_item(instance_def_id) { + if cx.tcx.is_codegened_item(instance_def_id) { // This is a function that is instantiated in the local crate if instance_def_id.is_local() { diff --git a/src/librustc_trans/common.rs b/src/librustc_codegen_llvm/common.rs similarity index 99% rename from src/librustc_trans/common.rs rename to src/librustc_codegen_llvm/common.rs index 75b56be3c16..10ca8e43ce6 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -10,7 +10,7 @@ #![allow(non_camel_case_types, non_snake_case)] -//! Code that is useful in various trans modules. +//! Code that is useful in various codegen modules. use llvm; use llvm::{ValueRef, ContextRef, TypeKind}; @@ -446,4 +446,3 @@ pub fn ty_fn_sig<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, _ => bug!("unexpected type {:?} to ty_fn_sig", ty) } } - diff --git a/src/librustc_trans/consts.rs b/src/librustc_codegen_llvm/consts.rs similarity index 96% rename from src/librustc_trans/consts.rs rename to src/librustc_codegen_llvm/consts.rs index 405cb83ad4d..afa81465ea2 100644 --- a/src/librustc_trans/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -128,7 +128,7 @@ pub fn get_static(cx: &CodegenCx, def_id: DefId) -> ValueRef { ref attrs, span, node: hir::ItemStatic(..), .. }) => { if declare::get_declared_value(cx, &sym[..]).is_some() { - span_bug!(span, "trans: Conflicting symbol names for static?"); + span_bug!(span, "Conflicting symbol names for static?"); } let g = declare::define_global(cx, &sym[..], llty).unwrap(); @@ -145,7 +145,7 @@ pub fn get_static(cx: &CodegenCx, def_id: DefId) -> ValueRef { hir_map::NodeForeignItem(&hir::ForeignItem { ref attrs, span, node: hir::ForeignItemStatic(..), .. }) => { - let g = if let Some(linkage) = cx.tcx.trans_fn_attrs(def_id).linkage { + let g = if let Some(linkage) = cx.tcx.codegen_fn_attrs(def_id).linkage { // If this is a static with a linkage specified, then we need to handle // it a little specially. The typesystem prevents things like &T and // extern "C" fn() from being non-null, so we can't just declare a @@ -221,8 +221,8 @@ pub fn get_static(cx: &CodegenCx, def_id: DefId) -> ValueRef { // However, in some scenarios we defer emission of statics to downstream // crates, so there are cases where a static with an upstream DefId // is actually present in the current crate. We can find out via the - // is_translated_item query. - if !cx.tcx.is_translated_item(def_id) { + // is_codegened_item query. + if !cx.tcx.is_codegened_item(def_id) { unsafe { llvm::LLVMSetDLLStorageClass(g, llvm::DLLStorageClass::DllImport); } @@ -243,14 +243,14 @@ pub fn get_static(cx: &CodegenCx, def_id: DefId) -> ValueRef { g } -pub fn trans_static<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, +pub fn codegen_static<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, def_id: DefId, is_mutable: bool, attrs: &[ast::Attribute]) { unsafe { let g = get_static(cx, def_id); - let v = match ::mir::trans_static_initializer(cx, def_id) { + let v = match ::mir::codegen_static_initializer(cx, def_id) { Ok(v) => v, // Error has already been reported Err(_) => return, @@ -290,7 +290,7 @@ pub fn trans_static<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, // To avoid breaking any invariants, we leave around the old // global for the moment; we'll replace all references to it - // with the new global later. (See base::trans_crate.) + // with the new global later. (See base::codegen_backend.) cx.statics_to_rauw.borrow_mut().push((g, new_g)); new_g }; diff --git a/src/librustc_trans/context.rs b/src/librustc_codegen_llvm/context.rs similarity index 99% rename from src/librustc_trans/context.rs rename to src/librustc_codegen_llvm/context.rs index 90b2fb4b59a..9b1de3d44ea 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -69,7 +69,7 @@ pub struct CodegenCx<'a, 'tcx: 'a> { /// Val is a ValueRef holding a *[T]. /// /// Needed because LLVM loses pointer->pointee association - /// when we ptrcast, and we have to ptrcast during translation + /// when we ptrcast, and we have to ptrcast during codegen /// of a [T] const because we form a slice, a (*T,usize) pair, not /// a pointer to an LLVM array type. Similar for trait objects. pub const_unsized: RefCell>, @@ -81,7 +81,7 @@ pub struct CodegenCx<'a, 'tcx: 'a> { pub statics: RefCell>, /// List of globals for static variables which need to be passed to the - /// LLVM function ReplaceAllUsesWith (RAUW) when translation is complete. + /// LLVM function ReplaceAllUsesWith (RAUW) when codegen is complete. /// (We have to make sure we don't invalidate any ValueRefs referring /// to constants.) pub statics_to_rauw: RefCell>, @@ -351,7 +351,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> { // The exception handling personality function. // // If our compilation unit has the `eh_personality` lang item somewhere - // within it, then we just need to translate that. Otherwise, we're + // within it, then we just need to codegen that. Otherwise, we're // building an rlib which will depend on some upstream implementation of // this function, so we just codegen a generic reference to it. We don't // specify any of the types for the function, we just make it a symbol 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 99% rename from src/librustc_trans/debuginfo/doc.rs rename to src/librustc_codegen_llvm/debuginfo/doc.rs index cbecc0eb7d1..ce0476b07eb 100644 --- a/src/librustc_trans/debuginfo/doc.rs +++ b/src/librustc_codegen_llvm/debuginfo/doc.rs @@ -131,9 +131,9 @@ //! when generating prologue instructions we have to make sure that we don't //! emit source location information until the 'real' function body begins. For //! this reason, source location emission is disabled by default for any new -//! function being translated and is only activated after a call to the third +//! function being codegened and is only activated after a call to the third //! function from the list above, `start_emitting_source_locations()`. This -//! function should be called right before regularly starting to translate the +//! function should be called right before regularly starting to codegen the //! top-level block of the given function. //! //! There is one exception to the above rule: `llvm.dbg.declare` instruction 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 99% rename from src/librustc_trans/debuginfo/metadata.rs rename to src/librustc_codegen_llvm/debuginfo/metadata.rs index 4e77c0df65e..ee60711c11d 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -23,7 +23,7 @@ use llvm::{self, ValueRef}; use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor, DICompositeType, DILexicalBlock, DIFlags}; -use rustc::hir::TransFnAttrFlags; +use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def::CtorKind; use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use rustc::ty::fold::TypeVisitor; @@ -1645,13 +1645,13 @@ pub fn create_global_var_metadata(cx: &CodegenCx, } let tcx = cx.tcx; - let attrs = tcx.trans_fn_attrs(def_id); + let attrs = tcx.codegen_fn_attrs(def_id); - if attrs.flags.contains(TransFnAttrFlags::NO_DEBUG) { + if attrs.flags.contains(CodegenFnAttrFlags::NO_DEBUG) { return; } - let no_mangle = attrs.flags.contains(TransFnAttrFlags::NO_MANGLE); + let no_mangle = attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE); // We may want to remove the namespace scope if we're in an extern block, see: // https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952 let var_scope = get_namespace_for_item(cx, def_id); diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs similarity index 99% rename from src/librustc_trans/debuginfo/mod.rs rename to src/librustc_codegen_llvm/debuginfo/mod.rs index 2039a90a043..294d8cbbd93 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -23,7 +23,7 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation}; use llvm; use llvm::{ModuleRef, ContextRef, ValueRef}; use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray, DIFlags}; -use rustc::hir::TransFnAttrFlags; +use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{DefId, CrateNum}; use rustc::ty::subst::{Substs, UnpackedKind}; @@ -212,7 +212,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } if let InstanceDef::Item(def_id) = instance.def { - if cx.tcx.trans_fn_attrs(def_id).flags.contains(TransFnAttrFlags::NO_DEBUG) { + if cx.tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NO_DEBUG) { return FunctionDebugContext::FunctionWithoutDebugInfo; } } 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 95% rename from src/librustc_trans/debuginfo/source_loc.rs rename to src/librustc_codegen_llvm/debuginfo/source_loc.rs index 7440296ce5d..eb37e7f931c 100644 --- a/src/librustc_trans/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -50,9 +50,9 @@ pub fn set_source_location( /// Enables emitting source locations for the given functions. /// /// Since we don't want source locations to be emitted for the function prelude, -/// they are disabled when beginning to translate a new function. This functions +/// they are disabled when beginning to codegen a new function. This functions /// switches source location emitting on and must therefore be called before the -/// first real statement/expression of the function is translated. +/// first real statement/expression of the function is codegened. pub fn start_emitting_source_locations(dbg_context: &FunctionDebugContext) { match *dbg_context { FunctionDebugContext::RegularContext(ref data) => { 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 98% rename from src/librustc_trans/debuginfo/utils.rs rename to src/librustc_codegen_llvm/debuginfo/utils.rs index 0a3f06b55f1..9d37f99cb2a 100644 --- a/src/librustc_trans/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -31,7 +31,7 @@ pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool // externally visible or by being inlined into something externally // visible). It might better to use the `exported_items` set from // `driver::CrateAnalysis` in the future, but (atm) this set is not - // available in the translation pass. + // available in the codegen pass. !cx.tcx.is_reachable_non_generic(def_id) } diff --git a/src/librustc_trans/declare.rs b/src/librustc_codegen_llvm/declare.rs similarity index 99% rename from src/librustc_trans/declare.rs rename to src/librustc_codegen_llvm/declare.rs index 97721ffbf06..fdc84f914f5 100644 --- a/src/librustc_trans/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -11,7 +11,7 @@ //! //! Prefer using functions and methods from this module rather than calling LLVM //! functions directly. These functions do some additional work to ensure we do -//! the right thing given the preconceptions of trans. +//! the right thing given the preconceptions of codegen. //! //! Some useful guidelines: //! 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 98% rename from src/librustc_trans/intrinsic.rs rename to src/librustc_codegen_llvm/intrinsic.rs index 86aa48b6a9e..ba04cc7fad5 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -84,8 +84,8 @@ fn get_simple_intrinsic(cx: &CodegenCx, 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 -pub fn trans_intrinsic_call<'a, 'tcx>(bx: &Builder<'a, 'tcx>, +/// add them to librustc_codegen_llvm/context.rs +pub fn codegen_intrinsic_call<'a, 'tcx>(bx: &Builder<'a, 'tcx>, callee_ty: Ty<'tcx>, fn_ty: &FnType<'tcx, Ty<'tcx>>, args: &[OperandRef<'tcx>], @@ -386,7 +386,7 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bx: &Builder<'a, 'tcx>, }, "discriminant_value" => { - args[0].deref(bx.cx).trans_get_discr(bx, ret_ty) + args[0].deref(bx.cx).codegen_get_discr(bx, ret_ty) } "align_offset" => { @@ -743,9 +743,9 @@ fn try_intrinsic<'a, 'tcx>( let ptr_align = bx.tcx().data_layout.pointer_align; bx.store(C_null(Type::i8p(&bx.cx)), dest, ptr_align); } else if wants_msvc_seh(bx.sess()) { - trans_msvc_try(bx, cx, func, data, local_ptr, dest); + codegen_msvc_try(bx, cx, func, data, local_ptr, dest); } else { - trans_gnu_try(bx, cx, func, data, local_ptr, dest); + codegen_gnu_try(bx, cx, func, data, local_ptr, dest); } } @@ -756,7 +756,7 @@ fn try_intrinsic<'a, 'tcx>( // instructions are meant to work for all targets, as of the time of this // writing, however, LLVM does not recommend the usage of these new instructions // as the old ones are still more optimized. -fn trans_msvc_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, +fn codegen_msvc_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, cx: &CodegenCx, func: ValueRef, data: ValueRef, @@ -857,14 +857,14 @@ fn trans_msvc_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, // of exceptions (e.g. the normal semantics of LLVM's landingpad and invoke // instructions). // -// This translation is a little surprising because we always call a shim +// This codegen is a little surprising because we always call a shim // function instead of inlining the call to `invoke` manually here. This is done // because in LLVM we're only allowed to have one personality per function // definition. The call to the `try` intrinsic is being inlined into the // function calling it, and that function may already have other personality // functions in play. By calling a shim we're guaranteed that our shim will have // the right personality function. -fn trans_gnu_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, +fn codegen_gnu_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, cx: &CodegenCx, func: ValueRef, data: ValueRef, @@ -873,7 +873,7 @@ fn trans_gnu_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, let llfn = get_rust_try_fn(cx, &mut |bx| { let cx = bx.cx; - // Translates the shims described above: + // Codegens the shims described above: // // bx: // invoke %func(%args...) normal %normal unwind %catch @@ -922,13 +922,13 @@ fn trans_gnu_try<'a, 'tcx>(bx: &Builder<'a, 'tcx>, bx.store(ret, dest, i32_align); } -// Helper function to give a Block to a closure to translate a shim function. +// Helper function to give a Block to a closure to codegen a shim function. // This is currently primarily used for the `try` intrinsic functions above. fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, name: &str, inputs: Vec>, output: Ty<'tcx>, - trans: &mut for<'b> FnMut(Builder<'b, 'tcx>)) + codegen: &mut for<'b> FnMut(Builder<'b, 'tcx>)) -> ValueRef { let rust_fn_ty = cx.tcx.mk_fn_ptr(ty::Binder::bind(cx.tcx.mk_fn_sig( inputs.into_iter(), @@ -939,7 +939,7 @@ fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ))); let llfn = declare::define_internal_fn(cx, name, rust_fn_ty); let bx = Builder::new_block(cx, llfn, "entry-block"); - trans(bx); + codegen(bx); llfn } @@ -948,7 +948,7 @@ fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, // // This function is only generated once and is then cached. fn get_rust_try_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, - trans: &mut for<'b> FnMut(Builder<'b, 'tcx>)) + codegen: &mut for<'b> FnMut(Builder<'b, 'tcx>)) -> ValueRef { if let Some(llfn) = cx.rust_try_fn.get() { return llfn; @@ -965,7 +965,7 @@ fn get_rust_try_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, Abi::Rust ))); let output = tcx.types.i32; - let rust_try = gen_fn(cx, "__rust_try", vec![fn_ty, i8p, i8p], output, trans); + let rust_try = gen_fn(cx, "__rust_try", vec![fn_ty, i8p, i8p], output, codegen); cx.rust_try_fn.set(Some(rust_try)); return rust_try } @@ -1069,7 +1069,7 @@ fn generic_simd_intrinsic<'a, 'tcx>( let n: usize = match name["simd_shuffle".len()..].parse() { Ok(n) => n, Err(_) => span_bug!(span, - "bad `simd_shuffle` instruction only caught in trans?") + "bad `simd_shuffle` instruction only caught in codegen?") }; require_simd!(ret_ty, "return"); diff --git a/src/librustc_trans/lib.rs b/src/librustc_codegen_llvm/lib.rs similarity index 86% rename from src/librustc_trans/lib.rs rename to src/librustc_codegen_llvm/lib.rs index 6db95657ce0..bd053da4bd3 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -49,7 +49,7 @@ extern crate rustc_demangle; extern crate rustc_incremental; extern crate rustc_llvm as llvm; extern crate rustc_platform_intrinsics as intrinsics; -extern crate rustc_trans_utils; +extern crate rustc_codegen_utils; #[macro_use] extern crate log; #[macro_use] extern crate syntax; @@ -79,12 +79,12 @@ use rustc::session::config::{OutputFilenames, OutputType, PrintRequest}; use rustc::ty::{self, TyCtxt}; use rustc::util::nodemap::{FxHashSet, FxHashMap}; use rustc_mir::monomorphize; -use rustc_trans_utils::trans_crate::TransCrate; +use rustc_codegen_utils::codegen_backend::CodegenBackend; mod diagnostics; mod back { - pub use rustc_trans_utils::symbol_names; + pub use rustc_codegen_utils::symbol_names; mod archive; pub mod bytecode; mod command; @@ -116,23 +116,23 @@ mod metadata; mod meth; mod mir; mod time_graph; -mod trans_item; +mod mono_item; mod type_; mod type_of; mod value; -pub struct LlvmTransCrate(()); +pub struct LlvmCodegenBackend(()); -impl !Send for LlvmTransCrate {} // Llvm is on a per-thread basis -impl !Sync for LlvmTransCrate {} +impl !Send for LlvmCodegenBackend {} // Llvm is on a per-thread basis +impl !Sync for LlvmCodegenBackend {} -impl LlvmTransCrate { - pub fn new() -> Box { - box LlvmTransCrate(()) +impl LlvmCodegenBackend { + pub fn new() -> Box { + box LlvmCodegenBackend(()) } } -impl TransCrate for LlvmTransCrate { +impl CodegenBackend for LlvmCodegenBackend { fn init(&self, sess: &Session) { llvm_util::init(sess); // Make sure llvm is inited } @@ -197,27 +197,28 @@ impl TransCrate for LlvmTransCrate { attributes::provide_extern(providers); } - fn trans_crate<'a, 'tcx>( + fn codegen_crate<'a, 'tcx>( &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, rx: mpsc::Receiver> ) -> Box { - box base::trans_crate(tcx, rx) + box base::codegen_crate(tcx, rx) } - fn join_trans_and_link( + fn join_codegen_and_link( &self, - trans: Box, + ongoing_codegen: Box, sess: &Session, dep_graph: &DepGraph, outputs: &OutputFilenames, ) -> Result<(), CompileIncomplete>{ use rustc::util::common::time; - let (trans, work_products) = trans.downcast::<::back::write::OngoingCrateTranslation>() - .expect("Expected LlvmTransCrate's OngoingCrateTranslation, found Box") - .join(sess); + let (ongoing_codegen, work_products) = + ongoing_codegen.downcast::<::back::write::OngoingCodegen>() + .expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box") + .join(sess); if sess.opts.debugging_opts.incremental_info { - back::write::dump_incremental_data(&trans); + back::write::dump_incremental_data(&ongoing_codegen); } time(sess, @@ -234,24 +235,25 @@ impl TransCrate for LlvmTransCrate { // Run the linker on any artifacts that resulted from the LLVM run. // This should produce either a finished executable or library. time(sess, "linking", || { - back::link::link_binary(sess, &trans, outputs, &trans.crate_name.as_str()); + back::link::link_binary(sess, &ongoing_codegen, + outputs, &ongoing_codegen.crate_name.as_str()); }); // Now that we won't touch anything in the incremental compilation directory // any more, we can finalize it (which involves renaming it) - rustc_incremental::finalize_session_directory(sess, trans.link.crate_hash); + rustc_incremental::finalize_session_directory(sess, ongoing_codegen.link.crate_hash); Ok(()) } } -/// This is the entrypoint for a hot plugged rustc_trans +/// This is the entrypoint for a hot plugged rustc_codegen_llvm #[no_mangle] -pub fn __rustc_codegen_backend() -> Box { - LlvmTransCrate::new() +pub fn __rustc_codegen_backend() -> Box { + LlvmCodegenBackend::new() } -struct ModuleTranslation { +struct ModuleCodegen { /// The name of the module. When the crate may be saved between /// compilations, incremental compilation requires that name be /// unique amongst **all** crates. Therefore, it should contain @@ -270,10 +272,10 @@ enum ModuleKind { Allocator, } -impl ModuleTranslation { +impl ModuleCodegen { fn llvm(&self) -> Option<&ModuleLlvm> { match self.source { - ModuleSource::Translated(ref llvm) => Some(llvm), + ModuleSource::Codegened(ref llvm) => Some(llvm), ModuleSource::Preexisting(_) => None, } } @@ -285,7 +287,7 @@ impl ModuleTranslation { outputs: &OutputFilenames) -> CompiledModule { let pre_existing = match self.source { ModuleSource::Preexisting(_) => true, - ModuleSource::Translated(_) => false, + ModuleSource::Codegened(_) => false, }; let object = if emit_obj { Some(outputs.temp_path(OutputType::Object, Some(&self.name))) @@ -332,7 +334,7 @@ enum ModuleSource { Preexisting(WorkProduct), /// Rebuild from this LLVM module. - Translated(ModuleLlvm), + Codegened(ModuleLlvm), } #[derive(Debug)] @@ -355,7 +357,7 @@ impl Drop for ModuleLlvm { } } -struct CrateTranslation { +struct CodegenResults { crate_name: Symbol, modules: Vec, allocator_module: Option, @@ -387,4 +389,4 @@ struct CrateInfo { missing_lang_items: FxHashMap>, } -__build_diagnostic_array! { librustc_trans, DIAGNOSTICS } +__build_diagnostic_array! { librustc_codegen_llvm, DIAGNOSTICS } diff --git a/src/librustc_trans/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs similarity index 99% rename from src/librustc_trans/llvm_util.rs rename to src/librustc_codegen_llvm/llvm_util.rs index bbd1c39a19e..357b639e788 100644 --- a/src/librustc_trans/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -249,7 +249,7 @@ pub(crate) 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/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 93% rename from src/librustc_trans/mir/block.rs rename to src/librustc_codegen_llvm/mir/block.rs index e4989da36c0..556baeba39e 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -34,25 +34,25 @@ use super::operand::OperandRef; use super::operand::OperandValue::{Pair, Ref, Immediate}; impl<'a, 'tcx> FunctionCx<'a, 'tcx> { - pub fn trans_block(&mut self, bb: mir::BasicBlock) { + pub fn codegen_block(&mut self, bb: mir::BasicBlock) { let mut bx = self.build_block(bb); let data = &self.mir[bb]; - debug!("trans_block({:?}={:?})", bb, data); + debug!("codegen_block({:?}={:?})", bb, data); for statement in &data.statements { - bx = self.trans_statement(bx, statement); + bx = self.codegen_statement(bx, statement); } - self.trans_terminator(bx, bb, data.terminator()); + self.codegen_terminator(bx, bb, data.terminator()); } - fn trans_terminator(&mut self, + fn codegen_terminator(&mut self, mut bx: Builder<'a, 'tcx>, bb: mir::BasicBlock, terminator: &mir::Terminator<'tcx>) { - debug!("trans_terminator: {:?}", terminator); + debug!("codegen_terminator: {:?}", terminator); // Create the cleanup bundle, if needed. let tcx = bx.tcx(); @@ -190,7 +190,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::TerminatorKind::SwitchInt { ref discr, switch_ty, ref values, ref targets } => { - let discr = self.trans_operand(&bx, discr); + let discr = self.codegen_operand(&bx, discr); if switch_ty == bx.tcx().types.bool { let lltrue = llblock(self, targets[0]); let llfalse = llblock(self, targets[1]); @@ -221,7 +221,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } PassMode::Direct(_) | PassMode::Pair(..) => { - let op = self.trans_consume(&bx, &mir::Place::Local(mir::RETURN_PLACE)); + let op = self.codegen_consume(&bx, &mir::Place::Local(mir::RETURN_PLACE)); if let Ref(llval, align) = op.val { bx.load(llval, align) } else { @@ -233,10 +233,10 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { let op = match self.locals[mir::RETURN_PLACE] { LocalRef::Operand(Some(op)) => op, LocalRef::Operand(None) => bug!("use of return before def"), - LocalRef::Place(tr_place) => { + LocalRef::Place(cg_place) => { OperandRef { - val: Ref(tr_place.llval, tr_place.align), - layout: tr_place.layout + val: Ref(cg_place.llval, cg_place.align), + layout: cg_place.layout } } }; @@ -275,7 +275,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { return } - let place = self.trans_place(&bx, location); + let place = self.codegen_place(&bx, location); let mut args: &[_] = &[place.llval, place.llextra]; args = &args[..1 + place.has_extra() as usize]; let (drop_fn, fn_ty) = match ty.sty { @@ -301,7 +301,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::TerminatorKind::Assert { ref cond, expected, ref msg, target, cleanup } => { - let cond = self.trans_operand(&bx, cond).immediate(); + let cond = self.codegen_operand(&bx, cond).immediate(); let mut const_cond = common::const_to_opt_u128(cond, false).map(|c| c == 1); // This case can currently arise only from functions marked @@ -317,7 +317,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } - // Don't translate the panic block if success if known. + // Don't codegen the panic block if success if known. if const_cond == Some(expected) { funclet_br(self, bx, target); return; @@ -353,8 +353,8 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { // Put together the arguments to the panic entry point. let (lang_item, args) = match *msg { EvalErrorKind::BoundsCheck { ref len, ref index } => { - let len = self.trans_operand(&mut bx, len).immediate(); - let index = self.trans_operand(&mut bx, index).immediate(); + let len = self.codegen_operand(&mut bx, len).immediate(); + let index = self.codegen_operand(&mut bx, index).immediate(); let file_line_col = C_struct(bx.cx, &[filename, line, col], false); let file_line_col = consts::addr_of(bx.cx, @@ -386,17 +386,17 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { let fn_ty = FnType::of_instance(bx.cx, &instance); let llfn = callee::get_fn(bx.cx, instance); - // Translate the actual panic invoke/call. + // Codegen the actual panic invoke/call. do_call(self, bx, fn_ty, llfn, &args, None, cleanup); } mir::TerminatorKind::DropAndReplace { .. } => { - bug!("undesugared DropAndReplace in trans: {:?}", terminator); + bug!("undesugared DropAndReplace in codegen: {:?}", terminator); } mir::TerminatorKind::Call { ref func, ref args, ref destination, cleanup } => { // Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar. - let callee = self.trans_operand(&bx, func); + let callee = self.codegen_operand(&bx, func); let (instance, mut llfn) = match callee.layout.ty.sty { ty::TyFnDef(def_id, substs) => { @@ -419,7 +419,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { ); let abi = sig.abi; - // Handle intrinsics old trans wants Expr's for, ourselves. + // Handle intrinsics old codegen wants Expr's for, ourselves. let intrinsic = match def { Some(ty::InstanceDef::Intrinsic(def_id)) => Some(bx.tcx().item_name(def_id).as_str()), @@ -429,7 +429,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { if intrinsic == Some("transmute") { let &(ref dest, target) = destination.as_ref().unwrap(); - self.trans_transmute(&bx, &args[0], dest); + self.codegen_transmute(&bx, &args[0], dest); funclet_br(self, bx, target); return; } @@ -467,7 +467,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { }; if intrinsic.is_some() && intrinsic != Some("drop_in_place") { - use intrinsic::trans_intrinsic_call; + use intrinsic::codegen_intrinsic_call; let dest = match ret_dest { _ if fn_ty.ret.is_indirect() => llargs[0], @@ -504,12 +504,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } - self.trans_operand(&bx, arg) + self.codegen_operand(&bx, arg) }).collect(); let callee_ty = instance.as_ref().unwrap().ty(bx.cx.tcx); - trans_intrinsic_call(&bx, callee_ty, &fn_ty, &args, dest, + codegen_intrinsic_call(&bx, callee_ty, &fn_ty, &args, dest, terminator.source_info.span); if let ReturnDest::IndirectOperand(dst, _) = ret_dest { @@ -534,7 +534,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { }; for (i, arg) in first_args.iter().enumerate() { - let mut op = self.trans_operand(&bx, arg); + let mut op = self.codegen_operand(&bx, arg); if let (0, Some(ty::InstanceDef::Virtual(_, idx))) = (i, def) { if let Pair(data_ptr, meta) = op.val { llfn = Some(meth::VirtualIndex::from_index(idx) @@ -556,10 +556,10 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { _ => {} } - self.trans_argument(&bx, op, &mut llargs, &fn_ty.args[i]); + self.codegen_argument(&bx, op, &mut llargs, &fn_ty.args[i]); } if let Some(tup) = untuple { - self.trans_arguments_untupled(&bx, tup, &mut llargs, + self.codegen_arguments_untupled(&bx, tup, &mut llargs, &fn_ty.args[first_args.len()..]) } @@ -574,13 +574,13 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { cleanup); } mir::TerminatorKind::GeneratorDrop | - mir::TerminatorKind::Yield { .. } => bug!("generator ops in trans"), + mir::TerminatorKind::Yield { .. } => bug!("generator ops in codegen"), mir::TerminatorKind::FalseEdges { .. } | - mir::TerminatorKind::FalseUnwind { .. } => bug!("borrowck false edges in trans"), + mir::TerminatorKind::FalseUnwind { .. } => bug!("borrowck false edges in codegen"), } } - fn trans_argument(&mut self, + fn codegen_argument(&mut self, bx: &Builder<'a, 'tcx>, op: OperandRef<'tcx>, llargs: &mut Vec, @@ -601,7 +601,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { llargs.push(b); return; } - _ => bug!("trans_argument: {:?} invalid for pair arugment", op) + _ => bug!("codegen_argument: {:?} invalid for pair arugment", op) } } @@ -659,25 +659,25 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { llargs.push(llval); } - fn trans_arguments_untupled(&mut self, + fn codegen_arguments_untupled(&mut self, bx: &Builder<'a, 'tcx>, operand: &mir::Operand<'tcx>, llargs: &mut Vec, args: &[ArgType<'tcx, Ty<'tcx>>]) { - let tuple = self.trans_operand(bx, operand); + let tuple = self.codegen_operand(bx, operand); // Handle both by-ref and immediate tuples. if let Ref(llval, align) = tuple.val { let tuple_ptr = PlaceRef::new_sized(llval, tuple.layout, align); for i in 0..tuple.layout.fields.count() { let field_ptr = tuple_ptr.project_field(bx, i); - self.trans_argument(bx, field_ptr.load(bx), llargs, &args[i]); + self.codegen_argument(bx, field_ptr.load(bx), llargs, &args[i]); } } else { // If the tuple is immediate, the elements are as well. for i in 0..tuple.layout.fields.count() { let op = tuple.extract_field(bx, i); - self.trans_argument(bx, op, llargs, &args[i]); + self.codegen_argument(bx, op, llargs, &args[i]); } } } @@ -792,7 +792,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } } else { - self.trans_place(bx, dest) + self.codegen_place(bx, dest) }; if fn_ret.is_indirect() { if dest.align.abi() < dest.layout.align.abi() { @@ -811,18 +811,18 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } - fn trans_transmute(&mut self, bx: &Builder<'a, 'tcx>, + fn codegen_transmute(&mut self, bx: &Builder<'a, 'tcx>, src: &mir::Operand<'tcx>, dst: &mir::Place<'tcx>) { if let mir::Place::Local(index) = *dst { match self.locals[index] { - LocalRef::Place(place) => self.trans_transmute_into(bx, src, place), + LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place), LocalRef::Operand(None) => { let dst_layout = bx.cx.layout_of(self.monomorphized_place_ty(dst)); assert!(!dst_layout.ty.has_erasable_regions()); let place = PlaceRef::alloca(bx, dst_layout, "transmute_temp"); place.storage_live(bx); - self.trans_transmute_into(bx, src, place); + self.codegen_transmute_into(bx, src, place); let op = place.load(bx); place.storage_dead(bx); self.locals[index] = LocalRef::Operand(Some(op)); @@ -833,15 +833,15 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } } else { - let dst = self.trans_place(bx, dst); - self.trans_transmute_into(bx, src, dst); + let dst = self.codegen_place(bx, dst); + self.codegen_transmute_into(bx, src, dst); } } - fn trans_transmute_into(&mut self, bx: &Builder<'a, 'tcx>, + fn codegen_transmute_into(&mut self, bx: &Builder<'a, 'tcx>, src: &mir::Operand<'tcx>, dst: PlaceRef<'tcx>) { - let src = self.trans_operand(bx, src); + let src = self.codegen_operand(bx, src); let llty = src.layout.llvm_type(bx.cx); let cast_ptr = bx.pointercast(dst.llval, llty.ptr_to()); let align = src.layout.align.min(dst.layout.align); diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs similarity index 99% rename from src/librustc_trans/mir/constant.rs rename to src/librustc_codegen_llvm/mir/constant.rs index a10b7c9c9f1..c2638d2d410 100644 --- a/src/librustc_trans/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -158,7 +158,7 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx, alloc: &Allocation) -> ValueRef { C_struct(cx, &llvals, true) } -pub fn trans_static_initializer<'a, 'tcx>( +pub fn codegen_static_initializer<'a, 'tcx>( cx: &CodegenCx<'a, 'tcx>, def_id: DefId) -> Result> diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs similarity index 98% rename from src/librustc_trans/mir/mod.rs rename to src/librustc_codegen_llvm/mir/mod.rs index 8ea0983075d..47b15320311 100644 --- a/src/librustc_trans/mir/mod.rs +++ b/src/librustc_codegen_llvm/mir/mod.rs @@ -33,7 +33,7 @@ use std::iter; use rustc_data_structures::bitvec::BitVector; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; -pub use self::constant::trans_static_initializer; +pub use self::constant::codegen_static_initializer; use self::analyze::CleanupKind; use self::place::PlaceRef; @@ -41,7 +41,7 @@ use rustc::mir::traversal; use self::operand::{OperandRef, OperandValue}; -/// Master context for translating MIR. +/// Master context for codegenning from MIR. pub struct FunctionCx<'a, 'tcx:'a> { instance: Instance<'tcx>, @@ -197,7 +197,7 @@ impl<'a, 'tcx> LocalRef<'tcx> { /////////////////////////////////////////////////////////////////////////// -pub fn trans_mir<'a, 'tcx: 'a>( +pub fn codegen_mir<'a, 'tcx: 'a>( cx: &'a CodegenCx<'a, 'tcx>, llfn: ValueRef, mir: &'a Mir<'tcx>, @@ -321,10 +321,10 @@ pub fn trans_mir<'a, 'tcx: 'a>( let rpo = traversal::reverse_postorder(&mir); let mut visited = BitVector::new(mir.basic_blocks().len()); - // Translate the body of each block using reverse postorder + // Codegen the body of each block using reverse postorder for (bb, _) in rpo { visited.insert(bb.index()); - fx.trans_block(bb); + fx.codegen_block(bb); } // Remove blocks that haven't been visited, or have no @@ -332,7 +332,7 @@ pub fn trans_mir<'a, 'tcx: 'a>( for bb in mir.basic_blocks().indices() { // Unreachable block if !visited.contains(bb.index()) { - debug!("trans_mir: block {:?} was not visited", bb); + debug!("codegen_mir: block {:?} was not visited", bb); unsafe { llvm::LLVMDeleteBasicBlock(fx.blocks[bb]); } diff --git a/src/librustc_trans/mir/operand.rs b/src/librustc_codegen_llvm/mir/operand.rs similarity index 96% rename from src/librustc_trans/mir/operand.rs rename to src/librustc_codegen_llvm/mir/operand.rs index be14da1a195..62ef58f8255 100644 --- a/src/librustc_trans/mir/operand.rs +++ b/src/librustc_codegen_llvm/mir/operand.rs @@ -315,12 +315,12 @@ impl<'a, 'tcx> OperandValue { } impl<'a, 'tcx> FunctionCx<'a, 'tcx> { - fn maybe_trans_consume_direct(&mut self, + fn maybe_codegen_consume_direct(&mut self, bx: &Builder<'a, 'tcx>, place: &mir::Place<'tcx>) -> Option> { - debug!("maybe_trans_consume_direct(place={:?})", place); + debug!("maybe_codegen_consume_direct(place={:?})", place); // watch out for locals that do not have an // alloca; they are handled somewhat differently @@ -340,7 +340,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { // Moves out of scalar and scalar pair fields are trivial. if let &mir::Place::Projection(ref proj) = place { - if let Some(o) = self.maybe_trans_consume_direct(bx, &proj.base) { + if let Some(o) = self.maybe_codegen_consume_direct(bx, &proj.base) { match proj.elem { mir::ProjectionElem::Field(ref f, _) => { return Some(o.extract_field(bx, f.index())); @@ -349,7 +349,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { mir::ProjectionElem::ConstantIndex { .. } => { // ZSTs don't require any actual memory access. // FIXME(eddyb) deduplicate this with the identical - // checks in `trans_consume` and `extract_field`. + // checks in `codegen_consume` and `extract_field`. let elem = o.layout.field(bx.cx, 0); if elem.is_zst() { return Some(OperandRef::new_zst(bx.cx, elem)); @@ -363,12 +363,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { None } - pub fn trans_consume(&mut self, + pub fn codegen_consume(&mut self, bx: &Builder<'a, 'tcx>, place: &mir::Place<'tcx>) -> OperandRef<'tcx> { - debug!("trans_consume(place={:?})", place); + debug!("codegen_consume(place={:?})", place); let ty = self.monomorphized_place_ty(place); let layout = bx.cx.layout_of(ty); @@ -378,26 +378,26 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { return OperandRef::new_zst(bx.cx, layout); } - if let Some(o) = self.maybe_trans_consume_direct(bx, place) { + if let Some(o) = self.maybe_codegen_consume_direct(bx, place) { return o; } // for most places, to consume them we just load them // out from their home - self.trans_place(bx, place).load(bx) + self.codegen_place(bx, place).load(bx) } - pub fn trans_operand(&mut self, + pub fn codegen_operand(&mut self, bx: &Builder<'a, 'tcx>, operand: &mir::Operand<'tcx>) -> OperandRef<'tcx> { - debug!("trans_operand(operand={:?})", operand); + debug!("codegen_operand(operand={:?})", operand); match *operand { mir::Operand::Copy(ref place) | mir::Operand::Move(ref place) => { - self.trans_consume(bx, place) + self.codegen_consume(bx, place) } mir::Operand::Constant(ref constant) => { diff --git a/src/librustc_trans/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs similarity index 94% rename from src/librustc_trans/mir/place.rs rename to src/librustc_codegen_llvm/mir/place.rs index d4abd5fa88d..bda8c758750 100644 --- a/src/librustc_trans/mir/place.rs +++ b/src/librustc_codegen_llvm/mir/place.rs @@ -253,7 +253,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> { } /// Obtain the actual discriminant of a value. - pub fn trans_get_discr(self, bx: &Builder<'a, 'tcx>, cast_to: Ty<'tcx>) -> ValueRef { + pub fn codegen_get_discr(self, bx: &Builder<'a, 'tcx>, cast_to: Ty<'tcx>) -> ValueRef { let cast_to = bx.cx.layout_of(cast_to).immediate_llvm_type(bx.cx); if self.layout.abi == layout::Abi::Uninhabited { return C_undef(cast_to); @@ -313,7 +313,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> { /// Set the discriminant for a new value of the given case of the given /// representation. - pub fn trans_set_discr(&self, bx: &Builder<'a, 'tcx>, variant_index: usize) { + pub fn codegen_set_discr(&self, bx: &Builder<'a, 'tcx>, variant_index: usize) { if self.layout.for_variant(bx.cx, variant_index).abi == layout::Abi::Uninhabited { return; } @@ -399,11 +399,11 @@ impl<'a, 'tcx> PlaceRef<'tcx> { } impl<'a, 'tcx> FunctionCx<'a, 'tcx> { - pub fn trans_place(&mut self, + pub fn codegen_place(&mut self, bx: &Builder<'a, 'tcx>, place: &mir::Place<'tcx>) -> PlaceRef<'tcx> { - debug!("trans_place(place={:?})", place); + debug!("codegen_place(place={:?})", place); let cx = bx.cx; let tcx = cx.tcx; @@ -430,46 +430,46 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { elem: mir::ProjectionElem::Deref }) => { // Load the pointer from its location. - self.trans_consume(bx, base).deref(bx.cx) + self.codegen_consume(bx, base).deref(bx.cx) } mir::Place::Projection(ref projection) => { - let tr_base = self.trans_place(bx, &projection.base); + let cg_base = self.codegen_place(bx, &projection.base); match projection.elem { mir::ProjectionElem::Deref => bug!(), mir::ProjectionElem::Field(ref field, _) => { - tr_base.project_field(bx, field.index()) + cg_base.project_field(bx, field.index()) } mir::ProjectionElem::Index(index) => { let index = &mir::Operand::Copy(mir::Place::Local(index)); - let index = self.trans_operand(bx, index); + let index = self.codegen_operand(bx, index); let llindex = index.immediate(); - tr_base.project_index(bx, llindex) + cg_base.project_index(bx, llindex) } mir::ProjectionElem::ConstantIndex { offset, from_end: false, min_length: _ } => { let lloffset = C_usize(bx.cx, offset as u64); - tr_base.project_index(bx, lloffset) + cg_base.project_index(bx, lloffset) } mir::ProjectionElem::ConstantIndex { offset, from_end: true, min_length: _ } => { let lloffset = C_usize(bx.cx, offset as u64); - let lllen = tr_base.len(bx.cx); + let lllen = cg_base.len(bx.cx); let llindex = bx.sub(lllen, lloffset); - tr_base.project_index(bx, llindex) + cg_base.project_index(bx, llindex) } mir::ProjectionElem::Subslice { from, to } => { - let mut subslice = tr_base.project_index(bx, + let mut subslice = cg_base.project_index(bx, C_usize(bx.cx, from as u64)); - let projected_ty = PlaceTy::Ty { ty: tr_base.layout.ty } + let projected_ty = PlaceTy::Ty { ty: cg_base.layout.ty } .projection_ty(tcx, &projection.elem).to_ty(bx.tcx()); subslice.layout = bx.cx.layout_of(self.monomorphize(&projected_ty)); if subslice.layout.is_unsized() { - assert!(tr_base.has_extra()); - subslice.llextra = bx.sub(tr_base.llextra, + assert!(cg_base.has_extra()); + subslice.llextra = bx.sub(cg_base.llextra, C_usize(bx.cx, (from as u64) + (to as u64))); } @@ -481,12 +481,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { subslice } mir::ProjectionElem::Downcast(_, v) => { - tr_base.project_downcast(bx, v) + cg_base.project_downcast(bx, v) } } } }; - debug!("trans_place(place={:?}) => {:?}", place, result); + debug!("codegen_place(place={:?}) => {:?}", place, result); result } @@ -496,4 +496,3 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { self.monomorphize(&place_ty.to_ty(tcx)) } } - diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs similarity index 93% rename from src/librustc_trans/mir/rvalue.rs rename to src/librustc_codegen_llvm/mir/rvalue.rs index 3b447756450..d1b949d4f73 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -33,21 +33,21 @@ use super::operand::{OperandRef, OperandValue}; use super::place::PlaceRef; impl<'a, 'tcx> FunctionCx<'a, 'tcx> { - pub fn trans_rvalue(&mut self, + pub fn codegen_rvalue(&mut self, bx: Builder<'a, 'tcx>, dest: PlaceRef<'tcx>, rvalue: &mir::Rvalue<'tcx>) -> Builder<'a, 'tcx> { - debug!("trans_rvalue(dest.llval={:?}, rvalue={:?})", + debug!("codegen_rvalue(dest.llval={:?}, rvalue={:?})", Value(dest.llval), rvalue); match *rvalue { mir::Rvalue::Use(ref operand) => { - let tr_operand = self.trans_operand(&bx, operand); - // FIXME: consider not copying constants through stack. (fixable by translating + let cg_operand = self.codegen_operand(&bx, operand); + // FIXME: consider not copying constants through stack. (fixable by codegenning // constants into OperandValue::Ref, why don’t we do that yet if we don’t?) - tr_operand.val.store(&bx, dest); + cg_operand.val.store(&bx, dest); bx } @@ -57,16 +57,16 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { if dest.layout.is_llvm_scalar_pair() { // into-coerce of a thin pointer to a fat pointer - just // use the operand path. - let (bx, temp) = self.trans_rvalue_operand(bx, rvalue); + let (bx, temp) = self.codegen_rvalue_operand(bx, rvalue); temp.val.store(&bx, dest); return bx; } // Unsize of a nontrivial struct. I would prefer for - // this to be eliminated by MIR translation, but + // this to be eliminated by MIR building, but // `CoerceUnsized` can be passed by a where-clause, // so the (generic) MIR may not be able to expand it. - let operand = self.trans_operand(&bx, source); + let operand = self.codegen_operand(&bx, source); match operand.val { OperandValue::Pair(..) | OperandValue::Immediate(_) => { @@ -76,7 +76,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { // `coerce_unsized_into` use extractvalue to // index into the struct, and this case isn't // important enough for it. - debug!("trans_rvalue: creating ugly alloca"); + debug!("codegen_rvalue: creating ugly alloca"); let scratch = PlaceRef::alloca(&bx, operand.layout, "__unsize_temp"); scratch.storage_live(&bx); operand.val.store(&bx, scratch); @@ -92,7 +92,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::Rvalue::Repeat(ref elem, count) => { - let tr_elem = self.trans_operand(&bx, elem); + let cg_elem = self.codegen_operand(&bx, elem); // Do not generate the loop for zero-sized elements or empty arrays. if dest.layout.is_zst() { @@ -101,7 +101,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { let start = dest.project_index(&bx, C_usize(bx.cx, 0)).llval; - if let OperandValue::Immediate(v) = tr_elem.val { + if let OperandValue::Immediate(v) = cg_elem.val { let align = C_i32(bx.cx, dest.align.abi() as i32); let size = C_usize(bx.cx, dest.layout.size.bytes()); @@ -133,8 +133,8 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { let keep_going = header_bx.icmp(llvm::IntNE, current, end); header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb()); - tr_elem.val.store(&body_bx, - PlaceRef::new_sized(current, tr_elem.layout, dest.align)); + cg_elem.val.store(&body_bx, + PlaceRef::new_sized(current, cg_elem.layout, dest.align)); let next = body_bx.inbounds_gep(current, &[C_usize(bx.cx, 1)]); body_bx.br(header_bx.llbb()); @@ -146,7 +146,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { mir::Rvalue::Aggregate(ref kind, ref operands) => { let (dest, active_field_index) = match **kind { mir::AggregateKind::Adt(adt_def, variant_index, _, active_field_index) => { - dest.trans_set_discr(&bx, variant_index); + dest.codegen_set_discr(&bx, variant_index); if adt_def.is_enum() { (dest.project_downcast(&bx, variant_index), active_field_index) } else { @@ -156,7 +156,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { _ => (dest, None) }; for (i, operand) in operands.iter().enumerate() { - let op = self.trans_operand(&bx, operand); + let op = self.codegen_operand(&bx, operand); // Do not generate stores and GEPis for zero-sized fields. if !op.layout.is_zst() { let field_index = active_field_index.unwrap_or(i); @@ -168,23 +168,23 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { _ => { assert!(self.rvalue_creates_operand(rvalue)); - let (bx, temp) = self.trans_rvalue_operand(bx, rvalue); + let (bx, temp) = self.codegen_rvalue_operand(bx, rvalue); temp.val.store(&bx, dest); bx } } } - pub fn trans_rvalue_operand(&mut self, + pub fn codegen_rvalue_operand(&mut self, bx: Builder<'a, 'tcx>, rvalue: &mir::Rvalue<'tcx>) -> (Builder<'a, 'tcx>, OperandRef<'tcx>) { - assert!(self.rvalue_creates_operand(rvalue), "cannot trans {:?} to operand", rvalue); + assert!(self.rvalue_creates_operand(rvalue), "cannot codegen {:?} to operand", rvalue); match *rvalue { mir::Rvalue::Cast(ref kind, ref source, mir_cast_ty) => { - let operand = self.trans_operand(&bx, source); + let operand = self.codegen_operand(&bx, source); debug!("cast operand is {:?}", operand); let cast = bx.cx.layout_of(self.monomorphize(&mir_cast_ty)); @@ -242,7 +242,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { OperandValue::Pair(lldata, llextra) } OperandValue::Ref(..) => { - bug!("by-ref operand {:?} in trans_rvalue_operand", + bug!("by-ref operand {:?} in codegen_rvalue_operand", operand); } } @@ -358,16 +358,16 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::Rvalue::Ref(_, bk, ref place) => { - let tr_place = self.trans_place(&bx, place); + let cg_place = self.codegen_place(&bx, place); - let ty = tr_place.layout.ty; + let ty = cg_place.layout.ty; // Note: places are indirect, so storing the `llval` into the // destination effectively creates a reference. let val = if !bx.cx.type_has_metadata(ty) { - OperandValue::Immediate(tr_place.llval) + OperandValue::Immediate(cg_place.llval) } else { - OperandValue::Pair(tr_place.llval, tr_place.llextra) + OperandValue::Pair(cg_place.llval, cg_place.llextra) }; (bx, OperandRef { val, @@ -388,12 +388,12 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::Rvalue::BinaryOp(op, ref lhs, ref rhs) => { - let lhs = self.trans_operand(&bx, lhs); - let rhs = self.trans_operand(&bx, rhs); + let lhs = self.codegen_operand(&bx, lhs); + let rhs = self.codegen_operand(&bx, rhs); let llresult = match (lhs.val, rhs.val) { (OperandValue::Pair(lhs_addr, lhs_extra), OperandValue::Pair(rhs_addr, rhs_extra)) => { - self.trans_fat_ptr_binop(&bx, op, + self.codegen_fat_ptr_binop(&bx, op, lhs_addr, lhs_extra, rhs_addr, rhs_extra, lhs.layout.ty) @@ -401,7 +401,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { (OperandValue::Immediate(lhs_val), OperandValue::Immediate(rhs_val)) => { - self.trans_scalar_binop(&bx, op, lhs_val, rhs_val, lhs.layout.ty) + self.codegen_scalar_binop(&bx, op, lhs_val, rhs_val, lhs.layout.ty) } _ => bug!() @@ -414,9 +414,9 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { (bx, operand) } mir::Rvalue::CheckedBinaryOp(op, ref lhs, ref rhs) => { - let lhs = self.trans_operand(&bx, lhs); - let rhs = self.trans_operand(&bx, rhs); - let result = self.trans_scalar_checked_binop(&bx, op, + let lhs = self.codegen_operand(&bx, lhs); + let rhs = self.codegen_operand(&bx, rhs); + let result = self.codegen_scalar_checked_binop(&bx, op, lhs.immediate(), rhs.immediate(), lhs.layout.ty); let val_ty = op.ty(bx.tcx(), lhs.layout.ty, rhs.layout.ty); @@ -430,7 +430,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } mir::Rvalue::UnaryOp(op, ref operand) => { - let operand = self.trans_operand(&bx, operand); + let operand = self.codegen_operand(&bx, operand); let lloperand = operand.immediate(); let is_float = operand.layout.ty.is_fp(); let llval = match op { @@ -449,8 +449,8 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { mir::Rvalue::Discriminant(ref place) => { let discr_ty = rvalue.ty(&*self.mir, bx.tcx()); - let discr = self.trans_place(&bx, place) - .trans_get_discr(&bx, discr_ty); + let discr = self.codegen_place(&bx, place) + .codegen_get_discr(&bx, discr_ty); (bx, OperandRef { val: OperandValue::Immediate(discr), layout: self.cx.layout_of(discr_ty) @@ -493,7 +493,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { (bx, operand) } mir::Rvalue::Use(ref operand) => { - let operand = self.trans_operand(&bx, operand); + let operand = self.codegen_operand(&bx, operand); (bx, operand) } mir::Rvalue::Repeat(..) | @@ -512,7 +512,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { place: &mir::Place<'tcx>) -> ValueRef { // ZST are passed as operands and require special handling - // because trans_place() panics if Local is operand. + // because codegen_place() panics if Local is operand. if let mir::Place::Local(index) = *place { if let LocalRef::Operand(Some(op)) = self.locals[index] { if let ty::TyArray(_, n) = op.layout.ty.sty { @@ -522,11 +522,11 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } // use common size calculation for non zero-sized types - let tr_value = self.trans_place(&bx, place); - return tr_value.len(bx.cx); + let cg_value = self.codegen_place(&bx, place); + return cg_value.len(bx.cx); } - pub fn trans_scalar_binop(&mut self, + pub fn codegen_scalar_binop(&mut self, bx: &Builder<'a, 'tcx>, op: mir::BinOp, lhs: ValueRef, @@ -592,7 +592,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } - pub fn trans_fat_ptr_binop(&mut self, + pub fn codegen_fat_ptr_binop(&mut self, bx: &Builder<'a, 'tcx>, op: mir::BinOp, lhs_addr: ValueRef, @@ -639,7 +639,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } } - pub fn trans_scalar_checked_binop(&mut self, + pub fn codegen_scalar_checked_binop(&mut self, bx: &Builder<'a, 'tcx>, op: mir::BinOp, lhs: ValueRef, @@ -650,7 +650,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { // another crate (mostly core::num generic/#[inline] fns), // while the current crate doesn't use overflow checks. if !bx.cx.check_overflow { - let val = self.trans_scalar_binop(bx, op, lhs, rhs, input_ty); + let val = self.codegen_scalar_binop(bx, op, lhs, rhs, input_ty); return OperandValue::Pair(val, C_bool(bx.cx, false)); } @@ -676,7 +676,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { let outer_bits = bx.and(rhs, invert_mask); let of = bx.icmp(llvm::IntNE, outer_bits, C_null(rhs_llty)); - let val = self.trans_scalar_binop(bx, op, lhs, rhs, input_ty); + let val = self.codegen_scalar_binop(bx, op, lhs, rhs, input_ty); (val, of) } diff --git a/src/librustc_trans/mir/statement.rs b/src/librustc_codegen_llvm/mir/statement.rs similarity index 71% rename from src/librustc_trans/mir/statement.rs rename to src/librustc_codegen_llvm/mir/statement.rs index 579b07929a2..578481df157 100644 --- a/src/librustc_trans/mir/statement.rs +++ b/src/librustc_codegen_llvm/mir/statement.rs @@ -17,22 +17,22 @@ use super::FunctionCx; use super::LocalRef; impl<'a, 'tcx> FunctionCx<'a, 'tcx> { - pub fn trans_statement(&mut self, + pub fn codegen_statement(&mut self, bx: Builder<'a, 'tcx>, statement: &mir::Statement<'tcx>) -> Builder<'a, 'tcx> { - debug!("trans_statement(statement={:?})", statement); + debug!("codegen_statement(statement={:?})", statement); self.set_debug_loc(&bx, statement.source_info); match statement.kind { mir::StatementKind::Assign(ref place, ref rvalue) => { if let mir::Place::Local(index) = *place { match self.locals[index] { - LocalRef::Place(tr_dest) => { - self.trans_rvalue(bx, tr_dest, rvalue) + LocalRef::Place(cg_dest) => { + self.codegen_rvalue(bx, cg_dest, rvalue) } LocalRef::Operand(None) => { - let (bx, operand) = self.trans_rvalue_operand(bx, rvalue); + let (bx, operand) = self.codegen_rvalue_operand(bx, rvalue); self.locals[index] = LocalRef::Operand(Some(operand)); bx } @@ -44,42 +44,42 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { } // If the type is zero-sized, it's already been set here, - // but we still need to make sure we translate the operand - self.trans_rvalue_operand(bx, rvalue).0 + // but we still need to make sure we codegen the operand + self.codegen_rvalue_operand(bx, rvalue).0 } } } else { - let tr_dest = self.trans_place(&bx, place); - self.trans_rvalue(bx, tr_dest, rvalue) + let cg_dest = self.codegen_place(&bx, place); + self.codegen_rvalue(bx, cg_dest, rvalue) } } mir::StatementKind::SetDiscriminant{ref place, variant_index} => { - self.trans_place(&bx, place) - .trans_set_discr(&bx, variant_index); + self.codegen_place(&bx, place) + .codegen_set_discr(&bx, variant_index); bx } mir::StatementKind::StorageLive(local) => { - if let LocalRef::Place(tr_place) = self.locals[local] { - tr_place.storage_live(&bx); + if let LocalRef::Place(cg_place) = self.locals[local] { + cg_place.storage_live(&bx); } bx } mir::StatementKind::StorageDead(local) => { - if let LocalRef::Place(tr_place) = self.locals[local] { - tr_place.storage_dead(&bx); + if let LocalRef::Place(cg_place) = self.locals[local] { + cg_place.storage_dead(&bx); } bx } mir::StatementKind::InlineAsm { ref asm, ref outputs, ref inputs } => { let outputs = outputs.iter().map(|output| { - self.trans_place(&bx, output) + self.codegen_place(&bx, output) }).collect(); let input_vals = inputs.iter().map(|input| { - self.trans_operand(&bx, input).immediate() + self.codegen_operand(&bx, input).immediate() }).collect(); - asm::trans_inline_asm(&bx, asm, outputs, input_vals); + asm::codegen_inline_asm(&bx, asm, outputs, input_vals); bx } mir::StatementKind::EndRegion(_) | diff --git a/src/librustc_trans/trans_item.rs b/src/librustc_codegen_llvm/mono_item.rs similarity index 97% rename from src/librustc_trans/trans_item.rs rename to src/librustc_codegen_llvm/mono_item.rs index d19b5af2527..6ba3582f014 100644 --- a/src/librustc_trans/trans_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -58,18 +58,18 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { }; let attrs = tcx.get_attrs(def_id); - consts::trans_static(&cx, def_id, is_mutable, &attrs); + consts::codegen_static(&cx, def_id, is_mutable, &attrs); } MonoItem::GlobalAsm(node_id) => { let item = cx.tcx.hir.expect_item(node_id); if let hir::ItemGlobalAsm(ref ga) = item.node { - asm::trans_global_asm(cx, ga); + asm::codegen_global_asm(cx, ga); } else { - span_bug!(item.span, "Mismatch between hir::Item type and TransItem type") + span_bug!(item.span, "Mismatch between hir::Item type and MonoItem type") } } MonoItem::Fn(instance) => { - base::trans_instance(&cx, instance); + base::codegen_instance(&cx, instance); } } 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/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 99% rename from src/librustc_trans/type_of.rs rename to src/librustc_codegen_llvm/type_of.rs index 32d26052aff..5f186e7514e 100644 --- a/src/librustc_trans/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -14,7 +14,7 @@ use rustc::hir; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout}; use rustc_target::spec::PanicStrategy; -use trans_item::DefPathBasedNames; +use mono_item::DefPathBasedNames; use type_::Type; use std::fmt::Write; 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_trans_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml similarity index 89% rename from src/librustc_trans_utils/Cargo.toml rename to src/librustc_codegen_utils/Cargo.toml index 323d9d1ceda..690fb260390 100644 --- a/src/librustc_trans_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -1,10 +1,10 @@ [package] authors = ["The Rust Project Developers"] -name = "rustc_trans_utils" +name = "rustc_codegen_utils" version = "0.0.0" [lib] -name = "rustc_trans_utils" +name = "rustc_codegen_utils" path = "lib.rs" crate-type = ["dylib"] test = false diff --git a/src/librustc_trans_utils/trans_crate.rs b/src/librustc_codegen_utils/codegen_backend.rs similarity index 83% rename from src/librustc_trans_utils/trans_crate.rs rename to src/librustc_codegen_utils/codegen_backend.rs index 7b585d1060f..15aab680289 100644 --- a/src/librustc_trans_utils/trans_crate.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -50,7 +50,7 @@ use link::{build_link_meta, out_filename}; pub use rustc_data_structures::sync::MetadataRef; -pub trait TransCrate { +pub trait CodegenBackend { fn init(&self, _sess: &Session) {} fn print(&self, _req: PrintRequest, _sess: &Session) {} fn target_features(&self, _sess: &Session) -> Vec { vec![] } @@ -61,57 +61,57 @@ pub trait TransCrate { fn metadata_loader(&self) -> Box; fn provide(&self, _providers: &mut Providers); fn provide_extern(&self, _providers: &mut Providers); - fn trans_crate<'a, 'tcx>( + fn codegen_crate<'a, 'tcx>( &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, rx: mpsc::Receiver> ) -> Box; - /// This is called on the returned `Box` from `trans_crate` + /// This is called on the returned `Box` from `codegen_backend` /// /// # Panics /// - /// Panics when the passed `Box` was not returned by `trans_crate`. - fn join_trans_and_link( + /// Panics when the passed `Box` was not returned by `codegen_backend`. + fn join_codegen_and_link( &self, - trans: Box, + ongoing_codegen: Box, sess: &Session, dep_graph: &DepGraph, outputs: &OutputFilenames, ) -> Result<(), CompileIncomplete>; } -pub struct DummyTransCrate; +pub struct DummyCodegenBackend; -impl TransCrate for DummyTransCrate { +impl CodegenBackend for DummyCodegenBackend { fn metadata_loader(&self) -> Box { box DummyMetadataLoader(()) } fn provide(&self, _providers: &mut Providers) { - bug!("DummyTransCrate::provide"); + bug!("DummyCodegenBackend::provide"); } fn provide_extern(&self, _providers: &mut Providers) { - bug!("DummyTransCrate::provide_extern"); + bug!("DummyCodegenBackend::provide_extern"); } - fn trans_crate<'a, 'tcx>( + fn codegen_crate<'a, 'tcx>( &self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, _rx: mpsc::Receiver> ) -> Box { - bug!("DummyTransCrate::trans_crate"); + bug!("DummyCodegenBackend::codegen_backend"); } - fn join_trans_and_link( + fn join_codegen_and_link( &self, - _trans: Box, + _ongoing_codegen: Box, _sess: &Session, _dep_graph: &DepGraph, _outputs: &OutputFilenames, ) -> Result<(), CompileIncomplete> { - bug!("DummyTransCrate::join_trans_and_link"); + bug!("DummyCodegenBackend::join_codegen_and_link"); } } @@ -167,20 +167,20 @@ impl MetadataLoader for NoLlvmMetadataLoader { } } -pub struct MetadataOnlyTransCrate(()); -pub struct OngoingCrateTranslation { +pub struct MetadataOnlyCodegenBackend(()); +pub struct OngoingCodegen { metadata: EncodedMetadata, metadata_version: Vec, crate_name: Symbol, } -impl MetadataOnlyTransCrate { - pub fn new() -> Box { - box MetadataOnlyTransCrate(()) +impl MetadataOnlyCodegenBackend { + pub fn new() -> Box { + box MetadataOnlyCodegenBackend(()) } } -impl TransCrate for MetadataOnlyTransCrate { +impl CodegenBackend for MetadataOnlyCodegenBackend { fn init(&self, sess: &Session) { for cty in sess.opts.crate_types.iter() { match *cty { @@ -208,7 +208,7 @@ impl TransCrate for MetadataOnlyTransCrate { } fn provide_extern(&self, _providers: &mut Providers) {} - fn trans_crate<'a, 'tcx>( + fn codegen_crate<'a, 'tcx>( &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _rx: mpsc::Receiver> @@ -228,17 +228,17 @@ impl TransCrate for MetadataOnlyTransCrate { ::rustc::middle::dependency_format::calculate(tcx); let _ = tcx.link_args(LOCAL_CRATE); let _ = tcx.native_libraries(LOCAL_CRATE); - for trans_item in + for mono_item in collector::collect_crate_mono_items( tcx, collector::MonoItemCollectionMode::Eager ).0 { - match trans_item { + match mono_item { MonoItem::Fn(inst) => { let def_id = inst.def_id(); if def_id.is_local() { let _ = inst.def.is_inline(tcx); - let _ = tcx.trans_fn_attrs(def_id); + let _ = tcx.codegen_fn_attrs(def_id); } } _ => {} @@ -249,36 +249,36 @@ impl TransCrate for MetadataOnlyTransCrate { let link_meta = build_link_meta(tcx.crate_hash(LOCAL_CRATE)); let metadata = tcx.encode_metadata(&link_meta); - box OngoingCrateTranslation { + box OngoingCodegen { metadata: metadata, metadata_version: tcx.metadata_encoding_version().to_vec(), crate_name: tcx.crate_name(LOCAL_CRATE), } } - fn join_trans_and_link( + fn join_codegen_and_link( &self, - trans: Box, + ongoing_codegen: Box, sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, ) -> Result<(), CompileIncomplete> { - let trans = trans.downcast::() - .expect("Expected MetadataOnlyTransCrate's OngoingCrateTranslation, found Box"); + let ongoing_codegen = ongoing_codegen.downcast::() + .expect("Expected MetadataOnlyCodegenBackend's OngoingCodegen, found Box"); for &crate_type in sess.opts.crate_types.iter() { if crate_type != CrateType::CrateTypeRlib && crate_type != CrateType::CrateTypeDylib { continue; } let output_name = - out_filename(sess, crate_type, &outputs, &trans.crate_name.as_str()); - let mut compressed = trans.metadata_version.clone(); + out_filename(sess, crate_type, &outputs, &ongoing_codegen.crate_name.as_str()); + let mut compressed = ongoing_codegen.metadata_version.clone(); let metadata = if crate_type == CrateType::CrateTypeDylib { DeflateEncoder::new(&mut compressed, Compression::fast()) - .write_all(&trans.metadata.raw_data) + .write_all(&ongoing_codegen.metadata.raw_data) .unwrap(); &compressed } else { - &trans.metadata.raw_data + &ongoing_codegen.metadata.raw_data }; let mut builder = Builder::new(File::create(&output_name).unwrap()); let header = Header::new("rust.metadata.bin".to_string(), metadata.len() as u64); diff --git a/src/librustc_trans_utils/lib.rs b/src/librustc_codegen_utils/lib.rs similarity index 92% rename from src/librustc_trans_utils/lib.rs rename to src/librustc_codegen_utils/lib.rs index b91f4e4dffb..0c18571f4ff 100644 --- a/src/librustc_trans_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -42,12 +42,12 @@ pub extern crate rustc as __rustc; use rustc::ty::TyCtxt; pub mod link; -pub mod trans_crate; +pub mod codegen_backend; pub mod symbol_names; pub mod symbol_names_test; /// check for the #[rustc_error] annotation, which forces an -/// error in trans. This is used to write compile-fail tests +/// error in codegen. This is used to write compile-fail tests /// that actually test that compilation succeeds without /// reporting an error. pub fn check_for_rustc_errors_attr(tcx: TyCtxt) { @@ -60,4 +60,4 @@ pub fn check_for_rustc_errors_attr(tcx: TyCtxt) { } } -__build_diagnostic_array! { librustc_trans_utils, DIAGNOSTICS } +__build_diagnostic_array! { librustc_codegen_utils, DIAGNOSTICS } diff --git a/src/librustc_trans_utils/link.rs b/src/librustc_codegen_utils/link.rs similarity index 100% rename from src/librustc_trans_utils/link.rs rename to src/librustc_codegen_utils/link.rs diff --git a/src/librustc_trans_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs similarity index 99% rename from src/librustc_trans_utils/symbol_names.rs rename to src/librustc_codegen_utils/symbol_names.rs index be5bff60805..1a62f39ae3d 100644 --- a/src/librustc_trans_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -277,7 +277,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance return tcx.item_name(def_id).to_string(); } - if let Some(name) = tcx.trans_fn_attrs(def_id).export_name { + if let Some(name) = tcx.codegen_fn_attrs(def_id).export_name { // Use provided name return name.to_string(); } diff --git a/src/librustc_trans_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs similarity index 100% rename from src/librustc_trans_utils/symbol_names_test.rs rename to src/librustc_codegen_utils/symbol_names_test.rs diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 1827533f0ac..24bf07d793f 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -31,7 +31,7 @@ rustc_privacy = { path = "../librustc_privacy" } rustc_resolve = { path = "../librustc_resolve" } rustc_save_analysis = { path = "../librustc_save_analysis" } rustc_traits = { path = "../librustc_traits" } -rustc_trans_utils = { path = "../librustc_trans_utils" } +rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_typeck = { path = "../librustc_typeck" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 62b3accc46f..ed28b05c125 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -32,7 +32,7 @@ use rustc_resolve::{MakeGlobMap, Resolver, ResolverArenas}; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; use rustc_traits; -use rustc_trans_utils::trans_crate::TransCrate; +use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_typeck as typeck; use rustc_privacy; use rustc_plugin::registry::Registry; @@ -110,7 +110,7 @@ pub fn spawn_thread_pool R + sync::Send, R: sync:: } pub fn compile_input( - trans: Box, + codegen_backend: Box, sess: &Session, cstore: &CStore, input_path: &Option, @@ -143,7 +143,7 @@ pub fn compile_input( // We need nested scopes here, because the intermediate results can keep // large chunks of memory alive and we want to free them as soon as // possible to keep the peak memory usage low - let (outputs, ongoing_trans, dep_graph) = { + let (outputs, ongoing_codegen, dep_graph) = { let krate = match phase_1_parse_input(control, sess, input) { Ok(krate) => krate, Err(mut parse_error) => { @@ -162,7 +162,7 @@ pub fn compile_input( let outputs = build_output_filenames(input, outdir, output, &krate.attrs, sess); let crate_name = - ::rustc_trans_utils::link::find_crate_name(Some(sess), &krate.attrs, input); + ::rustc_codegen_utils::link::find_crate_name(Some(sess), &krate.attrs, input); install_panic_hook(); let ExpansionResult { @@ -274,7 +274,7 @@ pub fn compile_input( }; phase_3_run_analysis_passes( - &*trans, + &*codegen_backend, control, sess, cstore, @@ -310,14 +310,14 @@ pub fn compile_input( result?; if log_enabled!(::log::Level::Info) { - println!("Pre-trans"); + println!("Pre-codegen"); tcx.print_debug_stats(); } - let ongoing_trans = phase_4_translate_to_llvm(&*trans, tcx, rx); + let ongoing_codegen = phase_4_codegen(&*codegen_backend, tcx, rx); if log_enabled!(::log::Level::Info) { - println!("Post-trans"); + println!("Post-codegen"); tcx.print_debug_stats(); } @@ -328,7 +328,7 @@ pub fn compile_input( } } - Ok((outputs.clone(), ongoing_trans, tcx.dep_graph.clone())) + Ok((outputs.clone(), ongoing_codegen, tcx.dep_graph.clone())) }, )?? }; @@ -337,7 +337,7 @@ pub fn compile_input( sess.code_stats.borrow().print_type_sizes(); } - trans.join_trans_and_link(ongoing_trans, sess, &dep_graph, &outputs)?; + codegen_backend.join_codegen_and_link(ongoing_codegen, sess, &dep_graph, &outputs)?; if sess.opts.debugging_opts.perf_stats { sess.print_perf_stats(); @@ -1089,7 +1089,7 @@ pub fn default_provide_extern(providers: &mut ty::maps::Providers) { /// 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>( - trans: &TransCrate, + codegen_backend: &CodegenBackend, control: &CompileController, sess: &'tcx Session, cstore: &'tcx CrateStoreDyn, @@ -1128,12 +1128,12 @@ where let mut local_providers = ty::maps::Providers::default(); default_provide(&mut local_providers); - trans.provide(&mut local_providers); + codegen_backend.provide(&mut local_providers); (control.provide)(&mut local_providers); let mut extern_providers = local_providers; default_provide_extern(&mut extern_providers); - trans.provide_extern(&mut extern_providers); + codegen_backend.provide_extern(&mut extern_providers); (control.provide_extern)(&mut extern_providers); let (tx, rx) = mpsc::channel(); @@ -1233,10 +1233,10 @@ where ) } -/// Run the translation phase to LLVM, after which the AST and analysis can +/// Run the codegen backend, after which the AST and analysis can /// be discarded. -pub fn phase_4_translate_to_llvm<'a, 'tcx>( - trans: &TransCrate, +pub fn phase_4_codegen<'a, 'tcx>( + codegen_backend: &CodegenBackend, tcx: TyCtxt<'a, 'tcx, 'tcx>, rx: mpsc::Receiver>, ) -> Box { @@ -1244,12 +1244,12 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>( ::rustc::middle::dependency_format::calculate(tcx) }); - let translation = time(tcx.sess, "translation", move || trans.trans_crate(tcx, rx)); + let codegen = time(tcx.sess, "codegen", move || codegen_backend.codegen_crate(tcx, rx)); if tcx.sess.profile_queries() { profile::dump(&tcx.sess, "profile_queries".to_string()) } - translation + codegen } fn escape_dep_filename(filename: &FileName) -> String { @@ -1272,7 +1272,7 @@ fn generated_output_paths( // If the filename has been overridden using `-o`, it will not be modified // by appending `.rlib`, `.exe`, etc., so we can skip this transformation. OutputType::Exe if !exact_name => for crate_type in sess.crate_types.borrow().iter() { - let p = ::rustc_trans_utils::link::filename_for_input( + let p = ::rustc_codegen_utils::link::filename_for_input( sess, *crate_type, crate_name, @@ -1424,7 +1424,7 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec Vec(run_compiler: F) -> isize 0 } -fn load_backend_from_dylib(path: &Path) -> fn() -> Box { +fn load_backend_from_dylib(path: &Path) -> fn() -> Box { // Note that we're specifically using `open_global_now` here rather than // `open`, namely we want the behavior on Unix of RTLD_GLOBAL and RTLD_NOW, // where NOW means "bind everything right now" because we don't want @@ -233,24 +235,24 @@ fn load_backend_from_dylib(path: &Path) -> fn() -> Box { } } -pub fn get_trans(sess: &Session) -> Box { +pub fn get_codegen_backend(sess: &Session) -> Box { static INIT: Once = ONCE_INIT; #[allow(deprecated)] #[no_debug] - static mut LOAD: fn() -> Box = || unreachable!(); + static mut LOAD: fn() -> Box = || unreachable!(); INIT.call_once(|| { - let trans_name = sess.opts.debugging_opts.codegen_backend.as_ref() + let codegen_name = sess.opts.debugging_opts.codegen_backend.as_ref() .unwrap_or(&sess.target.target.options.codegen_backend); - let backend = match &trans_name[..] { + let backend = match &codegen_name[..] { "metadata_only" => { - rustc_trans_utils::trans_crate::MetadataOnlyTransCrate::new + rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new } filename if filename.contains(".") => { load_backend_from_dylib(filename.as_ref()) } - trans_name => get_trans_sysroot(trans_name), + codegen_name => get_codegen_sysroot(codegen_name), }; unsafe { @@ -262,15 +264,15 @@ pub fn get_trans(sess: &Session) -> Box { backend } -fn get_trans_sysroot(backend_name: &str) -> fn() -> Box { +fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { // For now we only allow this function to be called once as it'll dlopen a // few things, which seems to work best if we only do that once. In - // general this assertion never trips due to the once guard in `get_trans`, + // general this assertion never trips due to the once guard in `get_codegen_backend`, // but there's a few manual calls to this function in this file we protect // against. static LOADED: AtomicBool = ATOMIC_BOOL_INIT; assert!(!LOADED.fetch_or(true, Ordering::SeqCst), - "cannot load the default trans backend twice"); + "cannot load the default codegen backend twice"); // When we're compiling this library with `--test` it'll run as a binary but // not actually exercise much functionality. As a result most of the logic @@ -278,7 +280,7 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box { // let's just return a dummy creation function which won't be used in // general anyway. if cfg!(test) { - return rustc_trans_utils::trans_crate::MetadataOnlyTransCrate::new + return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new } let target = session::config::host_triple(); @@ -346,7 +348,7 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box { let mut file: Option = None; - let expected_name = format!("rustc_trans-{}", backend_name); + let expected_name = format!("rustc_codegen_llvm-{}", backend_name); for entry in d.filter_map(|e| e.ok()) { let path = entry.path(); let filename = match path.file_name().and_then(|s| s.to_str()) { @@ -520,20 +522,20 @@ fn run_compiler_with_pool<'a>( return (Err(CompileIncomplete::Stopped), Some(sess)); } - let trans = get_trans(&sess); + let codegen_backend = get_codegen_backend(&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, &*trans); + target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let result = { let plugins = sess.opts.debugging_opts.extra_plugins.clone(); - let cstore = CStore::new(trans.metadata_loader()); + let cstore = CStore::new(codegen_backend.metadata_loader()); - do_or_return!(callbacks.late_callback(&*trans, + do_or_return!(callbacks.late_callback(&*codegen_backend, &matches, &sess, &cstore, @@ -545,7 +547,7 @@ fn run_compiler_with_pool<'a>( let control = callbacks.build_controller(&sess, &matches); - driver::compile_input(trans, + driver::compile_input(codegen_backend, &sess, &cstore, &input_file_path, @@ -659,7 +661,7 @@ pub trait CompilerCalls<'a> { // be called just before actual compilation starts (and before build_controller // is called), after all arguments etc. have been completely handled. fn late_callback(&mut self, - _: &TransCrate, + _: &CodegenBackend, _: &getopts::Matches, _: &Session, _: &CrateStore, @@ -841,11 +843,11 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { } rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, cfg.clone()); - let trans = get_trans(&sess); - target_features::add_configuration(&mut cfg, &sess, &*trans); + let codegen_backend = get_codegen_backend(&sess); + target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let should_stop = RustcDefaultCalls::print_crate_info( - &*trans, + &*codegen_backend, &sess, None, odir, @@ -863,7 +865,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { } fn late_callback(&mut self, - trans: &TransCrate, + codegen_backend: &CodegenBackend, matches: &getopts::Matches, sess: &Session, cstore: &CrateStore, @@ -871,7 +873,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { odir: &Option, ofile: &Option) -> Compilation { - RustcDefaultCalls::print_crate_info(trans, sess, Some(input), odir, ofile) + RustcDefaultCalls::print_crate_info(codegen_backend, sess, Some(input), odir, ofile) .and_then(|| RustcDefaultCalls::list_metadata(sess, cstore, matches, input)) } @@ -1000,7 +1002,7 @@ impl RustcDefaultCalls { } - fn print_crate_info(trans: &TransCrate, + fn print_crate_info(codegen_backend: &CodegenBackend, sess: &Session, input: Option<&Input>, odir: &Option, @@ -1042,14 +1044,14 @@ impl RustcDefaultCalls { }; let attrs = attrs.as_ref().unwrap(); let t_outputs = driver::build_output_filenames(input, odir, ofile, attrs, sess); - let id = rustc_trans_utils::link::find_crate_name(Some(sess), attrs, input); + let id = rustc_codegen_utils::link::find_crate_name(Some(sess), attrs, input); if *req == PrintRequest::CrateName { println!("{}", id); continue; } let crate_types = driver::collect_crate_types(sess, attrs); for &style in &crate_types { - let fname = rustc_trans_utils::link::filename_for_input( + let fname = rustc_codegen_utils::link::filename_for_input( sess, style, &id, @@ -1102,7 +1104,7 @@ impl RustcDefaultCalls { } } RelocationModels | CodeModels | TlsModels | TargetCPUs | TargetFeatures => { - trans.print(*req, sess); + codegen_backend.print(*req, sess); } // Any output here interferes with Cargo's parsing of other printed output PrintRequest::NativeStaticLibs => {} @@ -1143,7 +1145,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())); - get_trans_sysroot("llvm")().print_version(); + get_codegen_sysroot("llvm")().print_version(); } } @@ -1451,7 +1453,7 @@ pub fn handle_options(args: &[String]) -> Option { } if cg_flags.contains(&"passes=list".to_string()) { - get_trans_sysroot("llvm")().print_passes(); + get_codegen_sysroot("llvm")().print_passes(); return None; } @@ -1663,8 +1665,8 @@ pub fn diagnostics_registry() -> errors::registry::Registry { all_errors.extend_from_slice(&rustc_resolve::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); // FIXME: need to figure out a way to get these back in here - // all_errors.extend_from_slice(get_trans(sess).diagnostics()); - all_errors.extend_from_slice(&rustc_trans_utils::DIAGNOSTICS); + // all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics()); + all_errors.extend_from_slice(&rustc_codegen_utils::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_passes::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_plugin::DIAGNOSTICS); diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 108b4762338..f1ad14237ee 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -228,8 +228,8 @@ impl PpSourceMode { } PpmTyped => { let control = &driver::CompileController::basic(); - let trans = ::get_trans(sess); - abort_on_err(driver::phase_3_run_analysis_passes(&*trans, + let codegen_backend = ::get_codegen_backend(sess); + abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, control, sess, cstore, @@ -1089,8 +1089,8 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let mut out = Vec::new(); let control = &driver::CompileController::basic(); - let trans = ::get_trans(sess); - abort_on_err(driver::phase_3_run_analysis_passes(&*trans, + let codegen_backend = ::get_codegen_backend(sess); + abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, control, sess, cstore, diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 78c95a5ce05..46f552ed28d 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -122,7 +122,7 @@ fn test_env_with_pool( None, diagnostic_handler, Lrc::new(CodeMap::new(FilePathMapping::empty()))); - let cstore = CStore::new(::get_trans(&sess).metadata_loader()); + let cstore = CStore::new(::get_codegen_backend(&sess).metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let input = config::Input::Str { name: FileName::Anon, diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 38e891008f7..c317d31b95a 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -13,7 +13,7 @@ //! will dump graphs in graphviz form to disk, and it searches for //! `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]` //! annotations. These annotations can be used to test whether paths -//! exist in the graph. These checks run after trans, so they view the +//! exist in the graph. These checks run after codegen, so they view the //! the final state of the dependency graph. Note that there are //! similar assertions found in `persist::dirty_clean` which check the //! **initial** state of the dependency graph, just after it has been @@ -36,10 +36,10 @@ //! #[rustc_if_this_changed(Hir)] //! fn foo() { } //! -//! #[rustc_then_this_would_need(trans)] //~ ERROR no path from `foo` +//! #[rustc_then_this_would_need(codegen)] //~ ERROR no path from `foo` //! fn bar() { } //! -//! #[rustc_then_this_would_need(trans)] //~ ERROR OK +//! #[rustc_then_this_would_need(codegen)] //~ ERROR OK //! fn baz() { foo(); } //! ``` diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 6906dacfc5e..df8e0f056af 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -16,7 +16,7 @@ //! //! ``` //! #![rustc_partition_reused(module="spike", cfg="rpass2")] -//! #![rustc_partition_translated(module="spike-x", cfg="rpass2")] +//! #![rustc_partition_codegened(module="spike-x", cfg="rpass2")] //! ``` //! //! The first indicates (in the cfg `rpass2`) that `spike.o` will be @@ -32,13 +32,13 @@ use rustc::mir::mono::CodegenUnit; use rustc::ty::TyCtxt; use syntax::ast; use syntax_pos::symbol::Symbol; -use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_TRANSLATED}; +use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED}; const MODULE: &'static str = "module"; const CFG: &'static str = "cfg"; #[derive(Debug, PartialEq, Clone, Copy)] -enum Disposition { Reused, Translated } +enum Disposition { Reused, Codegened } pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { @@ -61,8 +61,8 @@ impl<'a, 'tcx> AssertModuleSource<'a, 'tcx> { fn check_attr(&self, attr: &ast::Attribute) { let disposition = if attr.check_name(ATTR_PARTITION_REUSED) { Disposition::Reused - } else if attr.check_name(ATTR_PARTITION_TRANSLATED) { - Disposition::Translated + } else if attr.check_name(ATTR_PARTITION_CODEGENED) { + Disposition::Codegened } else { return; }; @@ -84,17 +84,17 @@ impl<'a, 'tcx> AssertModuleSource<'a, 'tcx> { (Disposition::Reused, false) => { self.tcx.sess.span_err( attr.span, - &format!("expected module named `{}` to be Reused but is Translated", + &format!("expected module named `{}` to be Reused but is Codegened", mname)); } - (Disposition::Translated, true) => { + (Disposition::Codegened, true) => { self.tcx.sess.span_err( attr.span, - &format!("expected module named `{}` to be Translated but is Reused", + &format!("expected module named `{}` to be Codegened but is Reused", mname)); } (Disposition::Reused, true) | - (Disposition::Translated, false) => { + (Disposition::Codegened, false) => { // These are what we would expect. } } diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index e114606a631..8f406161831 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -239,8 +239,8 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { intravisit::walk_crate(&mut all_attrs, krate); // Note that we cannot use the existing "unused attribute"-infrastructure - // here, since that is running before trans. This is also the reason why - // all trans-specific attributes are `Whitelisted` in syntax::feature_gate. + // here, since that is running before codegen. This is also the reason why + // all codegen-specific attributes are `Whitelisted` in syntax::feature_gate. all_attrs.report_unchecked_attrs(&dirty_clean_visitor.checked_attrs); }) } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 32963146893..2abe361233f 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -432,7 +432,7 @@ enum FfiResult<'tcx> { /// "nullable pointer optimization". Currently restricted /// to function pointers and references, but could be /// expanded to cover NonZero raw pointers and newtypes. -/// FIXME: This duplicates code in trans. +/// FIXME: This duplicates code in codegen. fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def: &'tcx ty::AdtDef, substs: &Substs<'tcx>) diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index c1e32c7c022..0497de940ca 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -515,7 +515,7 @@ pub enum ModuleBuffer {} // dllimport/dllexport are applied and need to be correct for everything to // link successfully. The #[link] annotation here says "these symbols are // included statically" which means that they're all exported with dllexport -// and from the rustc_llvm dynamic library. Otherwise the rustc_trans dynamic +// and from the rustc_llvm dynamic library. Otherwise the rustc_codegen_llvm dynamic // library would not be able to access these symbols. #[link(name = "rustllvm", kind = "static")] extern "C" { diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index bf8a087ab55..07830d54d0c 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -138,7 +138,7 @@ pub fn SetFunctionCallConv(fn_: ValueRef, cc: CallConv) { } } -// Externally visible symbols that might appear in multiple translation units need to appear in +// Externally visible symbols that might appear in multiple codegen units need to appear in // their own comdat section so that the duplicates can be discarded at link time. This can for // example happen for generics when using multiple codegen units. This function simply uses the // value's name as the comdat value to make sure that it is in a 1-to-1 relationship to the diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index 0a1662dd42d..b38c1235573 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -14,7 +14,7 @@ register_long_diagnostics! { E0454: r##" A link name was given with an empty name. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-trans) +```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) #[link(name = "")] extern {} // error: #[link(name = "")] given with empty name ``` @@ -51,7 +51,7 @@ https://doc.rust-lang.org/book/first-edition/conditional-compilation.html E0458: r##" An unknown "kind" was specified for a link attribute. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-trans) +```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) #[link(kind = "wonderful_unicorn")] extern {} // error: unknown kind: `wonderful_unicorn` ``` @@ -67,7 +67,7 @@ Please specify a valid "kind" value, from one of the following: E0459: r##" A link was used without a name parameter. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-trans) +```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) #[link(kind = "dylib")] extern {} // error: #[link(...)] specified without `name = "foo"` ``` diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 3de90abd966..bbc4120f060 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -868,7 +868,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { fn metadata_output_only(&self) -> bool { // MIR optimisation can be skipped when we're just interested in the metadata. - !self.tcx.sess.opts.output_types.should_trans() + !self.tcx.sess.opts.output_types.should_codegen() } fn const_qualif(&self, mir: u8, body_id: hir::BodyId) -> ConstQualif { @@ -930,7 +930,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ImplItemKind::Method(ref sig, _) => { let generics = self.tcx.generics_of(def_id); let needs_inline = (generics.requires_monomorphization(self.tcx) || - tcx.trans_fn_attrs(def_id).requests_inline()) && + tcx.codegen_fn_attrs(def_id).requests_inline()) && !self.metadata_output_only(); let is_const_fn = sig.constness == hir::Constness::Const; let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; @@ -1224,8 +1224,9 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ItemConst(..) => self.encode_optimized_mir(def_id), hir::ItemFn(_, _, constness, _, ref generics, _) => { let has_tps = generics.ty_params().next().is_some(); - let needs_inline = (has_tps || tcx.trans_fn_attrs(def_id).requests_inline()) && - !self.metadata_output_only(); + let needs_inline = + (has_tps || tcx.codegen_fn_attrs(def_id).requests_inline()) && + !self.metadata_output_only(); let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir; if needs_inline || constness == hir::Constness::Const || always_encode_mir { self.encode_optimized_mir(def_id) diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 20e11abca9f..4115dbe6274 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -140,7 +140,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty)) } ExprKind::Array { fields } => { - // (*) We would (maybe) be closer to trans if we + // (*) We would (maybe) be closer to codegen if we // handled this and other aggregate cases via // `into()`, not `as_rvalue` -- in that case, instead // of generating diff --git a/src/librustc_mir/build/expr/mod.rs b/src/librustc_mir/build/expr/mod.rs index 025e77343e7..0fd4b8e7e23 100644 --- a/src/librustc_mir/build/expr/mod.rs +++ b/src/librustc_mir/build/expr/mod.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Translates expressions into MIR. As a caller into this module, you +//! Builds MIR from expressions. As a caller into this module, you //! have many options, but the first thing you have to decide is //! whether you are evaluating this expression for its *value*, its //! *location*, or as a *constant*. @@ -41,7 +41,7 @@ //! ### Implementation notes //! //! For any given kind of expression, there is generally one way that -//! can be translated most naturally. This is specified by the +//! can be lowered most naturally. This is specified by the //! `Category::of` function in the `category` module. For example, a //! struct expression (or other expression that creates a new value) //! is typically easiest to write in terms of `as_rvalue` or `into`, diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 6946ac4c7b2..f3953d0877c 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -896,7 +896,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .map(|b| GuardFrameLocal::new(b.var_id, b.binding_mode)) .collect(), }; - debug!("Entering guard translation context: {:?}", guard_frame); + debug!("Entering guard building context: {:?}", guard_frame); self.guard_context.push(guard_frame); } else { self.bind_matched_candidate_for_arm_body(block, &candidate.bindings, false); @@ -909,7 +909,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let cond = unpack!(block = self.as_local_operand(block, guard)); if autoref { let guard_frame = self.guard_context.pop().unwrap(); - debug!("Exiting guard translation context with locals: {:?}", guard_frame); + debug!("Exiting guard building context with locals: {:?}", guard_frame); } let false_edge_block = self.cfg.start_new_block(); diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index afbcf100b05..3bbf73ec8b5 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -775,7 +775,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /////////////////////////////////////////////////////////////////////////// // Builder methods are broken up into modules, depending on what kind -// of thing is being translated. Note that they use the `unpack` macro +// of thing is being lowered. Note that they use the `unpack` macro // above extensively. mod block; diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index a631ab27d1c..5dc59ac9f41 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -10,7 +10,7 @@ /*! Managing the scope stack. The scopes are tied to lexical scopes, so as -we descend the HAIR, we push a scope on the stack, translate ite +we descend the HAIR, we push a scope on the stack, build its contents, and then pop it off. Every scope is named by a `region::Scope`. @@ -30,7 +30,7 @@ them. Eventually, when we shift to non-lexical lifetimes, there should be no need to remember this mapping. There is one additional wrinkle, actually, that I wanted to hide from -you but duty compels me to mention. In the course of translating +you but duty compels me to mention. In the course of building matches, it sometimes happen that certain code (namely guards) gets executed multiple times. This means that the scope lexical scope may in fact correspond to multiple, disjoint SEME regions. So in fact our @@ -38,7 +38,7 @@ mapping is from one scope to a vector of SEME regions. ### Drops -The primary purpose for scopes is to insert drops: while translating +The primary purpose for scopes is to insert drops: while building the contents, we also accumulate places that need to be dropped upon exit from each scope. This is done by calling `schedule_drop`. Once a drop is scheduled, whenever we branch out we will insert drops of all diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 14aa307f0ae..5ef1eef133d 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -20,7 +20,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { type Output = Block<'tcx>; fn make_mirror<'a, 'gcx>(self, cx: &mut Cx<'a, 'gcx, 'tcx>) -> Block<'tcx> { - // We have to eagerly translate the "spine" of the statements + // We have to eagerly lower the "spine" of the statements // in order to get the lexical scoping correctly. let stmts = mirror_stmts(cx, self.hir_id.local_id, &*self.stmts); let opt_destruction_scope = diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 4765a82d85b..b01b3542136 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -77,7 +77,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { // Some functions always have overflow checks enabled, // however, they may not get codegen'd, depending on - // the settings for the crate they are translated in. + // the settings for the crate they are codegened in. let mut check_overflow = attr::contains_name(attrs, "rustc_inherit_overflow_checks"); // Respect -C overflow-checks. diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index c27250267bb..ab9acdc4950 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! The MIR is translated from some high-level abstract IR +//! The MIR is built from some high-level abstract IR //! (HAIR). This section defines the HAIR along with a trait for //! accessing it. The intention is to allow MIR construction to be //! unit-tested and separated from the Rust source and compiler data @@ -107,12 +107,12 @@ pub enum StmtKind<'tcx> { }, } -/// The Hair trait implementor translates their expressions (`&'tcx H::Expr`) -/// into instances of this `Expr` enum. This translation can be done +/// The Hair trait implementor lowers their expressions (`&'tcx H::Expr`) +/// into instances of this `Expr` enum. This lowering can be done /// basically as lazily or as eagerly as desired: every recursive /// reference to an expression in this enum is an `ExprRef<'tcx>`, which /// may in turn be another instance of this enum (boxed), or else an -/// untranslated `&'tcx H::Expr`. Note that instances of `Expr` are very +/// unlowered `&'tcx H::Expr`. Note that instances of `Expr` are very /// shortlived. They are created by `Hair::to_expr`, analyzed and /// converted into MIR, and then discarded. /// diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index dc2009a0260..c62eb1cf185 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -188,7 +188,7 @@ //! this is not implemented however: a mono item will be produced //! regardless of whether it is actually needed or not. -use rustc::hir::{self, TransFnAttrFlags}; +use rustc::hir::{self, CodegenFnAttrFlags}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::map as hir_map; @@ -343,9 +343,9 @@ fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, visitor.push_extra_entry_roots(); } - // We can only translate items that are instantiable - items all of + // We can only codegen items that are instantiable - items all of // whose predicates hold. Luckily, items that aren't instantiable - // can't actually be used, so we can just skip translating them. + // can't actually be used, so we can just skip codegenning them. roots.retain(|root| root.is_instantiable(tcx)); roots @@ -717,7 +717,7 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -// Returns true if we should translate an instance in the local crate. +// Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instance<'tcx>) @@ -734,7 +734,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: return match tcx.hir.get_if_local(def_id) { Some(hir_map::NodeForeignItem(..)) => { - false // foreign items are linked against, not translated. + false // foreign items are linked against, not codegened. } Some(_) => true, None => { @@ -1015,8 +1015,8 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { MonoItemCollectionMode::Lazy => { self.entry_fn == Some(def_id) || self.tcx.is_reachable_non_generic(def_id) || - self.tcx.trans_fn_attrs(def_id).flags.contains( - TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) + self.tcx.codegen_fn_attrs(def_id).flags.contains( + CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) } } } diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index a569ad00d0c..27f8254bf8a 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -29,7 +29,7 @@ use syntax_pos::symbol::Symbol; use syntax::codemap::Span; pub use rustc::mir::mono::MonoItem; -/// Describes how a translation item will be instantiated in object files. +/// Describes how a monomorphization will be instantiated in object files. #[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)] pub enum InstantiationMode { /// There will be exactly one instance of the given MonoItem. It will have @@ -37,7 +37,7 @@ pub enum InstantiationMode { GloballyShared { /// In some compilation scenarios we may decide to take functions that /// are typically `LocalCopy` and instead move them to `GloballyShared` - /// to avoid translating them a bunch of times. In this situation, + /// to avoid codegenning them a bunch of times. In this situation, /// however, our local copy may conflict with other crates also /// inlining the same function. /// @@ -114,7 +114,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { // creating one copy of this `#[inline]` function which may // conflict with upstream crates as it could be an exported // symbol. - match tcx.trans_fn_attrs(instance.def_id()).inline { + match tcx.codegen_fn_attrs(instance.def_id()).inline { InlineAttr::Always => InstantiationMode::LocalCopy, _ => { InstantiationMode::GloballyShared { may_conflict: true } @@ -137,19 +137,19 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { MonoItem::GlobalAsm(..) => return None, }; - let trans_fn_attrs = tcx.trans_fn_attrs(def_id); - trans_fn_attrs.linkage + let codegen_fn_attrs = tcx.codegen_fn_attrs(def_id); + codegen_fn_attrs.linkage } /// Returns whether this instance is instantiable - whether it has no unsatisfied /// predicates. /// - /// In order to translate an item, all of its predicates must hold, because + /// In order to codegen an item, all of its predicates must hold, because /// otherwise the item does not make sense. Type-checking ensures that /// the predicates of every item that is *used by* a valid item *do* /// hold, so we can rely on that. /// - /// However, we translate collector roots (reachable items) and functions + /// However, we codegen collector roots (reachable items) and functions /// in vtables when they are seen, even if they are not used, and so they /// might not be instantiable. For example, a programmer can define this /// public function: @@ -158,7 +158,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { /// <&mut () as Clone>::clone(&s); /// } /// - /// That function can't be translated, because the method `<&mut () as Clone>::clone` + /// That function can't be codegened, because the method `<&mut () as Clone>::clone` /// does not exist. Luckily for us, that function can't ever be used, /// because that would require for `&'a mut (): Clone` to hold, so we /// can just not emit any code, or even a linker reference for it. @@ -229,7 +229,7 @@ impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { // MonoItem String Keys //=----------------------------------------------------------------------------- -// The code below allows for producing a unique string key for a trans item. +// The code below allows for producing a unique string key for a mono item. // These keys are used by the handwritten auto-tests, so they need to be // predictable and human-readable. // diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 04d4f7a3968..51793305513 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -23,11 +23,11 @@ pub mod item; pub mod partitioning; #[inline(never)] // give this a place in the profiler -pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trans_items: I) +pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mono_items: I) where I: Iterator> { - let mut symbols: Vec<_> = trans_items.map(|trans_item| { - (trans_item, trans_item.symbol_name(tcx)) + let mut symbols: Vec<_> = mono_items.map(|mono_item| { + (mono_item, mono_item.symbol_name(tcx)) }).collect(); (&mut symbols[..]).sort_by(|&(_, ref sym1), &(_, ref sym2)|{ @@ -39,11 +39,11 @@ pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tra let sym2 = &pair[1].1; if *sym1 == *sym2 { - let trans_item1 = pair[0].0; - let trans_item2 = pair[1].0; + let mono_item1 = pair[0].0; + let mono_item2 = pair[1].0; - let span1 = trans_item1.local_span(tcx); - let span2 = trans_item2.local_span(tcx); + let span1 = mono_item1.local_span(tcx); + let span2 = mono_item2.local_span(tcx); // Deterministically select one of the spans for error reporting let span = match (span1, span2) { @@ -111,7 +111,7 @@ fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind, } (ty::ClosureKind::Fn, ty::ClosureKind::FnMut) => { // The closure fn `llfn` is a `fn(&self, ...)`. We want a - // `fn(&mut self, ...)`. In fact, at trans time, these are + // `fn(&mut self, ...)`. In fact, at codegen time, these are // basically the same thing, so we can just return llfn. Ok(false) } @@ -124,7 +124,7 @@ fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind, // fn call_once(self, ...) { call_mut(&self, ...) } // fn call_once(mut self, ...) { call_mut(&mut self, ...) } // - // These are both the same at trans time. + // These are both the same at codegen time. Ok(true) } _ => Err(()), @@ -167,7 +167,7 @@ pub fn custom_coerce_unsize_info<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, substs: tcx.mk_substs_trait(source_ty, &[target_ty]) }); - match tcx.trans_fulfill_obligation( (ty::ParamEnv::reveal_all(), trait_ref)) { + match tcx.codegen_fulfill_obligation( (ty::ParamEnv::reveal_all(), trait_ref)) { traits::VtableImpl(traits::VtableImplData { impl_def_id, .. }) => { tcx.coerce_unsized_info(impl_def_id).custom_kind.unwrap() } diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 3a65cd4ea77..9607a84124a 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -11,16 +11,16 @@ //! Partitioning Codegen Units for Incremental Compilation //! ====================================================== //! -//! The task of this module is to take the complete set of translation items of +//! The task of this module is to take the complete set of monomorphizations of //! a crate and produce a set of codegen units from it, where a codegen unit -//! is a named set of (translation-item, linkage) pairs. That is, this module -//! decides which translation item appears in which codegen units with which +//! is a named set of (mono-item, linkage) pairs. That is, this module +//! decides which monomorphization appears in which codegen units with which //! linkage. The following paragraphs describe some of the background on the //! partitioning scheme. //! //! The most important opportunity for saving on compilation time with -//! incremental compilation is to avoid re-translating and re-optimizing code. -//! Since the unit of translation and optimization for LLVM is "modules" or, how +//! incremental compilation is to avoid re-codegenning and re-optimizing code. +//! Since the unit of codegen and optimization for LLVM is "modules" or, how //! we call them "codegen units", the particulars of how much time can be saved //! by incremental compilation are tightly linked to how the output program is //! partitioned into these codegen units prior to passing it to LLVM -- @@ -214,17 +214,17 @@ fn fallback_cgu_name(tcx: TyCtxt) -> InternedString { pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - trans_items: I, + mono_items: I, strategy: PartitioningStrategy, inlining_map: &InliningMap<'tcx>) -> Vec> where I: Iterator> { - // In the first step, we place all regular translation items into their - // respective 'home' codegen unit. Regular translation items are all + // In the first step, we place all regular monomorphizations into their + // respective 'home' codegen unit. Regular monomorphizations are all // functions and statics defined in the local crate. - let mut initial_partitioning = place_root_translation_items(tcx, - trans_items); + let mut initial_partitioning = place_root_mono_items(tcx, + mono_items); initial_partitioning.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(&tcx)); @@ -239,10 +239,10 @@ pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } // In the next step, we use the inlining map to determine which additional - // translation items have to go into each codegen unit. These additional - // translation items can be drop-glue, functions from external crates, and + // monomorphizations have to go into each codegen unit. These additional + // monomorphizations can be drop-glue, functions from external crates, and // local functions the definition of which is marked with #[inline]. - let mut post_inlining = place_inlined_translation_items(initial_partitioning, + let mut post_inlining = place_inlined_mono_items(initial_partitioning, inlining_map); post_inlining.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(&tcx)); @@ -258,7 +258,7 @@ pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Finally, sort by codegen unit name, so that we get deterministic results let PostInliningPartitioning { codegen_units: mut result, - trans_item_placements: _, + mono_item_placements: _, internalization_candidates: _, } = post_inlining; @@ -275,23 +275,23 @@ struct PreInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -/// For symbol internalization, we need to know whether a symbol/trans-item is +/// For symbol internalization, we need to know whether a symbol/mono-item is /// accessed from outside the codegen unit it is defined in. This type is used /// to keep track of that. #[derive(Clone, PartialEq, Eq, Debug)] -enum TransItemPlacement { +enum MonoItemPlacement { SingleCgu { cgu_name: InternedString }, MultipleCgus, } struct PostInliningPartitioning<'tcx> { codegen_units: Vec>, - trans_item_placements: FxHashMap, TransItemPlacement>, + mono_item_placements: FxHashMap, MonoItemPlacement>, internalization_candidates: FxHashSet>, } -fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - trans_items: I) +fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + mono_items: I) -> PreInliningPartitioning<'tcx> where I: Iterator> { @@ -307,15 +307,15 @@ fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let export_generics = tcx.share_generics() && tcx.local_crate_exports_generics(); - for trans_item in trans_items { - match trans_item.instantiation_mode(tcx) { + for mono_item in mono_items { + match mono_item.instantiation_mode(tcx) { InstantiationMode::GloballyShared { .. } => {} InstantiationMode::LocalCopy => continue, } - let characteristic_def_id = characteristic_def_id_of_trans_item(tcx, trans_item); + let characteristic_def_id = characteristic_def_id_of_mono_item(tcx, mono_item); let is_volatile = is_incremental_build && - trans_item.is_generic_fn(); + mono_item.is_generic_fn(); let codegen_unit_name = match characteristic_def_id { Some(def_id) => compute_codegen_unit_name(tcx, def_id, is_volatile), @@ -353,10 +353,10 @@ fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Visibility::Hidden } }; - let (linkage, mut visibility) = match trans_item.explicit_linkage(tcx) { + let (linkage, mut visibility) = match mono_item.explicit_linkage(tcx) { Some(explicit_linkage) => (explicit_linkage, Visibility::Default), None => { - match trans_item { + match mono_item { MonoItem::Fn(ref instance) => { let visibility = match instance.def { InstanceDef::Item(def_id) => { @@ -463,11 +463,11 @@ fn place_root_translation_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } }; if visibility == Visibility::Hidden && can_be_internalized { - internalization_candidates.insert(trans_item); + internalization_candidates.insert(mono_item); } - codegen_unit.items_mut().insert(trans_item, (linkage, visibility)); - roots.insert(trans_item); + codegen_unit.items_mut().insert(mono_item, (linkage, visibility)); + roots.insert(mono_item); } // always ensure we have at least one CGU; otherwise, if we have a @@ -522,11 +522,11 @@ fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning< } } -fn place_inlined_translation_items<'tcx>(initial_partitioning: PreInliningPartitioning<'tcx>, +fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<'tcx>, inlining_map: &InliningMap<'tcx>) -> PostInliningPartitioning<'tcx> { let mut new_partitioning = Vec::new(); - let mut trans_item_placements = FxHashMap(); + let mut mono_item_placements = FxHashMap(); let PreInliningPartitioning { codegen_units: initial_cgus, @@ -545,40 +545,40 @@ fn place_inlined_translation_items<'tcx>(initial_partitioning: PreInliningPartit let mut new_codegen_unit = CodegenUnit::new(old_codegen_unit.name().clone()); - // Add all translation items that are not already there - for trans_item in reachable { - if let Some(linkage) = old_codegen_unit.items().get(&trans_item) { + // Add all monomorphizations that are not already there + for mono_item in reachable { + if let Some(linkage) = old_codegen_unit.items().get(&mono_item) { // This is a root, just copy it over - new_codegen_unit.items_mut().insert(trans_item, *linkage); + new_codegen_unit.items_mut().insert(mono_item, *linkage); } else { - if roots.contains(&trans_item) { - bug!("GloballyShared trans-item inlined into other CGU: \ - {:?}", trans_item); + if roots.contains(&mono_item) { + bug!("GloballyShared mono-item inlined into other CGU: \ + {:?}", mono_item); } // This is a cgu-private copy new_codegen_unit.items_mut().insert( - trans_item, + mono_item, (Linkage::Internal, Visibility::Default), ); } if !single_codegen_unit { // If there is more than one codegen unit, we need to keep track - // in which codegen units each translation item is placed: - match trans_item_placements.entry(trans_item) { + // in which codegen units each monomorphization is placed: + match mono_item_placements.entry(mono_item) { Entry::Occupied(e) => { let placement = e.into_mut(); debug_assert!(match *placement { - TransItemPlacement::SingleCgu { ref cgu_name } => { + MonoItemPlacement::SingleCgu { ref cgu_name } => { *cgu_name != *new_codegen_unit.name() } - TransItemPlacement::MultipleCgus => true, + MonoItemPlacement::MultipleCgus => true, }); - *placement = TransItemPlacement::MultipleCgus; + *placement = MonoItemPlacement::MultipleCgus; } Entry::Vacant(e) => { - e.insert(TransItemPlacement::SingleCgu { + e.insert(MonoItemPlacement::SingleCgu { cgu_name: new_codegen_unit.name().clone() }); } @@ -591,18 +591,18 @@ fn place_inlined_translation_items<'tcx>(initial_partitioning: PreInliningPartit return PostInliningPartitioning { codegen_units: new_partitioning, - trans_item_placements, + mono_item_placements, internalization_candidates, }; - fn follow_inlining<'tcx>(trans_item: MonoItem<'tcx>, + fn follow_inlining<'tcx>(mono_item: MonoItem<'tcx>, inlining_map: &InliningMap<'tcx>, visited: &mut FxHashSet>) { - if !visited.insert(trans_item) { + if !visited.insert(mono_item) { return; } - inlining_map.with_inlining_candidates(trans_item, |target| { + inlining_map.with_inlining_candidates(mono_item, |target| { follow_inlining(target, inlining_map, visited); }); } @@ -625,7 +625,7 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, return; } - // Build a map from every translation item to all the translation items that + // Build a map from every monomorphization to all the monomorphizations that // reference it. let mut accessor_map: FxHashMap, Vec>> = FxHashMap(); inlining_map.iter_accesses(|accessor, accessees| { @@ -636,12 +636,12 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, } }); - let trans_item_placements = &partitioning.trans_item_placements; + let mono_item_placements = &partitioning.mono_item_placements; // For each internalization candidates in each codegen unit, check if it is // accessed from outside its defining codegen unit. for cgu in &mut partitioning.codegen_units { - let home_cgu = TransItemPlacement::SingleCgu { + let home_cgu = MonoItemPlacement::SingleCgu { cgu_name: cgu.name().clone() }; @@ -650,14 +650,14 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, // This item is no candidate for internalizing, so skip it. continue } - debug_assert_eq!(trans_item_placements[accessee], home_cgu); + debug_assert_eq!(mono_item_placements[accessee], home_cgu); if let Some(accessors) = accessor_map.get(accessee) { if accessors.iter() .filter_map(|accessor| { // Some accessors might not have been // instantiated. We can safely ignore those. - trans_item_placements.get(accessor) + mono_item_placements.get(accessor) }) .any(|placement| *placement != home_cgu) { // Found an accessor from another CGU, so skip to the next @@ -667,16 +667,16 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, } // If we got here, we did not find any accesses from other CGUs, - // so it's fine to make this translation item internal. + // so it's fine to make this monomorphization internal. *linkage_and_visibility = (Linkage::Internal, Visibility::Default); } } } -fn characteristic_def_id_of_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - trans_item: MonoItem<'tcx>) +fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + mono_item: MonoItem<'tcx>) -> Option { - match trans_item { + match mono_item { MonoItem::Fn(instance) => { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, @@ -771,14 +771,14 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for cgu in cgus { debug!("CodegenUnit {}:", cgu.name()); - for (trans_item, linkage) in cgu.items() { - let symbol_name = trans_item.symbol_name(tcx).name.as_str(); + for (mono_item, linkage) in cgu.items() { + let symbol_name = mono_item.symbol_name(tcx).name.as_str(); let symbol_hash_start = symbol_name.rfind('h'); let symbol_hash = symbol_hash_start.map(|i| &symbol_name[i ..]) .unwrap_or(""); debug!(" - {} [{:?}] [{}]", - trans_item.to_string(tcx), + mono_item.to_string(tcx), linkage, symbol_hash); } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index c79298d8dd2..2d2663bc7c3 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -69,8 +69,8 @@ fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ) } ty::InstanceDef::Virtual(def_id, _) => { - // We are translating a call back to our def-id, which - // trans::mir knows to turn to an actual virtual call. + // We are generating a call back to our def-id, which the + // codegen backend knows to turn to an actual virtual call. build_call_shim( tcx, def_id, diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 5be369f85bc..26927904440 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -30,7 +30,7 @@ pub use self::AddCallGuards::*; * do at the end of the predecessor block, or at the start of the * successor block. Critical edges have to be broken in order to prevent * "edge actions" from affecting other edges. We need this for calls that are - * translated to LLVM invoke instructions, because invoke is a block terminator + * codegened to LLVM invoke instructions, because invoke is a block terminator * in LLVM so we can't insert any code to handle the call's result into the * block that performs the call. * diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 56050318ca7..15b0c4a8bf7 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -442,7 +442,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { } /// Elaborate a MIR `replace` terminator. This instruction - /// is not directly handled by translation, and therefore + /// is not directly handled by codegen, and therefore /// must be desugared. /// /// The desugaring drops the location if needed, and then writes diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index cd5ebae2d9d..c697391d867 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -9,7 +9,7 @@ // except according to those terms. //! This pass erases all early-bound regions from the types occurring in the MIR. -//! We want to do this once just before trans, so trans does not have to take +//! We want to do this once just before codegen, so codegen does not have to take //! care erasing regions all over the place. //! NOTE: We do NOT erase regions of statements that are relevant for //! "types-as-contracts"-validation, namely, AcquireValid, ReleaseValid, and EndRegion. diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index ee6d42b1fe5..5fb9148d49a 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -11,7 +11,7 @@ //! Inlining pass for MIR functions use rustc::hir; -use rustc::hir::TransFnAttrFlags; +use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::DefId; use rustc_data_structures::bitvec::BitVector; @@ -211,16 +211,16 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { return false; } - // Do not inline {u,i}128 lang items, trans const eval depends + // Do not inline {u,i}128 lang items, codegen const eval depends // on detecting calls to these lang items and intercepting them if tcx.is_binop_lang_item(callsite.callee).is_some() { debug!(" not inlining 128bit integer lang item"); return false; } - let trans_fn_attrs = tcx.trans_fn_attrs(callsite.callee); + let codegen_fn_attrs = tcx.codegen_fn_attrs(callsite.callee); - let hinted = match trans_fn_attrs.inline { + let hinted = match codegen_fn_attrs.inline { // Just treat inline(always) as a hint for now, // there are cases that prevent inlining that we // need to check for first. @@ -250,7 +250,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { }; // Significantly lower the threshold for inlining cold functions - if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) { + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) { threshold /= 5; } @@ -355,7 +355,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } } - if let attr::InlineAttr::Always = trans_fn_attrs.inline { + if let attr::InlineAttr::Always = codegen_fn_attrs.inline { debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost); true } else { @@ -515,8 +515,8 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // Fn::call(closure_ref, tuple_tmp) // // meanwhile the closure body expects the arguments (here, `a`, `b`, and `c`) - // as distinct arguments. (This is the "rust-call" ABI hack.) Normally, trans has - // the job of unpacking this tuple. But here, we are trans. =) So we want to create + // as distinct arguments. (This is the "rust-call" ABI hack.) Normally, codegen has + // the job of unpacking this tuple. But here, we are codegen. =) So we want to create // a vector like // // [closure_ref, tuple_tmp.0, tuple_tmp.1, tuple_tmp.2] diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 63ca35aa0e7..e2f2312dbd2 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -277,7 +277,7 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx simplify::SimplifyLocals, add_call_guards::CriticalCallEdges, - dump_mir::Marker("PreTrans"), + dump_mir::Marker("PreCodegen"), ]; tcx.alloc_mir(mir) } diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 691fdd130e5..7e23a5cb1a8 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -15,7 +15,7 @@ //! //! The `SimplifyLocals` pass is kinda expensive and therefore not very suitable to be run often. //! Most of the passes should not care or be impacted in meaningful ways due to extra locals -//! either, so running the pass once, right before translation, should suffice. +//! either, so running the pass once, right before codegen, should suffice. //! //! On the other side of the spectrum, the `SimplifyCfg` pass is considerably cheap to run, thus //! one should run it after every pass which may modify CFG in significant ways. This pass must diff --git a/src/librustc_trans/README.md b/src/librustc_trans/README.md deleted file mode 100644 index d1868ba2abb..00000000000 --- a/src/librustc_trans/README.md +++ /dev/null @@ -1,7 +0,0 @@ -The `trans` crate contains the code to convert from MIR into LLVM IR, -and then from LLVM IR into machine code. In general it contains code -that runs towards the end of the compilation process. - -For more information about how trans works, see the [rustc guide]. - -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trans.html diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 97e4a35ea47..feb26e76162 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/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/check/op.rs b/src/librustc_typeck/check/op.rs index 23081b87d26..2dd22058d76 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -665,7 +665,7 @@ enum Op { /// `PartialEq` is not applicable. /// /// Reason #2 is the killer. I tried for a while to always use -/// overloaded logic and just check the types in constants/trans after +/// overloaded logic and just check the types in constants/codegen after /// the fact, and it worked fine, except for SIMD types. -nmatsakis fn is_builtin_binop(lhs: Ty, rhs: Ty, op: hir::BinOp) -> bool { match BinOpCategory::from(op) { diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 2f08a54e10f..735ebbfcb3d 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -9,7 +9,7 @@ // except according to those terms. //! Check properties that are required by built-in traits and set -//! up data structures required by type-checking/translation. +//! up data structures required by type-checking/codegen. use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::middle::region; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index c2dde2d2e01..157f3ab76ca 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -48,7 +48,7 @@ use syntax::symbol::{Symbol, keywords}; use syntax::feature_gate; use syntax_pos::{Span, DUMMY_SP}; -use rustc::hir::{self, map as hir_map, TransFnAttrs, TransFnAttrFlags, Unsafety}; +use rustc::hir::{self, map as hir_map, CodegenFnAttrs, CodegenFnAttrFlags, Unsafety}; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::def::{Def, CtorKind}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; @@ -75,7 +75,7 @@ pub fn provide(providers: &mut Providers) { impl_trait_ref, impl_polarity, is_foreign_item, - trans_fn_attrs, + codegen_fn_attrs, ..*providers }; } @@ -1800,33 +1800,33 @@ fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, name: & } } -fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAttrs { +fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { let attrs = tcx.get_attrs(id); - let mut trans_fn_attrs = TransFnAttrs::new(); + let mut codegen_fn_attrs = CodegenFnAttrs::new(); let whitelist = tcx.target_features_whitelist(LOCAL_CRATE); let mut inline_span = None; for attr in attrs.iter() { if attr.check_name("cold") { - trans_fn_attrs.flags |= TransFnAttrFlags::COLD; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD; } else if attr.check_name("allocator") { - trans_fn_attrs.flags |= TransFnAttrFlags::ALLOCATOR; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR; } else if attr.check_name("unwind") { - trans_fn_attrs.flags |= TransFnAttrFlags::UNWIND; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::UNWIND; } else if attr.check_name("rustc_allocator_nounwind") { - trans_fn_attrs.flags |= TransFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND; } else if attr.check_name("naked") { - trans_fn_attrs.flags |= TransFnAttrFlags::NAKED; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED; } else if attr.check_name("no_mangle") { - trans_fn_attrs.flags |= TransFnAttrFlags::NO_MANGLE; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE; } else if attr.check_name("rustc_std_internal_symbol") { - trans_fn_attrs.flags |= TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL; } else if attr.check_name("no_debug") { - trans_fn_attrs.flags |= TransFnAttrFlags::NO_DEBUG; + codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_DEBUG; } else if attr.check_name("inline") { - trans_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| { + codegen_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| { if attr.path != "inline" { return ia; } @@ -1862,7 +1862,7 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt }); } else if attr.check_name("export_name") { if let s @ Some(_) = attr.value_str() { - trans_fn_attrs.export_name = s; + codegen_fn_attrs.export_name = s; } else { struct_span_err!(tcx.sess, attr.span, E0558, "export_name attribute has invalid format") @@ -1875,10 +1875,10 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt `unsafe` function"; tcx.sess.span_err(attr.span, msg); } - from_target_feature(tcx, id, attr, &whitelist, &mut trans_fn_attrs.target_features); + from_target_feature(tcx, id, attr, &whitelist, &mut codegen_fn_attrs.target_features); } else if attr.check_name("linkage") { if let Some(val) = attr.value_str() { - trans_fn_attrs.linkage = Some(linkage_by_name(tcx, id, &val.as_str())); + codegen_fn_attrs.linkage = Some(linkage_by_name(tcx, id, &val.as_str())); } } } @@ -1887,8 +1887,8 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt // purpose functions as they wouldn't have the right target features // enabled. For that reason we also forbid #[inline(always)] as it can't be // respected. - if trans_fn_attrs.target_features.len() > 0 { - if trans_fn_attrs.inline == InlineAttr::Always { + if codegen_fn_attrs.target_features.len() > 0 { + if codegen_fn_attrs.inline == InlineAttr::Always { if let Some(span) = inline_span { tcx.sess.span_err(span, "cannot use #[inline(always)] with \ #[target_feature]"); @@ -1896,5 +1896,5 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt } } - trans_fn_attrs + codegen_fn_attrs } diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index e3f7ff5cb3f..99744d5b4b6 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1179,7 +1179,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/intrinsic.rs and in libcore/intrinsics.rs in the Rust source code. Example: ``` @@ -1209,7 +1209,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/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 c9a80d47791..90889890e0b 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -219,19 +219,19 @@ pub fn run_core(search_paths: SearchPaths, let mut sess = session::build_session_( sessopts, cpath, diagnostic_handler, codemap, ); - let trans = rustc_driver::get_trans(&sess); - let cstore = Rc::new(CStore::new(trans.metadata_loader())); + let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs)); - target_features::add_configuration(&mut cfg, &sess, &*trans); + target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let control = &driver::CompileController::basic(); let krate = panictry!(driver::phase_1_parse_input(control, &sess, &input)); - let name = ::rustc_trans_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input); + let name = ::rustc_codegen_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input); let mut crate_loader = CrateLoader::new(&sess, &cstore, &name); @@ -279,7 +279,7 @@ pub fn run_core(search_paths: SearchPaths, let resolver = RefCell::new(resolver); - abort_on_err(driver::phase_3_run_analysis_passes(&*trans, + abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, control, &sess, &*cstore, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index a14a27d5d61..3ce95c78a90 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -33,7 +33,7 @@ extern crate getopts; extern crate env_logger; extern crate rustc; extern crate rustc_data_structures; -extern crate rustc_trans_utils; +extern crate rustc_codegen_utils; 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 7be7ce313fc..f507d0dc09d 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -95,12 +95,12 @@ pub fn run(input_path: &Path, let mut sess = session::build_session_( sessopts, Some(input_path.to_owned()), handler, codemap.clone(), ); - let trans = rustc_driver::get_trans(&sess); - let cstore = CStore::new(trans.metadata_loader()); + let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let cstore = CStore::new(codegen_backend.metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*trans); + target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let krate = panictry!(driver::phase_1_parse_input(&driver::CompileController::basic(), @@ -120,7 +120,7 @@ pub fn run(input_path: &Path, }; let crate_name = crate_name.unwrap_or_else(|| { - ::rustc_trans_utils::link::find_crate_name(None, &hir_forest.krate().attrs, &input) + ::rustc_codegen_utils::link::find_crate_name(None, &hir_forest.krate().attrs, &input) }); let mut opts = scrape_test_config(hir_forest.krate()); opts.display_warnings |= display_warnings; @@ -273,8 +273,8 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let mut sess = session::build_session_( sessopts, None, diagnostic_handler, codemap, ); - let trans = rustc_driver::get_trans(&sess); - let cstore = CStore::new(trans.metadata_loader()); + let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let cstore = CStore::new(codegen_backend.metadata_loader()); 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")); @@ -282,7 +282,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let mut control = driver::CompileController::basic(); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*trans); + target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let out = Some(outdir.lock().unwrap().path().to_path_buf()); @@ -293,7 +293,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let res = panic::catch_unwind(AssertUnwindSafe(|| { driver::compile_input( - trans, + codegen_backend, &sess, &cstore, &None, diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f1229520c77..d247b5402ef 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -839,7 +839,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_partition_translated", Whitelisted, Gated(Stability::Unstable, + ("rustc_partition_codegened", Whitelisted, Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ @@ -938,7 +938,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG // FIXME: #14408 whitelist docs since rustdoc looks at them ("doc", Whitelisted, Ungated), - // FIXME: #14406 these are processed in trans, which happens after the + // FIXME: #14406 these are processed in codegen, which happens after the // lint pass ("cold", Whitelisted, Ungated), ("naked", Whitelisted, Gated(Stability::Unstable, diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 6b155b6596d..f29cc75664d 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -79,7 +79,7 @@ struct Context<'a, 'b: 'a> { /// final generated static argument array. We record the starting indices /// corresponding to each positional argument, and number of references /// consumed so far for each argument, to facilitate correct `Position` - /// mapping in `trans_piece`. In effect this can be seen as a "flattened" + /// mapping in `build_piece`. In effect this can be seen as a "flattened" /// version of `arg_unique_types`. /// /// Again with the example described above in docstring for `args`: @@ -108,7 +108,7 @@ struct Context<'a, 'b: 'a> { /// Current position of the implicit positional arg pointer, as if it /// still existed in this phase of processing. - /// Used only for `all_pieces_simple` tracking in `trans_piece`. + /// Used only for `all_pieces_simple` tracking in `build_piece`. curarg: usize, /// Keep track of invalid references to positional arguments invalid_refs: Vec, @@ -373,7 +373,7 @@ impl<'a, 'b> Context<'a, 'b> { ecx.std_path(&["fmt", "rt", "v1", s]) } - fn trans_count(&self, c: parse::Count) -> P { + fn build_count(&self, c: parse::Count) -> P { let sp = self.macsp; let count = |c, arg| { let mut path = Context::rtpath(self.ecx, "Count"); @@ -401,17 +401,17 @@ impl<'a, 'b> Context<'a, 'b> { } } - /// Translate the accumulated string literals to a literal expression - fn trans_literal_string(&mut self) -> P { + /// Build a literal expression from the accumulated string literals + fn build_literal_string(&mut self) -> P { let sp = self.fmtsp; let s = Symbol::intern(&self.literal); self.literal.clear(); self.ecx.expr_str(sp, s) } - /// Translate a `parse::Piece` to a static `rt::Argument` or append + /// Build a static `rt::Argument` from a `parse::Piece` or append /// to the `literal` string. - fn trans_piece(&mut self, + fn build_piece(&mut self, piece: &parse::Piece, arg_index_consumed: &mut Vec) -> Option> { @@ -422,7 +422,7 @@ impl<'a, 'b> Context<'a, 'b> { None } parse::NextArgument(ref arg) => { - // Translate the position + // Build the position let pos = { let pos = |c, arg| { let mut path = Context::rtpath(self.ecx, "Position"); @@ -486,7 +486,7 @@ impl<'a, 'b> Context<'a, 'b> { self.all_pieces_simple = false; } - // Translate the format + // Build the format let fill = self.ecx.expr_lit(sp, ast::LitKind::Char(fill)); let align = |name| { let mut p = Context::rtpath(self.ecx, "Alignment"); @@ -501,8 +501,8 @@ impl<'a, 'b> Context<'a, 'b> { }; let align = self.ecx.expr_path(align); let flags = self.ecx.expr_u32(sp, arg.format.flags); - let prec = self.trans_count(arg.format.precision); - let width = self.trans_count(arg.format.width); + let prec = self.build_count(arg.format.precision); + let width = self.build_count(arg.format.width); let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, "FormatSpec")); let fmt = self.ecx.expr_struct(sp, @@ -759,8 +759,8 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, let mut arg_index_consumed = vec![0usize; cx.arg_index_map.len()]; for piece in pieces { - if let Some(piece) = cx.trans_piece(&piece, &mut arg_index_consumed) { - let s = cx.trans_literal_string(); + if let Some(piece) = cx.build_piece(&piece, &mut arg_index_consumed) { + let s = cx.build_literal_string(); cx.str_pieces.push(s); cx.pieces.push(piece); } @@ -776,7 +776,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, return DummyResult::raw_expr(sp); } if !cx.literal.is_empty() { - let s = cx.trans_literal_string(); + let s = cx.build_literal_string(); cx.str_pieces.push(s); } diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 2b8603c75a5..0dd8f0c55d8 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -697,7 +697,7 @@ pub mod printf { /// Check that the translations are what we expect. #[test] - fn test_trans() { + fn test_translation() { assert_eq_pnsat!("%c", Some("{}")); assert_eq_pnsat!("%d", Some("{}")); assert_eq_pnsat!("%u", Some("{}")); @@ -900,7 +900,7 @@ pub mod shell { } #[test] - fn test_trans() { + fn test_translation() { assert_eq_pnsat!("$0", Some("{0}")); assert_eq_pnsat!("$9", Some("{9}")); assert_eq_pnsat!("$1", Some("{1}")); diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index f01a0aacb0a..642aa0e5b12 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -14,7 +14,7 @@ /// "file-scoped", or "module-level" assembly. These synonyms /// all correspond to LLVM's module-level inline assembly instruction. /// -/// For example, `global_asm!("some assembly here")` translates to +/// For example, `global_asm!("some assembly here")` codegens to /// LLVM's `module asm "some assembly here"`. All of LLVM's caveats /// therefore apply. diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 3b400b879eb..d5410feb254 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -388,7 +388,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.FunctionSections = FunctionSections; if (TrapUnreachable) { - // Tell LLVM to translate `unreachable` into an explicit trap instruction. + // Tell LLVM to codegen `unreachable` into an explicit trap instruction. // This limits the extent of possible undefined behavior in some cases, as // it prevents control flow from "falling through" into whatever code // happens to be laid out next in memory. diff --git a/src/test/codegen-units/item-collection/cross-crate-closures.rs b/src/test/codegen-units/item-collection/cross-crate-closures.rs index 320be278198..a26604d3ce9 100644 --- a/src/test/codegen-units/item-collection/cross-crate-closures.rs +++ b/src/test/codegen-units/item-collection/cross-crate-closures.rs @@ -9,12 +9,12 @@ // except according to those terms. // In the current version of the collector that still has to support -// legacy-trans, closures do not generate their own TransItems, so we are -// ignoring this test until MIR trans has taken over completely +// legacy-codegen, closures do not generate their own MonoItems, so we are +// ignoring this test until MIR codegen has taken over completely // ignore-test // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -22,16 +22,16 @@ // aux-build:cgu_extern_closures.rs extern crate cgu_extern_closures; -//~ TRANS_ITEM fn cross_crate_closures::start[0] +//~ MONO_ITEM fn cross_crate_closures::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0] - //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0] + //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0] + //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0] let _ = cgu_extern_closures::inlined_fn(1, 2); - //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn_generic[0] - //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn_generic[0]::{{closure}}[0] + //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic[0] + //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic[0]::{{closure}}[0] let _ = cgu_extern_closures::inlined_fn_generic(3, 4, 5i32); // Nothing should be generated for this call, we just link to the instance @@ -41,4 +41,4 @@ fn start(_: isize, _: *const *const u8) -> isize { 0 } -//~ TRANS_ITEM drop-glue i8 +//~ MONO_ITEM drop-glue i8 diff --git a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs index bcb3b7b1dad..aa33c25da9a 100644 --- a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs +++ b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -17,15 +17,15 @@ // aux-build:cgu_generic_function.rs extern crate cgu_generic_function; -//~ TRANS_ITEM fn cross_crate_generic_functions::start[0] +//~ MONO_ITEM fn cross_crate_generic_functions::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn cgu_generic_function::bar[0] - //~ TRANS_ITEM fn cgu_generic_function::foo[0] + //~ MONO_ITEM fn cgu_generic_function::bar[0] + //~ MONO_ITEM fn cgu_generic_function::foo[0] let _ = cgu_generic_function::foo(1u32); - //~ TRANS_ITEM fn cgu_generic_function::bar[0] - //~ TRANS_ITEM fn cgu_generic_function::foo[0] + //~ MONO_ITEM fn cgu_generic_function::bar[0] + //~ MONO_ITEM fn cgu_generic_function::foo[0] let _ = cgu_generic_function::foo(2u64); // This should not introduce a codegen item diff --git a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs index 910ae000848..7a16b22a023 100644 --- a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -19,7 +19,7 @@ extern crate cgu_export_trait_method; use cgu_export_trait_method::Trait; -//~ TRANS_ITEM fn cross_crate_trait_method::start[0] +//~ MONO_ITEM fn cross_crate_trait_method::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { // The object code of these methods is contained in the external crate, so @@ -30,31 +30,31 @@ fn start(_: isize, _: *const *const u8) -> isize { // Currently, no object code is generated for trait methods with default // implemenations, unless they are actually called from somewhere. Therefore // we cannot import the implementations and have to create our own inline. - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0] let _ = Trait::with_default_impl(0u32); - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl[0] let _ = Trait::with_default_impl('c'); - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] let _ = Trait::with_default_impl_generic(0u32, "abc"); - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] let _ = Trait::with_default_impl_generic(0u32, false); - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] let _ = Trait::with_default_impl_generic('x', 1i16); - //~ TRANS_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::Trait[0]::with_default_impl_generic[0] let _ = Trait::with_default_impl_generic('y', 0i32); - //~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0] let _: (u32, char) = Trait::without_default_impl_generic('c'); - //~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[1]::without_default_impl_generic[0] let _: (u32, bool) = Trait::without_default_impl_generic(false); - //~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0] let _: (char, char) = Trait::without_default_impl_generic('c'); - //~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0] + //~ MONO_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0] let _: (char, bool) = Trait::without_default_impl_generic(false); 0 diff --git a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs index 52af8165032..49e4b8d43c1 100644 --- a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -9,24 +9,24 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![feature(start)] -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ drop_in_place_intrinsic0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ drop_in_place_intrinsic0[Internal] struct StructWithDtor(u32); impl Drop for StructWithDtor { - //~ TRANS_ITEM fn drop_in_place_intrinsic::{{impl}}[0]::drop[0] + //~ MONO_ITEM fn drop_in_place_intrinsic::{{impl}}[0]::drop[0] fn drop(&mut self) {} } -//~ TRANS_ITEM fn drop_in_place_intrinsic::start[0] +//~ MONO_ITEM fn drop_in_place_intrinsic::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal] let x = [StructWithDtor(0), StructWithDtor(1)]; drop_slice_in_place(&x); @@ -34,13 +34,13 @@ fn start(_: isize, _: *const *const u8) -> isize { 0 } -//~ TRANS_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0] +//~ MONO_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0] fn drop_slice_in_place(x: &[StructWithDtor]) { unsafe { // This is the interesting thing in this test case: Normally we would // not have drop-glue for the unsized [StructWithDtor]. This has to be // generated though when the drop_in_place() intrinsic is used. - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic0[Internal] ::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]); } } diff --git a/src/test/codegen-units/item-collection/function-as-argument.rs b/src/test/codegen-units/item-collection/function-as-argument.rs index 65707c1aa4d..9a88336d1e5 100644 --- a/src/test/codegen-units/item-collection/function-as-argument.rs +++ b/src/test/codegen-units/item-collection/function-as-argument.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -24,26 +24,26 @@ fn take_fn_pointer(f: fn(T1, T2), x: T1, y: T2) { (f)(x, y) } -//~ TRANS_ITEM fn function_as_argument::start[0] +//~ MONO_ITEM fn function_as_argument::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn function_as_argument::take_fn_once[0] - //~ TRANS_ITEM fn function_as_argument::function[0] - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] + //~ MONO_ITEM fn function_as_argument::take_fn_once[0] + //~ MONO_ITEM fn function_as_argument::function[0] + //~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] take_fn_once(function, 0u32, "abc"); - //~ TRANS_ITEM fn function_as_argument::take_fn_once[0] - //~ TRANS_ITEM fn function_as_argument::function[0] - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] + //~ MONO_ITEM fn function_as_argument::take_fn_once[0] + //~ MONO_ITEM fn function_as_argument::function[0] + //~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] take_fn_once(function, 'c', 0f64); - //~ TRANS_ITEM fn function_as_argument::take_fn_pointer[0] - //~ TRANS_ITEM fn function_as_argument::function[0] + //~ MONO_ITEM fn function_as_argument::take_fn_pointer[0] + //~ MONO_ITEM fn function_as_argument::function[0] take_fn_pointer(function, 0i32, ()); - //~ TRANS_ITEM fn function_as_argument::take_fn_pointer[0] - //~ TRANS_ITEM fn function_as_argument::function[0] + //~ MONO_ITEM fn function_as_argument::take_fn_pointer[0] + //~ MONO_ITEM fn function_as_argument::function[0] take_fn_pointer(function, 0f32, 0i64); 0 diff --git a/src/test/codegen-units/item-collection/generic-drop-glue.rs b/src/test/codegen-units/item-collection/generic-drop-glue.rs index d3d9aa3aefc..aad32d1eb7c 100644 --- a/src/test/codegen-units/item-collection/generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/generic-drop-glue.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] @@ -47,22 +47,22 @@ enum EnumNoDrop { struct NonGenericNoDrop(i32); struct NonGenericWithDrop(i32); -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ generic_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ generic_drop_glue0[Internal] impl Drop for NonGenericWithDrop { - //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0] + //~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0] fn drop(&mut self) {} } -//~ TRANS_ITEM fn generic_drop_glue::start[0] +//~ MONO_ITEM fn generic_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] - //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] + //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0] let _ = StructWithDrop { x: 0i8, y: 'a' }.x; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] - //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]> + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] + //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]> let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y; // Should produce no drop glue @@ -70,18 +70,18 @@ fn start(_: isize, _: *const *const u8) -> isize { // This is supposed to generate drop-glue because it contains a field that // needs to be dropped. - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] - //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] + //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::A::(0) { EnumWithDrop::A(x) => x, EnumWithDrop::B(x) => x as i32 }; - //~TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] - //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] + //~MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] + //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::B::(1.0) { EnumWithDrop::A(x) => x, EnumWithDrop::B(x) => x as f64 diff --git a/src/test/codegen-units/item-collection/generic-functions.rs b/src/test/codegen-units/item-collection/generic-functions.rs index 8efe4b2762a..402d19f9996 100644 --- a/src/test/codegen-units/item-collection/generic-functions.rs +++ b/src/test/codegen-units/item-collection/generic-functions.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -27,39 +27,39 @@ fn foo3(a: T1, b: T2, c: T3) -> (T1, T2, T3) { } // This function should be instantiated even if no used -//~ TRANS_ITEM fn generic_functions::lifetime_only[0] +//~ MONO_ITEM fn generic_functions::lifetime_only[0] pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 { a } -//~ TRANS_ITEM fn generic_functions::start[0] +//~ MONO_ITEM fn generic_functions::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn generic_functions::foo1[0] + //~ MONO_ITEM fn generic_functions::foo1[0] let _ = foo1(2i32); - //~ TRANS_ITEM fn generic_functions::foo1[0] + //~ MONO_ITEM fn generic_functions::foo1[0] let _ = foo1(2i64); - //~ TRANS_ITEM fn generic_functions::foo1[0]<&str> + //~ MONO_ITEM fn generic_functions::foo1[0]<&str> let _ = foo1("abc"); - //~ TRANS_ITEM fn generic_functions::foo1[0] + //~ MONO_ITEM fn generic_functions::foo1[0] let _ = foo1('v'); - //~ TRANS_ITEM fn generic_functions::foo2[0] + //~ MONO_ITEM fn generic_functions::foo2[0] let _ = foo2(2i32, 2i32); - //~ TRANS_ITEM fn generic_functions::foo2[0] + //~ MONO_ITEM fn generic_functions::foo2[0] let _ = foo2(2i64, "abc"); - //~ TRANS_ITEM fn generic_functions::foo2[0]<&str, usize> + //~ MONO_ITEM fn generic_functions::foo2[0]<&str, usize> let _ = foo2("a", 2usize); - //~ TRANS_ITEM fn generic_functions::foo2[0] + //~ MONO_ITEM fn generic_functions::foo2[0] let _ = foo2('v', ()); - //~ TRANS_ITEM fn generic_functions::foo3[0] + //~ MONO_ITEM fn generic_functions::foo3[0] let _ = foo3(2i32, 2i32, 2i32); - //~ TRANS_ITEM fn generic_functions::foo3[0] + //~ MONO_ITEM fn generic_functions::foo3[0] let _ = foo3(2i64, "abc", 'c'); - //~ TRANS_ITEM fn generic_functions::foo3[0] + //~ MONO_ITEM fn generic_functions::foo3[0] let _ = foo3(0i16, "a", 2usize); - //~ TRANS_ITEM fn generic_functions::foo3[0] + //~ MONO_ITEM fn generic_functions::foo3[0] let _ = foo3('v', (), ()); 0 diff --git a/src/test/codegen-units/item-collection/generic-impl.rs b/src/test/codegen-units/item-collection/generic-impl.rs index d1ee8ee624c..07e51a1e947 100644 --- a/src/test/codegen-units/item-collection/generic-impl.rs +++ b/src/test/codegen-units/item-collection/generic-impl.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -41,41 +41,41 @@ pub struct LifeTimeOnly<'a> { impl<'a> LifeTimeOnly<'a> { - //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::foo[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[1]::foo[0] pub fn foo(&self) {} - //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::bar[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[1]::bar[0] pub fn bar(&'a self) {} - //~ TRANS_ITEM fn generic_impl::{{impl}}[1]::baz[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[1]::baz[0] pub fn baz<'b>(&'b self) {} pub fn non_instantiated(&self) {} } -//~ TRANS_ITEM fn generic_impl::start[0] +//~ MONO_ITEM fn generic_impl::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0] - //~ TRANS_ITEM fn generic_impl::id[0] - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0] + //~ MONO_ITEM fn generic_impl::id[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0] let _ = Struct::new(0i32).get(0i16); - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0] - //~ TRANS_ITEM fn generic_impl::id[0] - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0] + //~ MONO_ITEM fn generic_impl::id[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0] let _ = Struct::new(0i64).get(0i16); - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0] - //~ TRANS_ITEM fn generic_impl::id[0] - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0] + //~ MONO_ITEM fn generic_impl::id[0] + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0] let _ = Struct::new('c').get(0i16); - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]<&str> - //~ TRANS_ITEM fn generic_impl::id[0]<&str> - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0], i16> + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]<&str> + //~ MONO_ITEM fn generic_impl::id[0]<&str> + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::get[0], i16> let _ = Struct::new(Struct::new("str")).get(0i16); - //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]> - //~ TRANS_ITEM fn generic_impl::id[0]> + //~ MONO_ITEM fn generic_impl::{{impl}}[0]::new[0]> + //~ MONO_ITEM fn generic_impl::id[0]> let _ = (Struct::new(Struct::new("str")).f)(Struct::new("str")); 0 diff --git a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs index c07d26c3f8d..6d65c0d3aa8 100644 --- a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs +++ b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -22,14 +22,14 @@ trait SomeTrait { // discovered. pub fn generic_function(x: T) -> (T, i32) { impl SomeTrait for i64 { - //~ TRANS_ITEM fn impl_in_non_instantiated_generic::generic_function[0]::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn impl_in_non_instantiated_generic::generic_function[0]::{{impl}}[0]::foo[0] fn foo(&self) {} } (x, 0) } -//~ TRANS_ITEM fn impl_in_non_instantiated_generic::start[0] +//~ MONO_ITEM fn impl_in_non_instantiated_generic::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { 0i64.foo(); diff --git a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs index 2e1138ef128..5c6201da252 100644 --- a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] @@ -29,20 +29,20 @@ impl Trait for Struct { fn bar(&self) {} } -//~ TRANS_ITEM fn instantiation_through_vtable::start[0] +//~ MONO_ITEM fn instantiation_through_vtable::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { let s1 = Struct { _a: 0u32 }; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable0[Internal] - //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] - //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable0[Internal] + //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; let s1 = Struct { _a: 0u64 }; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable0[Internal] - //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] - //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable0[Internal] + //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; 0 diff --git a/src/test/codegen-units/item-collection/items-within-generic-items.rs b/src/test/codegen-units/item-collection/items-within-generic-items.rs index 04b54de3ce2..f9813063831 100644 --- a/src/test/codegen-units/item-collection/items-within-generic-items.rs +++ b/src/test/codegen-units/item-collection/items-within-generic-items.rs @@ -9,19 +9,19 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] fn generic_fn(a: T) -> (T, i32) { - //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[0] + //~ MONO_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[0] fn nested_fn(a: i32) -> i32 { a + 1 } let x = { - //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[1] + //~ MONO_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[1] fn nested_fn(a: i32) -> i32 { a + 2 } @@ -32,14 +32,14 @@ fn generic_fn(a: T) -> (T, i32) { return (a, x + nested_fn(0)); } -//~ TRANS_ITEM fn items_within_generic_items::start[0] +//~ MONO_ITEM fn items_within_generic_items::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] + //~ MONO_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0i64); - //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] + //~ MONO_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0u16); - //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] + //~ MONO_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0i8); 0 diff --git a/src/test/codegen-units/item-collection/non-generic-closures.rs b/src/test/codegen-units/item-collection/non-generic-closures.rs index f0121d56cec..77ada23de71 100644 --- a/src/test/codegen-units/item-collection/non-generic-closures.rs +++ b/src/test/codegen-units/item-collection/non-generic-closures.rs @@ -9,51 +9,51 @@ // except according to those terms. // In the current version of the collector that still has to support -// legacy-trans, closures do not generate their own TransItems, so we are -// ignoring this test until MIR trans has taken over completely +// legacy-codegen, closures do not generate their own MonoItems, so we are +// ignoring this test until MIR codegen has taken over completely // ignore-test // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] -//~ TRANS_ITEM fn non_generic_closures::temporary[0] +//~ MONO_ITEM fn non_generic_closures::temporary[0] fn temporary() { - //~ TRANS_ITEM fn non_generic_closures::temporary[0]::{{closure}}[0] + //~ MONO_ITEM fn non_generic_closures::temporary[0]::{{closure}}[0] (|a: u32| { let _ = a; })(4); } -//~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0] +//~ MONO_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0] fn assigned_to_variable_but_not_executed() { - //~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0]::{{closure}}[0] + //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0]::{{closure}}[0] let _x = |a: i16| { let _ = a + 1; }; } -//~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0] +//~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0] fn assigned_to_variable_executed_indirectly() { - //~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0]::{{closure}}[0] + //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0]::{{closure}}[0] let f = |a: i32| { let _ = a + 2; }; run_closure(&f); } -//~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0] +//~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0] fn assigned_to_variable_executed_directly() { - //~ TRANS_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0]::{{closure}}[0] + //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0]::{{closure}}[0] let f = |a: i64| { let _ = a + 3; }; f(4); } -//~ TRANS_ITEM fn non_generic_closures::start[0] +//~ MONO_ITEM fn non_generic_closures::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { temporary(); @@ -64,7 +64,7 @@ fn start(_: isize, _: *const *const u8) -> isize { 0 } -//~ TRANS_ITEM fn non_generic_closures::run_closure[0] +//~ MONO_ITEM fn non_generic_closures::run_closure[0] fn run_closure(f: &Fn(i32)) { f(3); } diff --git a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs index bf084aa96ea..6ca24aa5b4b 100644 --- a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs @@ -9,19 +9,19 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue0[Internal] struct StructWithDrop { x: i32 } impl Drop for StructWithDrop { - //~ TRANS_ITEM fn non_generic_drop_glue::{{impl}}[0]::drop[0] + //~ MONO_ITEM fn non_generic_drop_glue::{{impl}}[0]::drop[0] fn drop(&mut self) {} } @@ -29,13 +29,13 @@ struct StructNoDrop { x: i32 } -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue0[Internal] enum EnumWithDrop { A(i32) } impl Drop for EnumWithDrop { - //~ TRANS_ITEM fn non_generic_drop_glue::{{impl}}[1]::drop[0] + //~ MONO_ITEM fn non_generic_drop_glue::{{impl}}[1]::drop[0] fn drop(&mut self) {} } @@ -43,7 +43,7 @@ enum EnumNoDrop { A(i32) } -//~ TRANS_ITEM fn non_generic_drop_glue::start[0] +//~ MONO_ITEM fn non_generic_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { let _ = StructWithDrop { x: 0 }.x; diff --git a/src/test/codegen-units/item-collection/non-generic-functions.rs b/src/test/codegen-units/item-collection/non-generic-functions.rs index 8c487db5c96..38d08c8a6ed 100644 --- a/src/test/codegen-units/item-collection/non-generic-functions.rs +++ b/src/test/codegen-units/item-collection/non-generic-functions.rs @@ -9,29 +9,29 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] -//~ TRANS_ITEM fn non_generic_functions::foo[0] +//~ MONO_ITEM fn non_generic_functions::foo[0] fn foo() { { - //~ TRANS_ITEM fn non_generic_functions::foo[0]::foo[0] + //~ MONO_ITEM fn non_generic_functions::foo[0]::foo[0] fn foo() {} foo(); } { - //~ TRANS_ITEM fn non_generic_functions::foo[0]::foo[1] + //~ MONO_ITEM fn non_generic_functions::foo[0]::foo[1] fn foo() {} foo(); } } -//~ TRANS_ITEM fn non_generic_functions::bar[0] +//~ MONO_ITEM fn non_generic_functions::bar[0] fn bar() { - //~ TRANS_ITEM fn non_generic_functions::bar[0]::baz[0] + //~ MONO_ITEM fn non_generic_functions::bar[0]::baz[0] fn baz() {} baz(); } @@ -39,38 +39,38 @@ fn bar() { struct Struct { _x: i32 } impl Struct { - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0] fn foo() { { - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[0] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[0] fn foo() {} foo(); } { - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[1] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::foo[0]::foo[1] fn foo() {} foo(); } } - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::bar[0] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0] fn bar(&self) { { - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[0] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[0] fn foo() {} foo(); } { - //~ TRANS_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[1] + //~ MONO_ITEM fn non_generic_functions::{{impl}}[0]::bar[0]::foo[1] fn foo() {} foo(); } } } -//~ TRANS_ITEM fn non_generic_functions::start[0] +//~ MONO_ITEM fn non_generic_functions::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { foo(); diff --git a/src/test/codegen-units/item-collection/overloaded-operators.rs b/src/test/codegen-units/item-collection/overloaded-operators.rs index 05848a727e9..dae6ef83551 100644 --- a/src/test/codegen-units/item-collection/overloaded-operators.rs +++ b/src/test/codegen-units/item-collection/overloaded-operators.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![crate_type="lib"] @@ -23,7 +23,7 @@ pub struct Indexable { impl Index for Indexable { type Output = u8; - //~ TRANS_ITEM fn overloaded_operators::{{impl}}[0]::index[0] + //~ MONO_ITEM fn overloaded_operators::{{impl}}[0]::index[0] fn index(&self, index: usize) -> &Self::Output { if index >= 3 { &self.data[0] @@ -34,7 +34,7 @@ impl Index for Indexable { } impl IndexMut for Indexable { - //~ TRANS_ITEM fn overloaded_operators::{{impl}}[1]::index_mut[0] + //~ MONO_ITEM fn overloaded_operators::{{impl}}[1]::index_mut[0] fn index_mut(&mut self, index: usize) -> &mut Self::Output { if index >= 3 { &mut self.data[0] @@ -45,8 +45,8 @@ impl IndexMut for Indexable { } -//~ TRANS_ITEM fn overloaded_operators::{{impl}}[4]::eq[0] -//~ TRANS_ITEM fn overloaded_operators::{{impl}}[4]::ne[0] +//~ MONO_ITEM fn overloaded_operators::{{impl}}[4]::eq[0] +//~ MONO_ITEM fn overloaded_operators::{{impl}}[4]::ne[0] #[derive(PartialEq)] pub struct Equatable(u32); @@ -54,7 +54,7 @@ pub struct Equatable(u32); impl Add for Equatable { type Output = u32; - //~ TRANS_ITEM fn overloaded_operators::{{impl}}[2]::add[0] + //~ MONO_ITEM fn overloaded_operators::{{impl}}[2]::add[0] fn add(self, rhs: u32) -> u32 { self.0 + rhs } @@ -63,7 +63,7 @@ impl Add for Equatable { impl Deref for Equatable { type Target = u32; - //~ TRANS_ITEM fn overloaded_operators::{{impl}}[3]::deref[0] + //~ MONO_ITEM fn overloaded_operators::{{impl}}[3]::deref[0] fn deref(&self) -> &Self::Target { &self.0 } diff --git a/src/test/codegen-units/item-collection/static-init.rs b/src/test/codegen-units/item-collection/static-init.rs index 5ff7c3480b1..f36c4903458 100644 --- a/src/test/codegen-units/item-collection/static-init.rs +++ b/src/test/codegen-units/item-collection/static-init.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // ignore-tidy-linelength #![feature(start)] @@ -17,12 +17,11 @@ pub static FN : fn() = foo::; pub fn foo() { } -//~ TRANS_ITEM fn static_init::foo[0] -//~ TRANS_ITEM static static_init::FN[0] +//~ MONO_ITEM fn static_init::foo[0] +//~ MONO_ITEM static static_init::FN[0] -//~ TRANS_ITEM fn static_init::start[0] +//~ MONO_ITEM fn static_init::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { 0 } - diff --git a/src/test/codegen-units/item-collection/statics-and-consts.rs b/src/test/codegen-units/item-collection/statics-and-consts.rs index 11df1da3a78..883809ff059 100644 --- a/src/test/codegen-units/item-collection/statics-and-consts.rs +++ b/src/test/codegen-units/item-collection/statics-and-consts.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -48,7 +48,7 @@ fn foo() { }; } -//~ TRANS_ITEM fn statics_and_consts::start[0] +//~ MONO_ITEM fn statics_and_consts::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { foo(); @@ -57,9 +57,9 @@ fn start(_: isize, _: *const *const u8) -> isize { 0 } -//~ TRANS_ITEM static statics_and_consts::STATIC1[0] +//~ MONO_ITEM static statics_and_consts::STATIC1[0] -//~ TRANS_ITEM fn statics_and_consts::foo[0] -//~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[0] -//~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[1] -//~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[2] +//~ MONO_ITEM fn statics_and_consts::foo[0] +//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[0] +//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[1] +//~ MONO_ITEM static statics_and_consts::foo[0]::STATIC2[2] diff --git a/src/test/codegen-units/item-collection/trait-implementations.rs b/src/test/codegen-units/item-collection/trait-implementations.rs index 8eb33dd647f..f85486b5d34 100644 --- a/src/test/codegen-units/item-collection/trait-implementations.rs +++ b/src/test/codegen-units/item-collection/trait-implementations.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -21,7 +21,7 @@ pub trait SomeTrait { impl SomeTrait for i64 { - //~ TRANS_ITEM fn trait_implementations::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[0]::foo[0] fn foo(&self) {} fn bar(&self, _: T) {} @@ -29,7 +29,7 @@ impl SomeTrait for i64 { impl SomeTrait for i32 { - //~ TRANS_ITEM fn trait_implementations::{{impl}}[1]::foo[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[1]::foo[0] fn foo(&self) {} fn bar(&self, _: T) {} @@ -43,7 +43,7 @@ pub trait SomeGenericTrait { // Concrete impl of generic trait impl SomeGenericTrait for f64 { - //~ TRANS_ITEM fn trait_implementations::{{impl}}[2]::foo[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[2]::foo[0] fn foo(&self, _: u32) {} fn bar(&self, _: u32, _: T2) {} @@ -56,28 +56,28 @@ impl SomeGenericTrait for f32 { fn bar(&self, _: T, _: T2) {} } -//~ TRANS_ITEM fn trait_implementations::start[0] +//~ MONO_ITEM fn trait_implementations::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn trait_implementations::{{impl}}[1]::bar[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[1]::bar[0] 0i32.bar('x'); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<&str> + //~ MONO_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<&str> 0f64.bar(0u32, "&str"); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<()> + //~ MONO_ITEM fn trait_implementations::{{impl}}[2]::bar[0]<()> 0f64.bar(0u32, ()); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::foo[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[3]::foo[0] 0f32.foo('x'); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::foo[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[3]::foo[0] 0f32.foo(-1i64); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::bar[0] + //~ MONO_ITEM fn trait_implementations::{{impl}}[3]::bar[0] 0f32.bar(0u32, ()); - //~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<&str, &str> + //~ MONO_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<&str, &str> 0f32.bar("&str", "&str"); 0 diff --git a/src/test/codegen-units/item-collection/trait-method-as-argument.rs b/src/test/codegen-units/item-collection/trait-method-as-argument.rs index 10b21630308..1f08f0f8060 100644 --- a/src/test/codegen-units/item-collection/trait-method-as-argument.rs +++ b/src/test/codegen-units/item-collection/trait-method-as-argument.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -37,33 +37,33 @@ fn take_foo_mut T>(mut f: F, arg: T) -> T { (f)(arg) } -//~ TRANS_ITEM fn trait_method_as_argument::start[0] +//~ MONO_ITEM fn trait_method_as_argument::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn trait_method_as_argument::take_foo_once[0] u32> - //~ TRANS_ITEM fn trait_method_as_argument::{{impl}}[0]::foo[0] - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] u32, (u32)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo_once[0] u32> + //~ MONO_ITEM fn trait_method_as_argument::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] u32, (u32)> take_foo_once(Trait::foo, 0u32); - //~ TRANS_ITEM fn trait_method_as_argument::take_foo_once[0] char> - //~ TRANS_ITEM fn trait_method_as_argument::Trait[0]::foo[0] - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] char, (char)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo_once[0] char> + //~ MONO_ITEM fn trait_method_as_argument::Trait[0]::foo[0] + //~ MONO_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] char, (char)> take_foo_once(Trait::foo, 'c'); - //~ TRANS_ITEM fn trait_method_as_argument::take_foo[0] u32> - //~ TRANS_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0] u32, (u32)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo[0] u32> + //~ MONO_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0] u32, (u32)> take_foo(Trait::foo, 0u32); - //~ TRANS_ITEM fn trait_method_as_argument::take_foo[0] char> - //~ TRANS_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0] char, (char)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo[0] char> + //~ MONO_ITEM fn core::ops[0]::function[0]::Fn[0]::call[0] char, (char)> take_foo(Trait::foo, 'c'); - //~ TRANS_ITEM fn trait_method_as_argument::take_foo_mut[0] u32> - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0] char, (char)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo_mut[0] u32> + //~ MONO_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0] char, (char)> take_foo_mut(Trait::foo, 0u32); - //~ TRANS_ITEM fn trait_method_as_argument::take_foo_mut[0] char> - //~ TRANS_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0] u32, (u32)> + //~ MONO_ITEM fn trait_method_as_argument::take_foo_mut[0] char> + //~ MONO_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0] u32, (u32)> take_foo_mut(Trait::foo, 'c'); 0 diff --git a/src/test/codegen-units/item-collection/trait-method-default-impl.rs b/src/test/codegen-units/item-collection/trait-method-default-impl.rs index a6ae3765b2e..b130747972e 100644 --- a/src/test/codegen-units/item-collection/trait-method-default-impl.rs +++ b/src/test/codegen-units/item-collection/trait-method-default-impl.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] @@ -24,7 +24,7 @@ impl SomeTrait for i8 { // For the non-generic foo(), we should generate a codegen-item even if it // is not called anywhere - //~ TRANS_ITEM fn trait_method_default_impl::SomeTrait[0]::foo[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::foo[0] } trait SomeGenericTrait { @@ -38,7 +38,7 @@ impl SomeGenericTrait for i32 { // For the non-generic foo(), we should generate a codegen-item even if it // is not called anywhere - //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::foo[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::foo[0] } // Non-generic impl of generic trait @@ -47,25 +47,25 @@ impl SomeGenericTrait for u32 { // since nothing is monomorphic here, nothing should be generated unless used somewhere. } -//~ TRANS_ITEM fn trait_method_default_impl::start[0] +//~ MONO_ITEM fn trait_method_default_impl::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0] let _ = 1i8.bar('c'); - //~ TRANS_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0] let _ = 2i8.bar("&str"); - //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] 0i32.bar(0u64, 'c'); - //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] 0i32.bar(0u64, "&str"); - //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] 0u32.bar(0i8, &['c']); - //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] + //~ MONO_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] 0u32.bar(0i16, ()); 0 diff --git a/src/test/codegen-units/item-collection/transitive-drop-glue.rs b/src/test/codegen-units/item-collection/transitive-drop-glue.rs index 57cd10187a2..d20213c109b 100644 --- a/src/test/codegen-units/item-collection/transitive-drop-glue.rs +++ b/src/test/codegen-units/item-collection/transitive-drop-glue.rs @@ -9,21 +9,21 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] struct Root(Intermediate); -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] struct Intermediate(Leaf); -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] struct Leaf; impl Drop for Leaf { - //~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[0]::drop[0] + //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[0]::drop[0] fn drop(&mut self) {} } @@ -35,21 +35,21 @@ impl Drop for LeafGen { fn drop(&mut self) {} } -//~ TRANS_ITEM fn transitive_drop_glue::start[0] +//~ MONO_ITEM fn transitive_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { let _ = Root(Intermediate(Leaf)); - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0u32))); - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] - //~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] + //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0i16))); 0 diff --git a/src/test/codegen-units/item-collection/tuple-drop-glue.rs b/src/test/codegen-units/item-collection/tuple-drop-glue.rs index a5f2409b8ae..9e4cc6ea6f0 100644 --- a/src/test/codegen-units/item-collection/tuple-drop-glue.rs +++ b/src/test/codegen-units/item-collection/tuple-drop-glue.rs @@ -9,28 +9,28 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] #![feature(start)] -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ tuple_drop_glue0[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ tuple_drop_glue0[Internal] struct Dropped; impl Drop for Dropped { - //~ TRANS_ITEM fn tuple_drop_glue::{{impl}}[0]::drop[0] + //~ MONO_ITEM fn tuple_drop_glue::{{impl}}[0]::drop[0] fn drop(&mut self) {} } -//~ TRANS_ITEM fn tuple_drop_glue::start[0] +//~ MONO_ITEM fn tuple_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue0[Internal] let x = (0u32, Dropped); - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue0[Internal] - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue0[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue0[Internal] let x = (0i16, (Dropped, true)); 0 diff --git a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs index 59b25d8beca..c2ff846721c 100644 --- a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs +++ b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs @@ -9,9 +9,9 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=lazy +// compile-flags:-Zprint-mono-items=lazy -// NB: We do not expect *any* translation item to be generated here. +// NB: We do not expect *any* monomorphization to be generated here. #![feature(const_fn)] #![deny(dead_code)] diff --git a/src/test/codegen-units/item-collection/unreferenced-inline-function.rs b/src/test/codegen-units/item-collection/unreferenced-inline-function.rs index 75d41a38012..829b4fbf3c9 100644 --- a/src/test/codegen-units/item-collection/unreferenced-inline-function.rs +++ b/src/test/codegen-units/item-collection/unreferenced-inline-function.rs @@ -9,9 +9,9 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=lazy +// compile-flags:-Zprint-mono-items=lazy -// NB: We do not expect *any* translation item to be generated here. +// NB: We do not expect *any* monomorphization to be generated here. #![deny(dead_code)] #![crate_type = "rlib"] @@ -20,4 +20,3 @@ pub fn foo() -> bool { [1, 2] == [3, 4] } - diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs index 87d2581e1f8..adc0eb6c709 100644 --- a/src/test/codegen-units/item-collection/unsizing.rs +++ b/src/test/codegen-units/item-collection/unsizing.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] @@ -54,19 +54,19 @@ struct Wrapper(*const T); impl, U: ?Sized> CoerceUnsized> for Wrapper {} -//~ TRANS_ITEM fn unsizing::start[0] +//~ MONO_ITEM fn unsizing::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { // simple case let bool_sized = &true; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] - //~ TRANS_ITEM fn unsizing::{{impl}}[0]::foo[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] + //~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0] let _bool_unsized = bool_sized as &Trait; let char_sized = &'a'; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] - //~ TRANS_ITEM fn unsizing::{{impl}}[1]::foo[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] + //~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0] let _char_unsized = char_sized as &Trait; // struct field @@ -75,14 +75,14 @@ fn start(_: isize, _: *const *const u8) -> isize { _b: 2, _c: 3.0f64 }; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] - //~ TRANS_ITEM fn unsizing::{{impl}}[2]::foo[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] + //~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0] let _struct_unsized = struct_sized as &Struct; // custom coercion let wrapper_sized = Wrapper(&0u32); - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] - //~ TRANS_ITEM fn unsizing::{{impl}}[3]::foo[0] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] + //~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0] let _wrapper_sized = wrapper_sized as Wrapper; 0 diff --git a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs b/src/test/codegen-units/item-collection/unused-traits-and-generics.rs index ce85c4fc13c..2edc7b211a1 100644 --- a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs +++ b/src/test/codegen-units/item-collection/unused-traits-and-generics.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager +// compile-flags:-Zprint-mono-items=eager #![crate_type="lib"] #![deny(dead_code)] @@ -85,4 +85,4 @@ impl NonGeneric { } // Only the non-generic methods should be instantiated: -//~ TRANS_ITEM fn unused_traits_and_generics::{{impl}}[3]::foo[0] +//~ MONO_ITEM fn unused_traits_and_generics::{{impl}}[3]::foo[0] diff --git a/src/test/codegen-units/partitioning/extern-drop-glue.rs b/src/test/codegen-units/partitioning/extern-drop-glue.rs index da96c5e183d..cbad3a63884 100644 --- a/src/test/codegen-units/partitioning/extern-drop-glue.rs +++ b/src/test/codegen-units/partitioning/extern-drop-glue.rs @@ -12,7 +12,7 @@ // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/extern-drop-glue +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/extern-drop-glue // compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] @@ -21,14 +21,14 @@ // aux-build:cgu_extern_drop_glue.rs extern crate cgu_extern_drop_glue; -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] struct LocalStruct(cgu_extern_drop_glue::Struct); -//~ TRANS_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External] +//~ MONO_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External] pub fn user() { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } @@ -37,10 +37,10 @@ pub mod mod1 { struct LocalStruct(cgu_extern_drop_glue::Struct); - //~ TRANS_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External] + //~ MONO_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External] pub fn user() { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue-mod1[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } } diff --git a/src/test/codegen-units/partitioning/extern-generic.rs b/src/test/codegen-units/partitioning/extern-generic.rs index 140b43c85d5..a774376690a 100644 --- a/src/test/codegen-units/partitioning/extern-generic.rs +++ b/src/test/codegen-units/partitioning/extern-generic.rs @@ -11,7 +11,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=eager -Zincremental=tmp/partitioning-tests/extern-generic -Zshare-generics=y +// compile-flags:-Zprint-mono-items=eager -Zincremental=tmp/partitioning-tests/extern-generic -Zshare-generics=y #![allow(dead_code)] #![crate_type="lib"] @@ -19,7 +19,7 @@ // aux-build:cgu_generic_function.rs extern crate cgu_generic_function; -//~ TRANS_ITEM fn extern_generic::user[0] @@ extern_generic[Internal] +//~ MONO_ITEM fn extern_generic::user[0] @@ extern_generic[Internal] fn user() { let _ = cgu_generic_function::foo("abc"); } @@ -27,7 +27,7 @@ fn user() { mod mod1 { use cgu_generic_function; - //~ TRANS_ITEM fn extern_generic::mod1[0]::user[0] @@ extern_generic-mod1[Internal] + //~ MONO_ITEM fn extern_generic::mod1[0]::user[0] @@ extern_generic-mod1[Internal] fn user() { let _ = cgu_generic_function::foo("abc"); } @@ -35,7 +35,7 @@ mod mod1 { mod mod1 { use cgu_generic_function; - //~ TRANS_ITEM fn extern_generic::mod1[0]::mod1[0]::user[0] @@ extern_generic-mod1-mod1[Internal] + //~ MONO_ITEM fn extern_generic::mod1[0]::mod1[0]::user[0] @@ extern_generic-mod1-mod1[Internal] fn user() { let _ = cgu_generic_function::foo("abc"); } @@ -45,18 +45,18 @@ mod mod1 { mod mod2 { use cgu_generic_function; - //~ TRANS_ITEM fn extern_generic::mod2[0]::user[0] @@ extern_generic-mod2[Internal] + //~ MONO_ITEM fn extern_generic::mod2[0]::user[0] @@ extern_generic-mod2[Internal] fn user() { let _ = cgu_generic_function::foo("abc"); } } mod mod3 { - //~ TRANS_ITEM fn extern_generic::mod3[0]::non_user[0] @@ extern_generic-mod3[Internal] + //~ MONO_ITEM fn extern_generic::mod3[0]::non_user[0] @@ extern_generic-mod3[Internal] fn non_user() {} } // Make sure the two generic functions from the extern crate get instantiated // once for the current crate -//~ TRANS_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function.volatile[External] -//~ TRANS_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function.volatile[External] +//~ MONO_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function.volatile[External] +//~ MONO_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function.volatile[External] diff --git a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs index 01600c03ba2..4136557d800 100644 --- a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs +++ b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs @@ -11,7 +11,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/inlining-from-extern-crate +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/inlining-from-extern-crate // compile-flags:-Zinline-in-all-cgus #![crate_type="lib"] @@ -22,28 +22,28 @@ extern crate cgu_explicit_inlining; // This test makes sure that items inlined from external crates are privately // instantiated in every codegen unit they are used in. -//~ TRANS_ITEM fn cgu_explicit_inlining::inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod1[Internal] -//~ TRANS_ITEM fn cgu_explicit_inlining::always_inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal] +//~ MONO_ITEM fn cgu_explicit_inlining::inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod1[Internal] +//~ MONO_ITEM fn cgu_explicit_inlining::always_inlined[0] @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal] -//~ TRANS_ITEM fn inlining_from_extern_crate::user[0] @@ inlining_from_extern_crate[External] +//~ MONO_ITEM fn inlining_from_extern_crate::user[0] @@ inlining_from_extern_crate[External] pub fn user() { cgu_explicit_inlining::inlined(); cgu_explicit_inlining::always_inlined(); - // does not generate a translation item in this crate + // does not generate a monomorphization in this crate cgu_explicit_inlining::never_inlined(); } pub mod mod1 { use cgu_explicit_inlining; - //~ TRANS_ITEM fn inlining_from_extern_crate::mod1[0]::user[0] @@ inlining_from_extern_crate-mod1[External] + //~ MONO_ITEM fn inlining_from_extern_crate::mod1[0]::user[0] @@ inlining_from_extern_crate-mod1[External] pub fn user() { cgu_explicit_inlining::inlined(); - // does not generate a translation item in this crate + // does not generate a monomorphization in this crate cgu_explicit_inlining::never_inlined(); } } @@ -51,12 +51,12 @@ pub mod mod1 { pub mod mod2 { use cgu_explicit_inlining; - //~ TRANS_ITEM fn inlining_from_extern_crate::mod2[0]::user[0] @@ inlining_from_extern_crate-mod2[External] + //~ MONO_ITEM fn inlining_from_extern_crate::mod2[0]::user[0] @@ inlining_from_extern_crate-mod2[External] pub fn user() { cgu_explicit_inlining::always_inlined(); - // does not generate a translation item in this crate + // does not generate a monomorphization in this crate cgu_explicit_inlining::never_inlined(); } } diff --git a/src/test/codegen-units/partitioning/local-drop-glue.rs b/src/test/codegen-units/partitioning/local-drop-glue.rs index f7c05285ed6..98729d99ea9 100644 --- a/src/test/codegen-units/partitioning/local-drop-glue.rs +++ b/src/test/codegen-units/partitioning/local-drop-glue.rs @@ -11,28 +11,28 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/local-drop-glue +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/local-drop-glue // compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] #![crate_type="rlib"] -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] struct Struct { _a: u32 } impl Drop for Struct { - //~ TRANS_ITEM fn local_drop_glue::{{impl}}[0]::drop[0] @@ local_drop_glue[External] + //~ MONO_ITEM fn local_drop_glue::{{impl}}[0]::drop[0] @@ local_drop_glue[External] fn drop(&mut self) {} } -//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] +//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] struct Outer { _a: Struct } -//~ TRANS_ITEM fn local_drop_glue::user[0] @@ local_drop_glue[External] +//~ MONO_ITEM fn local_drop_glue::user[0] @@ local_drop_glue[External] pub fn user() { let _ = Outer { @@ -46,14 +46,14 @@ pub mod mod1 { use super::Struct; - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue-mod1[Internal] struct Struct2 { _a: Struct, - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] _b: (u32, Struct), } - //~ TRANS_ITEM fn local_drop_glue::mod1[0]::user[0] @@ local_drop_glue-mod1[External] + //~ MONO_ITEM fn local_drop_glue::mod1[0]::user[0] @@ local_drop_glue-mod1[External] pub fn user() { let _ = Struct2 { diff --git a/src/test/codegen-units/partitioning/local-generic.rs b/src/test/codegen-units/partitioning/local-generic.rs index 33e3745502f..7c8ca20e1e3 100644 --- a/src/test/codegen-units/partitioning/local-generic.rs +++ b/src/test/codegen-units/partitioning/local-generic.rs @@ -11,18 +11,18 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=eager -Zincremental=tmp/partitioning-tests/local-generic +// compile-flags:-Zprint-mono-items=eager -Zincremental=tmp/partitioning-tests/local-generic #![allow(dead_code)] #![crate_type="lib"] -//~ TRANS_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ TRANS_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ TRANS_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ TRANS_ITEM fn local_generic::generic[0]<&str> @@ local_generic.volatile[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] +//~ MONO_ITEM fn local_generic::generic[0]<&str> @@ local_generic.volatile[External] pub fn generic(x: T) -> T { x } -//~ TRANS_ITEM fn local_generic::user[0] @@ local_generic[Internal] +//~ MONO_ITEM fn local_generic::user[0] @@ local_generic[Internal] fn user() { let _ = generic(0u32); } @@ -30,7 +30,7 @@ fn user() { mod mod1 { pub use super::generic; - //~ TRANS_ITEM fn local_generic::mod1[0]::user[0] @@ local_generic-mod1[Internal] + //~ MONO_ITEM fn local_generic::mod1[0]::user[0] @@ local_generic-mod1[Internal] fn user() { let _ = generic(0u64); } @@ -38,7 +38,7 @@ mod mod1 { mod mod1 { use super::generic; - //~ TRANS_ITEM fn local_generic::mod1[0]::mod1[0]::user[0] @@ local_generic-mod1-mod1[Internal] + //~ MONO_ITEM fn local_generic::mod1[0]::mod1[0]::user[0] @@ local_generic-mod1-mod1[Internal] fn user() { let _ = generic('c'); } @@ -48,7 +48,7 @@ mod mod1 { mod mod2 { use super::generic; - //~ TRANS_ITEM fn local_generic::mod2[0]::user[0] @@ local_generic-mod2[Internal] + //~ MONO_ITEM fn local_generic::mod2[0]::user[0] @@ local_generic-mod2[Internal] fn user() { let _ = generic("abc"); } diff --git a/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs b/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs index cf197301eec..747f768c11f 100644 --- a/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs +++ b/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs @@ -11,7 +11,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/local-inlining-but-not-all +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/local-inlining-but-not-all // compile-flags:-Zinline-in-all-cgus=no #![allow(dead_code)] @@ -19,7 +19,7 @@ mod inline { - //~ TRANS_ITEM fn local_inlining_but_not_all::inline[0]::inlined_function[0] @@ local_inlining_but_not_all-inline[External] + //~ MONO_ITEM fn local_inlining_but_not_all::inline[0]::inlined_function[0] @@ local_inlining_but_not_all-inline[External] #[inline] pub fn inlined_function() { @@ -30,7 +30,7 @@ mod inline { pub mod user1 { use super::inline; - //~ TRANS_ITEM fn local_inlining_but_not_all::user1[0]::foo[0] @@ local_inlining_but_not_all-user1[External] + //~ MONO_ITEM fn local_inlining_but_not_all::user1[0]::foo[0] @@ local_inlining_but_not_all-user1[External] pub fn foo() { inline::inlined_function(); } @@ -39,7 +39,7 @@ pub mod user1 { pub mod user2 { use super::inline; - //~ TRANS_ITEM fn local_inlining_but_not_all::user2[0]::bar[0] @@ local_inlining_but_not_all-user2[External] + //~ MONO_ITEM fn local_inlining_but_not_all::user2[0]::bar[0] @@ local_inlining_but_not_all-user2[External] pub fn bar() { inline::inlined_function(); } @@ -47,7 +47,7 @@ pub mod user2 { pub mod non_user { - //~ TRANS_ITEM fn local_inlining_but_not_all::non_user[0]::baz[0] @@ local_inlining_but_not_all-non_user[External] + //~ MONO_ITEM fn local_inlining_but_not_all::non_user[0]::baz[0] @@ local_inlining_but_not_all-non_user[External] pub fn baz() { } diff --git a/src/test/codegen-units/partitioning/local-inlining.rs b/src/test/codegen-units/partitioning/local-inlining.rs index 3502aa59fdc..f144f0d992b 100644 --- a/src/test/codegen-units/partitioning/local-inlining.rs +++ b/src/test/codegen-units/partitioning/local-inlining.rs @@ -11,7 +11,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/local-inlining +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/local-inlining // compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] @@ -20,7 +20,7 @@ mod inline { // Important: This function should show up in all codegen units where it is inlined - //~ TRANS_ITEM fn local_inlining::inline[0]::inlined_function[0] @@ local_inlining-user1[Internal] local_inlining-user2[Internal] + //~ MONO_ITEM fn local_inlining::inline[0]::inlined_function[0] @@ local_inlining-user1[Internal] local_inlining-user2[Internal] #[inline(always)] pub fn inlined_function() { @@ -31,7 +31,7 @@ mod inline { pub mod user1 { use super::inline; - //~ TRANS_ITEM fn local_inlining::user1[0]::foo[0] @@ local_inlining-user1[External] + //~ MONO_ITEM fn local_inlining::user1[0]::foo[0] @@ local_inlining-user1[External] pub fn foo() { inline::inlined_function(); } @@ -40,7 +40,7 @@ pub mod user1 { pub mod user2 { use super::inline; - //~ TRANS_ITEM fn local_inlining::user2[0]::bar[0] @@ local_inlining-user2[External] + //~ MONO_ITEM fn local_inlining::user2[0]::bar[0] @@ local_inlining-user2[External] pub fn bar() { inline::inlined_function(); } @@ -48,7 +48,7 @@ pub mod user2 { pub mod non_user { - //~ TRANS_ITEM fn local_inlining::non_user[0]::baz[0] @@ local_inlining-non_user[External] + //~ MONO_ITEM fn local_inlining::non_user[0]::baz[0] @@ local_inlining-non_user[External] pub fn baz() { } diff --git a/src/test/codegen-units/partitioning/local-transitive-inlining.rs b/src/test/codegen-units/partitioning/local-transitive-inlining.rs index ed883954f3f..8637844a83d 100644 --- a/src/test/codegen-units/partitioning/local-transitive-inlining.rs +++ b/src/test/codegen-units/partitioning/local-transitive-inlining.rs @@ -11,7 +11,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/local-transitive-inlining +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/local-transitive-inlining // compile-flags:-Zinline-in-all-cgus #![allow(dead_code)] @@ -19,7 +19,7 @@ mod inline { - //~ TRANS_ITEM fn local_transitive_inlining::inline[0]::inlined_function[0] @@ local_transitive_inlining-indirect_user[Internal] + //~ MONO_ITEM fn local_transitive_inlining::inline[0]::inlined_function[0] @@ local_transitive_inlining-indirect_user[Internal] #[inline(always)] pub fn inlined_function() { @@ -30,7 +30,7 @@ mod inline { mod direct_user { use super::inline; - //~ TRANS_ITEM fn local_transitive_inlining::direct_user[0]::foo[0] @@ local_transitive_inlining-indirect_user[Internal] + //~ MONO_ITEM fn local_transitive_inlining::direct_user[0]::foo[0] @@ local_transitive_inlining-indirect_user[Internal] #[inline(always)] pub fn foo() { inline::inlined_function(); @@ -40,7 +40,7 @@ mod direct_user { pub mod indirect_user { use super::direct_user; - //~ TRANS_ITEM fn local_transitive_inlining::indirect_user[0]::bar[0] @@ local_transitive_inlining-indirect_user[External] + //~ MONO_ITEM fn local_transitive_inlining::indirect_user[0]::bar[0] @@ local_transitive_inlining-indirect_user[External] pub fn bar() { direct_user::foo(); } @@ -48,7 +48,7 @@ pub mod indirect_user { pub mod non_user { - //~ TRANS_ITEM fn local_transitive_inlining::non_user[0]::baz[0] @@ local_transitive_inlining-non_user[External] + //~ MONO_ITEM fn local_transitive_inlining::non_user[0]::baz[0] @@ local_transitive_inlining-non_user[External] pub fn baz() { } diff --git a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs index aa01289de59..ff25a7194e0 100644 --- a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs @@ -16,7 +16,7 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/methods-are-with-self-type +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/methods-are-with-self-type #![allow(dead_code)] #![feature(start)] @@ -31,10 +31,10 @@ mod mod1 { // Even though the impl is in `mod1`, the methods should end up in the // parent module, since that is where their self-type is. impl SomeType { - //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External] + //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External] fn method(&self) {} - //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::associated_fn[0] @@ methods_are_with_self_type[External] + //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::associated_fn[0] @@ methods_are_with_self_type[External] fn associated_fn() {} } @@ -64,25 +64,25 @@ mod type2 { pub struct Struct; } -//~ TRANS_ITEM fn methods_are_with_self_type::start[0] +//~ MONO_ITEM fn methods_are_with_self_type::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0] @@ methods_are_with_self_type.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0] @@ methods_are_with_self_type.volatile[WeakODR] SomeGenericType(0u32, 0u64).method(); - //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0] @@ methods_are_with_self_type.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0] @@ methods_are_with_self_type.volatile[WeakODR] SomeGenericType::associated_fn('c', "&str"); - //~ TRANS_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0] @@ methods_are_with_self_type-type1.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0] @@ methods_are_with_self_type-type1.volatile[WeakODR] type1::Struct.foo(); - //~ TRANS_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0] @@ methods_are_with_self_type-type2.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0] @@ methods_are_with_self_type-type2.volatile[WeakODR] type2::Struct.foo(); - //~ TRANS_ITEM fn methods_are_with_self_type::Trait[0]::default[0] @@ methods_are_with_self_type-type1.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0] @@ methods_are_with_self_type-type1.volatile[WeakODR] type1::Struct.default(); - //~ TRANS_ITEM fn methods_are_with_self_type::Trait[0]::default[0] @@ methods_are_with_self_type-type2.volatile[WeakODR] + //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0] @@ methods_are_with_self_type-type2.volatile[WeakODR] type2::Struct.default(); 0 } -//~ TRANS_ITEM drop-glue i8 +//~ MONO_ITEM drop-glue i8 diff --git a/src/test/codegen-units/partitioning/regular-modules.rs b/src/test/codegen-units/partitioning/regular-modules.rs index 9bdbc8b85e8..e1ec6f51b30 100644 --- a/src/test/codegen-units/partitioning/regular-modules.rs +++ b/src/test/codegen-units/partitioning/regular-modules.rs @@ -11,72 +11,72 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=eager -Zincremental=tmp/partitioning-tests/regular-modules +// compile-flags:-Zprint-mono-items=eager -Zincremental=tmp/partitioning-tests/regular-modules #![allow(dead_code)] #![crate_type="lib"] -//~ TRANS_ITEM fn regular_modules::foo[0] @@ regular_modules[Internal] +//~ MONO_ITEM fn regular_modules::foo[0] @@ regular_modules[Internal] fn foo() {} -//~ TRANS_ITEM fn regular_modules::bar[0] @@ regular_modules[Internal] +//~ MONO_ITEM fn regular_modules::bar[0] @@ regular_modules[Internal] fn bar() {} -//~ TRANS_ITEM static regular_modules::BAZ[0] @@ regular_modules[Internal] +//~ MONO_ITEM static regular_modules::BAZ[0] @@ regular_modules[Internal] static BAZ: u64 = 0; mod mod1 { - //~ TRANS_ITEM fn regular_modules::mod1[0]::foo[0] @@ regular_modules-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::foo[0] @@ regular_modules-mod1[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod1[0]::bar[0] @@ regular_modules-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::bar[0] @@ regular_modules-mod1[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod1[0]::BAZ[0] @@ regular_modules-mod1[Internal] + //~ MONO_ITEM static regular_modules::mod1[0]::BAZ[0] @@ regular_modules-mod1[Internal] static BAZ: u64 = 0; mod mod1 { - //~ TRANS_ITEM fn regular_modules::mod1[0]::mod1[0]::foo[0] @@ regular_modules-mod1-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::mod1[0]::foo[0] @@ regular_modules-mod1-mod1[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod1[0]::mod1[0]::bar[0] @@ regular_modules-mod1-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::mod1[0]::bar[0] @@ regular_modules-mod1-mod1[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod1[0]::mod1[0]::BAZ[0] @@ regular_modules-mod1-mod1[Internal] + //~ MONO_ITEM static regular_modules::mod1[0]::mod1[0]::BAZ[0] @@ regular_modules-mod1-mod1[Internal] static BAZ: u64 = 0; } mod mod2 { - //~ TRANS_ITEM fn regular_modules::mod1[0]::mod2[0]::foo[0] @@ regular_modules-mod1-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::mod2[0]::foo[0] @@ regular_modules-mod1-mod2[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod1[0]::mod2[0]::bar[0] @@ regular_modules-mod1-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod1[0]::mod2[0]::bar[0] @@ regular_modules-mod1-mod2[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod1[0]::mod2[0]::BAZ[0] @@ regular_modules-mod1-mod2[Internal] + //~ MONO_ITEM static regular_modules::mod1[0]::mod2[0]::BAZ[0] @@ regular_modules-mod1-mod2[Internal] static BAZ: u64 = 0; } } mod mod2 { - //~ TRANS_ITEM fn regular_modules::mod2[0]::foo[0] @@ regular_modules-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::foo[0] @@ regular_modules-mod2[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod2[0]::bar[0] @@ regular_modules-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::bar[0] @@ regular_modules-mod2[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod2[0]::BAZ[0] @@ regular_modules-mod2[Internal] + //~ MONO_ITEM static regular_modules::mod2[0]::BAZ[0] @@ regular_modules-mod2[Internal] static BAZ: u64 = 0; mod mod1 { - //~ TRANS_ITEM fn regular_modules::mod2[0]::mod1[0]::foo[0] @@ regular_modules-mod2-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::mod1[0]::foo[0] @@ regular_modules-mod2-mod1[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod2[0]::mod1[0]::bar[0] @@ regular_modules-mod2-mod1[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::mod1[0]::bar[0] @@ regular_modules-mod2-mod1[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod2[0]::mod1[0]::BAZ[0] @@ regular_modules-mod2-mod1[Internal] + //~ MONO_ITEM static regular_modules::mod2[0]::mod1[0]::BAZ[0] @@ regular_modules-mod2-mod1[Internal] static BAZ: u64 = 0; } mod mod2 { - //~ TRANS_ITEM fn regular_modules::mod2[0]::mod2[0]::foo[0] @@ regular_modules-mod2-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::mod2[0]::foo[0] @@ regular_modules-mod2-mod2[Internal] fn foo() {} - //~ TRANS_ITEM fn regular_modules::mod2[0]::mod2[0]::bar[0] @@ regular_modules-mod2-mod2[Internal] + //~ MONO_ITEM fn regular_modules::mod2[0]::mod2[0]::bar[0] @@ regular_modules-mod2-mod2[Internal] fn bar() {} - //~ TRANS_ITEM static regular_modules::mod2[0]::mod2[0]::BAZ[0] @@ regular_modules-mod2-mod2[Internal] + //~ MONO_ITEM static regular_modules::mod2[0]::mod2[0]::BAZ[0] @@ regular_modules-mod2-mod2[Internal] static BAZ: u64 = 0; } } diff --git a/src/test/codegen-units/partitioning/shared-generics.rs b/src/test/codegen-units/partitioning/shared-generics.rs index d352609bfcb..880361fac2e 100644 --- a/src/test/codegen-units/partitioning/shared-generics.rs +++ b/src/test/codegen-units/partitioning/shared-generics.rs @@ -9,17 +9,17 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags:-Zprint-trans-items=eager -Zshare-generics=yes -Zincremental=tmp/partitioning-tests/shared-generics-exe +// compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Zincremental=tmp/partitioning-tests/shared-generics-exe #![crate_type="rlib"] // aux-build:shared_generics_aux.rs extern crate shared_generics_aux; -//~ TRANS_ITEM fn shared_generics::foo[0] +//~ MONO_ITEM fn shared_generics::foo[0] pub fn foo() { - //~ TRANS_ITEM fn shared_generics_aux::generic_fn[0] @@ shared_generics_aux.volatile[External] + //~ MONO_ITEM fn shared_generics_aux::generic_fn[0] @@ shared_generics_aux.volatile[External] let _ = shared_generics_aux::generic_fn(0u16, 1u16); // This should not generate a monomorphization because it's already @@ -27,4 +27,4 @@ pub fn foo() { let _ = shared_generics_aux::generic_fn(0.0f32, 3.0f32); } -// TRANS_ITEM drop-glue i8 +// MONO_ITEM drop-glue i8 diff --git a/src/test/codegen-units/partitioning/statics.rs b/src/test/codegen-units/partitioning/statics.rs index 12ef34441ff..b6c1e5210da 100644 --- a/src/test/codegen-units/partitioning/statics.rs +++ b/src/test/codegen-units/partitioning/statics.rs @@ -11,38 +11,38 @@ // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/statics +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/statics #![crate_type="rlib"] -//~ TRANS_ITEM static statics::FOO[0] @@ statics[Internal] +//~ MONO_ITEM static statics::FOO[0] @@ statics[Internal] static FOO: u32 = 0; -//~ TRANS_ITEM static statics::BAR[0] @@ statics[Internal] +//~ MONO_ITEM static statics::BAR[0] @@ statics[Internal] static BAR: u32 = 0; -//~ TRANS_ITEM fn statics::function[0] @@ statics[External] +//~ MONO_ITEM fn statics::function[0] @@ statics[External] pub fn function() { - //~ TRANS_ITEM static statics::function[0]::FOO[0] @@ statics[Internal] + //~ MONO_ITEM static statics::function[0]::FOO[0] @@ statics[Internal] static FOO: u32 = 0; - //~ TRANS_ITEM static statics::function[0]::BAR[0] @@ statics[Internal] + //~ MONO_ITEM static statics::function[0]::BAR[0] @@ statics[Internal] static BAR: u32 = 0; } pub mod mod1 { - //~ TRANS_ITEM static statics::mod1[0]::FOO[0] @@ statics-mod1[Internal] + //~ MONO_ITEM static statics::mod1[0]::FOO[0] @@ statics-mod1[Internal] static FOO: u32 = 0; - //~ TRANS_ITEM static statics::mod1[0]::BAR[0] @@ statics-mod1[Internal] + //~ MONO_ITEM static statics::mod1[0]::BAR[0] @@ statics-mod1[Internal] static BAR: u32 = 0; - //~ TRANS_ITEM fn statics::mod1[0]::function[0] @@ statics-mod1[External] + //~ MONO_ITEM fn statics::mod1[0]::function[0] @@ statics-mod1[External] pub fn function() { - //~ TRANS_ITEM static statics::mod1[0]::function[0]::FOO[0] @@ statics-mod1[Internal] + //~ MONO_ITEM static statics::mod1[0]::function[0]::FOO[0] @@ statics-mod1[Internal] static FOO: u32 = 0; - //~ TRANS_ITEM static statics::mod1[0]::function[0]::BAR[0] @@ statics-mod1[Internal] + //~ MONO_ITEM static statics::mod1[0]::function[0]::BAR[0] @@ statics-mod1[Internal] static BAR: u32 = 0; } } diff --git a/src/test/codegen-units/partitioning/vtable-through-const.rs b/src/test/codegen-units/partitioning/vtable-through-const.rs index d0acddda637..74533c1015b 100644 --- a/src/test/codegen-units/partitioning/vtable-through-const.rs +++ b/src/test/codegen-units/partitioning/vtable-through-const.rs @@ -12,7 +12,7 @@ // We specify -Z incremental here because we want to test the partitioning for // incremental compilation -// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/vtable-through-const +// compile-flags:-Zprint-mono-items=lazy -Zincremental=tmp/partitioning-tests/vtable-through-const // compile-flags:-Zinline-in-all-cgus // This test case makes sure, that references made through constants are @@ -40,7 +40,7 @@ mod mod1 { fn id(x: T) -> T { x } - // These are referenced, so they produce trans-items (see start()) + // These are referenced, so they produce mono-items (see start()) pub const TRAIT1_REF: &'static Trait1 = &0u32 as &Trait1; pub const TRAIT1_GEN_REF: &'static Trait1Gen = &0u32 as &Trait1Gen; pub const ID_CHAR: fn(char) -> char = id::; @@ -64,34 +64,34 @@ mod mod1 { fn do_something_else(&self, x: T) -> T { x } } - // These are not referenced, so they do not produce trans-items + // These are not referenced, so they do not produce mono-items pub const TRAIT2_REF: &'static Trait2 = &0u32 as &Trait2; pub const TRAIT2_GEN_REF: &'static Trait2Gen = &0u32 as &Trait2Gen; pub const ID_I64: fn(i64) -> i64 = id::; } -//~ TRANS_ITEM fn vtable_through_const::start[0] +//~ MONO_ITEM fn vtable_through_const::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ vtable_through_const[Internal] + //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ vtable_through_const[Internal] // Since Trait1::do_something() is instantiated via its default implementation, // it is considered a generic and is instantiated here only because it is // referenced in this module. - //~ TRANS_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] // Although it is never used, Trait1::do_something_else() has to be // instantiated locally here too, otherwise the <&u32 as &Trait1> vtable // could not be fully constructed. - //~ TRANS_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something[0] @@ vtable_through_const-mod1.volatile[External] mod1::TRAIT1_REF.do_something(); // Same as above - //~ TRANS_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something[0] @@ vtable_through_const-mod1.volatile[External] - //~ TRANS_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] mod1::TRAIT1_GEN_REF.do_something(0u8); - //~ TRANS_ITEM fn vtable_through_const::mod1[0]::id[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::id[0] @@ vtable_through_const-mod1.volatile[External] mod1::ID_CHAR('x'); 0 diff --git a/src/test/compile-fail/const-err.rs b/src/test/compile-fail/const-err.rs index 8bd759b6d37..f6a64bcba21 100644 --- a/src/test/compile-fail/const-err.rs +++ b/src/test/compile-fail/const-err.rs @@ -10,7 +10,7 @@ // compile-flags: -Zforce-overflow-checks=on -// these errors are not actually "const_err", they occur in trans/consts +// these errors are not actually "const_err", they occur in codegen/consts // and are unconditional warnings that can't be denied or allowed #![allow(exceeding_bitshifts)] diff --git a/src/test/compile-fail/const-eval-overflow2.rs b/src/test/compile-fail/const-eval-overflow2.rs index faa8c3039b7..7b5db7a4f6d 100644 --- a/src/test/compile-fail/const-eval-overflow2.rs +++ b/src/test/compile-fail/const-eval-overflow2.rs @@ -11,7 +11,7 @@ #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by trans and llvm), so if you +// evaluation below (e.g. that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/compile-fail/const-eval-overflow2b.rs b/src/test/compile-fail/const-eval-overflow2b.rs index d827e680c5b..ce4dc72555d 100644 --- a/src/test/compile-fail/const-eval-overflow2b.rs +++ b/src/test/compile-fail/const-eval-overflow2b.rs @@ -11,7 +11,7 @@ #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by trans and llvm), so if you +// evaluation below (e.g. that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/compile-fail/const-eval-overflow2c.rs b/src/test/compile-fail/const-eval-overflow2c.rs index 2fd46b038ef..88eb14a1330 100644 --- a/src/test/compile-fail/const-eval-overflow2c.rs +++ b/src/test/compile-fail/const-eval-overflow2c.rs @@ -11,7 +11,7 @@ #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by trans and llvm), so if you +// evaluation below (e.g. that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/compile-fail/dep-graph-assoc-type-trans.rs b/src/test/compile-fail/dep-graph-assoc-type-codegen.rs similarity index 95% rename from src/test/compile-fail/dep-graph-assoc-type-trans.rs rename to src/test/compile-fail/dep-graph-assoc-type-codegen.rs index 007a80008a8..c20cfbc7e23 100644 --- a/src/test/compile-fail/dep-graph-assoc-type-trans.rs +++ b/src/test/compile-fail/dep-graph-assoc-type-codegen.rs @@ -39,7 +39,7 @@ mod y { pub fn use_char_assoc() { // Careful here: in the representation, ::T gets // normalized away, so at a certain point we had no edge to - // trans. (But now trans just depends on typeck.) + // codegen. (But now codegen just depends on typeck.) let x: ::T = 'a'; } diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs index af70b4a63fd..ab935a07d65 100644 --- a/src/test/debuginfo/struct-with-destructor.rs +++ b/src/test/debuginfo/struct-with-destructor.rs @@ -91,7 +91,7 @@ struct NestedOuter { // The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used -// at runtime to prevent drop() to be executed more than once (see middle::trans::adt). +// at runtime to prevent drop() to be executed more than once. // This field must be incorporated by the debug info generation. Otherwise the debugger assumes a // wrong size/layout for the struct. fn main() { diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index 120bbdd7ba9..9aeb3bc9133 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -72,7 +72,7 @@ fn main() { let constant2 = 6_usize; // The `self` argument of the following closure should be passed by value - // to FnOnce::call_once(self, args), which gets translated a bit differently + // to FnOnce::call_once(self, args), which gets codegened a bit differently // than the regular case. Let's make sure this is supported too. let immedate_env = move || { zzz(); // #break diff --git a/src/test/incremental/cache_file_headers.rs b/src/test/incremental/cache_file_headers.rs index feecfecd0b8..02ee06b4cf4 100644 --- a/src/test/incremental/cache_file_headers.rs +++ b/src/test/incremental/cache_file_headers.rs @@ -13,7 +13,7 @@ // different compiler version. This is tested by artificially forcing the // emission of a different compiler version in the header of rpass1 artifacts, // and then making sure that the only object file of the test program gets -// re-translated although the program stays unchanged. +// re-codegened although the program stays unchanged. // The `l33t haxx0r` Rust compiler is known to produce incr. comp. artifacts // that are outrageously incompatible with just about anything, even itself: @@ -23,7 +23,7 @@ // compile-flags: -Z query-dep-graph #![feature(rustc_attrs)] -#![rustc_partition_translated(module="cache_file_headers", cfg="rpass2")] +#![rustc_partition_codegened(module="cache_file_headers", cfg="rpass2")] fn main() { // empty diff --git a/src/test/incremental/change_add_field/struct_point.rs b/src/test/incremental/change_add_field/struct_point.rs index da3b9e4d6d6..37d1a397303 100644 --- a/src/test/incremental/change_add_field/struct_point.rs +++ b/src/test/incremental/change_add_field/struct_point.rs @@ -22,14 +22,14 @@ #![allow(dead_code)] #![crate_type = "rlib"] -// These are expected to require translation. -#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_with_type_in_sig", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-call_fn_with_type_in_sig", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_with_type_in_body", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_make_struct", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_read_field", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_write_field", cfg="cfail2")] +// These are expected to require codegen. +#![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_with_type_in_sig", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-call_fn_with_type_in_sig", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_with_type_in_body", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_make_struct", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_read_field", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_write_field", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="cfail2")] diff --git a/src/test/incremental/change_private_fn/struct_point.rs b/src/test/incremental/change_private_fn/struct_point.rs index 63e137a7e0b..d1b8399dbda 100644 --- a/src/test/incremental/change_private_fn/struct_point.rs +++ b/src/test/incremental/change_private_fn/struct_point.rs @@ -20,7 +20,7 @@ #![allow(dead_code)] #![crate_type = "rlib"] -#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")] diff --git a/src/test/incremental/change_private_impl_method/struct_point.rs b/src/test/incremental/change_private_impl_method/struct_point.rs index 7f2dd81d0ea..cf6eefd61d7 100644 --- a/src/test/incremental/change_private_impl_method/struct_point.rs +++ b/src/test/incremental/change_private_impl_method/struct_point.rs @@ -20,7 +20,7 @@ #![allow(dead_code)] #![crate_type = "rlib"] -#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="cfail2")] diff --git a/src/test/incremental/change_pub_inherent_method_body/struct_point.rs b/src/test/incremental/change_pub_inherent_method_body/struct_point.rs index 412fe72e4e4..a204fe27da6 100644 --- a/src/test/incremental/change_pub_inherent_method_body/struct_point.rs +++ b/src/test/incremental/change_pub_inherent_method_body/struct_point.rs @@ -19,7 +19,7 @@ #![feature(stmt_expr_attributes)] #![allow(dead_code)] -#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_changed_method", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="cfail2")] diff --git a/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs b/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs index c82f4645caf..76c9dfce93d 100644 --- a/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs +++ b/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs @@ -19,9 +19,9 @@ #![feature(stmt_expr_attributes)] #![allow(dead_code)] -// These are expected to require translation. -#![rustc_partition_translated(module="struct_point-point", cfg="cfail2")] -#![rustc_partition_translated(module="struct_point-fn_calls_changed_method", cfg="cfail2")] +// These are expected to require codegen. +#![rustc_partition_codegened(module="struct_point-point", cfg="cfail2")] +#![rustc_partition_codegened(module="struct_point-fn_calls_changed_method", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="cfail2")] #![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="cfail2")] diff --git a/src/test/incremental/change_symbol_export_status.rs b/src/test/incremental/change_symbol_export_status.rs index ab91a941a16..feb8026f501 100644 --- a/src/test/incremental/change_symbol_export_status.rs +++ b/src/test/incremental/change_symbol_export_status.rs @@ -14,7 +14,7 @@ #![feature(rustc_attrs)] #![allow(private_no_mangle_fns)] -#![rustc_partition_translated(module="change_symbol_export_status-mod1", cfg="rpass2")] +#![rustc_partition_codegened(module="change_symbol_export_status-mod1", cfg="rpass2")] #![rustc_partition_reused(module="change_symbol_export_status-mod2", cfg="rpass2")] // This test case makes sure that a change in symbol visibility is detected by diff --git a/src/test/incremental/commandline-args.rs b/src/test/incremental/commandline-args.rs index e29f2ec2a13..bb2f385e9c5 100644 --- a/src/test/incremental/commandline-args.rs +++ b/src/test/incremental/commandline-args.rs @@ -16,7 +16,7 @@ #![feature(rustc_attrs)] -#![rustc_partition_translated(module="commandline_args", cfg="rpass2")] +#![rustc_partition_codegened(module="commandline_args", cfg="rpass2")] #![rustc_partition_reused(module="commandline_args", cfg="rpass3")] // Between revisions 1 and 2, we are changing the debuginfo-level, which should diff --git a/src/test/incremental/inlined_hir_34991/main.rs b/src/test/incremental/inlined_hir_34991/main.rs index a150a8c4df7..baf4ae73932 100644 --- a/src/test/incremental/inlined_hir_34991/main.rs +++ b/src/test/incremental/inlined_hir_34991/main.rs @@ -10,7 +10,7 @@ // Regression test for #34991: an ICE occurred here because we inline // some of the vector routines and give them a local def-id `X`. This -// got hashed after trans (`Hir(X)`). When we load back up, we get an +// got hashed after codegen (`Hir(X)`). When we load back up, we get an // error because the `X` is remapped to the original def-id (in // libstd), and we can't hash a HIR node from std. diff --git a/src/test/incremental/issue-38222.rs b/src/test/incremental/issue-38222.rs index f890672aa8f..a19de6ef636 100644 --- a/src/test/incremental/issue-38222.rs +++ b/src/test/incremental/issue-38222.rs @@ -20,7 +20,7 @@ #![rustc_partition_reused(module="issue_38222-mod1", cfg="rpass2")] -// If trans had added a dependency edge to the Krate dep-node, nothing would +// If codegen had added a dependency edge to the Krate dep-node, nothing would // be re-used, so checking that this module was re-used is sufficient. #![rustc_partition_reused(module="issue_38222", cfg="rpass2")] diff --git a/src/test/incremental/issue-49595/issue_49595.rs b/src/test/incremental/issue-49595/issue_49595.rs index a5b0101c68f..dfa92d425f4 100644 --- a/src/test/incremental/issue-49595/issue_49595.rs +++ b/src/test/incremental/issue-49595/issue_49595.rs @@ -15,8 +15,8 @@ #![feature(rustc_attrs)] #![crate_type = "rlib"] -#![rustc_partition_translated(module="issue_49595-tests", cfg="cfail2")] -#![rustc_partition_translated(module="issue_49595-lit_test", cfg="cfail3")] +#![rustc_partition_codegened(module="issue_49595-tests", cfg="cfail2")] +#![rustc_partition_codegened(module="issue_49595-lit_test", cfg="cfail3")] mod tests { #[cfg_attr(not(cfail1), ignore)] diff --git a/src/test/incremental/remapped_paths_cc/main.rs b/src/test/incremental/remapped_paths_cc/main.rs index ce7f5792cea..cd66310dafe 100644 --- a/src/test/incremental/remapped_paths_cc/main.rs +++ b/src/test/incremental/remapped_paths_cc/main.rs @@ -20,7 +20,7 @@ #![rustc_partition_reused(module="main", cfg="rpass2")] #![rustc_partition_reused(module="main-some_mod", cfg="rpass2")] #![rustc_partition_reused(module="main", cfg="rpass3")] -#![rustc_partition_translated(module="main-some_mod", cfg="rpass3")] +#![rustc_partition_codegened(module="main-some_mod", cfg="rpass3")] extern crate extern_crate; diff --git a/src/test/incremental/spike-neg1.rs b/src/test/incremental/spike-neg1.rs index b00c68a184e..d4701b9a66e 100644 --- a/src/test/incremental/spike-neg1.rs +++ b/src/test/incremental/spike-neg1.rs @@ -9,7 +9,7 @@ // except according to those terms. // A variant of the first "spike" test that serves to test the -// `rustc_partition_reused` and `rustc_partition_translated` tests. +// `rustc_partition_reused` and `rustc_partition_codegened` tests. // Here we change and say that the `x` module will be reused (when in // fact it will not), and then indicate that the test itself // should-fail (because an error will be reported, and hence the diff --git a/src/test/incremental/spike-neg2.rs b/src/test/incremental/spike-neg2.rs index 472d11d7f90..da79237b1a6 100644 --- a/src/test/incremental/spike-neg2.rs +++ b/src/test/incremental/spike-neg2.rs @@ -9,8 +9,8 @@ // except according to those terms. // A variant of the first "spike" test that serves to test the -// `rustc_partition_reused` and `rustc_partition_translated` tests. -// Here we change and say that the `y` module will be translated (when +// `rustc_partition_reused` and `rustc_partition_codegened` tests. +// Here we change and say that the `y` module will be codegened (when // in fact it will not), and then indicate that the test itself // should-fail (because an error will be reported, and hence the // revision rpass2 will not compile, despite being named rpass). @@ -21,8 +21,8 @@ #![feature(rustc_attrs)] #![rustc_partition_reused(module="spike_neg2", cfg="rpass2")] -#![rustc_partition_translated(module="spike_neg2-x", cfg="rpass2")] -#![rustc_partition_translated(module="spike_neg2-y", cfg="rpass2")] // this is wrong! +#![rustc_partition_codegened(module="spike_neg2-x", cfg="rpass2")] +#![rustc_partition_codegened(module="spike_neg2-y", cfg="rpass2")] // this is wrong! mod x { pub struct X { diff --git a/src/test/incremental/spike.rs b/src/test/incremental/spike.rs index a820471b7d5..1756511dd37 100644 --- a/src/test/incremental/spike.rs +++ b/src/test/incremental/spike.rs @@ -18,7 +18,7 @@ #![feature(rustc_attrs)] #![rustc_partition_reused(module="spike", cfg="rpass2")] -#![rustc_partition_translated(module="spike-x", cfg="rpass2")] +#![rustc_partition_codegened(module="spike-x", cfg="rpass2")] #![rustc_partition_reused(module="spike-y", cfg="rpass2")] mod x { diff --git a/src/test/run-fail/mir_trans_calls_converging_drops.rs b/src/test/run-fail/mir_codegen_calls_converging_drops.rs similarity index 100% rename from src/test/run-fail/mir_trans_calls_converging_drops.rs rename to src/test/run-fail/mir_codegen_calls_converging_drops.rs diff --git a/src/test/run-fail/mir_trans_calls_converging_drops_2.rs b/src/test/run-fail/mir_codegen_calls_converging_drops_2.rs similarity index 100% rename from src/test/run-fail/mir_trans_calls_converging_drops_2.rs rename to src/test/run-fail/mir_codegen_calls_converging_drops_2.rs diff --git a/src/test/run-fail/mir_trans_calls_diverging.rs b/src/test/run-fail/mir_codegen_calls_diverging.rs similarity index 100% rename from src/test/run-fail/mir_trans_calls_diverging.rs rename to src/test/run-fail/mir_codegen_calls_diverging.rs diff --git a/src/test/run-fail/mir_trans_calls_diverging_drops.rs b/src/test/run-fail/mir_codegen_calls_diverging_drops.rs similarity index 100% rename from src/test/run-fail/mir_trans_calls_diverging_drops.rs rename to src/test/run-fail/mir_codegen_calls_diverging_drops.rs diff --git a/src/test/run-fail/mir_trans_no_landing_pads.rs b/src/test/run-fail/mir_codegen_no_landing_pads.rs similarity index 100% rename from src/test/run-fail/mir_trans_no_landing_pads.rs rename to src/test/run-fail/mir_codegen_no_landing_pads.rs diff --git a/src/test/run-fail/mir_trans_no_landing_pads_diverging.rs b/src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs similarity index 100% rename from src/test/run-fail/mir_trans_no_landing_pads_diverging.rs rename to src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index e16ce9c8edb..572b56d02ae 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Tests that trans treats the rhs of pth's decl +// Tests that codegen treats the rhs of pth's decl // as a _|_-typed thing, not a str-typed thing // error-pattern:bye diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index e266b0f5e83..251fb78a985 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -12,7 +12,7 @@ extern crate syntax; extern crate rustc; -extern crate rustc_trans_utils; +extern crate rustc_codegen_utils; use std::any::Any; use std::sync::mpsc; @@ -23,11 +23,11 @@ use rustc::ty::TyCtxt; use rustc::ty::maps::Providers; use rustc::middle::cstore::MetadataLoader; use rustc::dep_graph::DepGraph; -use rustc_trans_utils::trans_crate::{TransCrate, MetadataOnlyTransCrate}; +use rustc_codegen_utils::codegen_backend::{CodegenBackend, MetadataOnlyCodegenBackend}; -struct TheBackend(Box); +struct TheBackend(Box); -impl TransCrate for TheBackend { +impl CodegenBackend for TheBackend { fn metadata_loader(&self) -> Box { self.0.metadata_loader() } @@ -40,7 +40,7 @@ impl TransCrate for TheBackend { self.0.provide_extern(providers); } - fn trans_crate<'a, 'tcx>( + fn codegen_crate<'a, 'tcx>( &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _rx: mpsc::Receiver> @@ -50,18 +50,18 @@ impl TransCrate for TheBackend { Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol) } - fn join_trans_and_link( + fn join_codegen_and_link( &self, - trans: Box, + ongoing_codegen: Box, sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, ) -> Result<(), CompileIncomplete> { use std::io::Write; use rustc::session::config::CrateType; - use rustc_trans_utils::link::out_filename; - let crate_name = trans.downcast::() - .expect("in join_trans_and_link: trans is not a Symbol"); + use rustc_codegen_utils::link::out_filename; + let crate_name = ongoing_codegen.downcast::() + .expect("in join_codegen_and_link: ongoing_codegen is not a Symbol"); for &crate_type in sess.opts.crate_types.iter() { if crate_type != CrateType::CrateTypeExecutable { sess.fatal(&format!("Crate type is {:?}", crate_type)); @@ -75,8 +75,8 @@ impl TransCrate for TheBackend { } } -/// This is the entrypoint for a hot plugged rustc_trans +/// This is the entrypoint for a hot plugged rustc_codegen_llvm #[no_mangle] -pub fn __rustc_codegen_backend() -> Box { - Box::new(TheBackend(MetadataOnlyTransCrate::new())) +pub fn __rustc_codegen_backend() -> Box { + Box::new(TheBackend(MetadataOnlyCodegenBackend::new())) } diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index e0db2627d85..403f4f79843 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/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_utils; +extern crate rustc_codegen_utils; extern crate syntax; use rustc::session::{build_session, Session}; @@ -25,7 +25,7 @@ use rustc_driver::driver::{compile_input, CompileController}; use rustc_metadata::cstore::CStore; use rustc_errors::registry::Registry; use syntax::codemap::FileName; -use rustc_trans_utils::trans_crate::TransCrate; +use rustc_codegen_utils::codegen_backend::CodegenBackend; use std::path::PathBuf; use std::rc::Rc; @@ -52,7 +52,7 @@ fn main() { compile(src.to_string(), tmpdir.join("out"), sysroot.clone()); } -fn basic_sess(sysroot: PathBuf) -> (Session, Rc, Box) { +fn basic_sess(sysroot: PathBuf) -> (Session, Rc, Box) { let mut opts = basic_options(); opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); opts.maybe_sysroot = Some(sysroot); @@ -62,19 +62,19 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc, Box) { let descriptions = Registry::new(&rustc::DIAGNOSTICS); let sess = build_session(opts, None, descriptions); - let trans = rustc_driver::get_trans(&sess); - let cstore = Rc::new(CStore::new(trans.metadata_loader())); + let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - (sess, cstore, trans) + (sess, cstore, codegen_backend) } fn compile(code: String, output: PathBuf, sysroot: PathBuf) { syntax::with_globals(|| { - let (sess, cstore, trans) = basic_sess(sysroot); + let (sess, cstore, codegen_backend) = basic_sess(sysroot); let control = CompileController::basic(); let input = Input::Str { name: FileName::Anon, input: code }; let _ = compile_input( - trans, + codegen_backend, &sess, &cstore, &None, diff --git a/src/test/run-make-fulldeps/issue-7349/Makefile b/src/test/run-make-fulldeps/issue-7349/Makefile index 50dc63b1deb..9658b99e3b0 100644 --- a/src/test/run-make-fulldeps/issue-7349/Makefile +++ b/src/test/run-make-fulldeps/issue-7349/Makefile @@ -1,7 +1,7 @@ -include ../tools.mk # Test to make sure that inner functions within a polymorphic outer function -# don't get re-translated when the outer function is monomorphized. The test +# don't get re-codegened when the outer function is monomorphized. The test # code monomorphizes the outer functions several times, but the magic constants # used in the inner functions should each appear only once in the generated IR. diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index 85aa92ce260..9aa4f42c8ac 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -18,7 +18,7 @@ extern crate getopts; extern crate rustc; extern crate rustc_driver; -extern crate rustc_trans_utils; +extern crate rustc_codegen_utils; extern crate syntax; extern crate rustc_errors as errors; @@ -26,7 +26,7 @@ use rustc::middle::cstore::CrateStore; use rustc::session::Session; use rustc::session::config::{self, Input}; use rustc_driver::{driver, CompilerCalls, Compilation}; -use rustc_trans_utils::trans_crate::TransCrate; +use rustc_codegen_utils::codegen_backend::CodegenBackend; use syntax::ast; use std::path::PathBuf; @@ -48,7 +48,7 @@ impl<'a> CompilerCalls<'a> for TestCalls { } fn late_callback(&mut self, - _: &TransCrate, + _: &CodegenBackend, _: &getopts::Matches, _: &Session, _: &CrateStore, diff --git a/src/test/run-pass/associated-types-region-erasure-issue-20582.rs b/src/test/run-pass/associated-types-region-erasure-issue-20582.rs index 16e49f146ab..40f352e2e1f 100644 --- a/src/test/run-pass/associated-types-region-erasure-issue-20582.rs +++ b/src/test/run-pass/associated-types-region-erasure-issue-20582.rs @@ -9,7 +9,7 @@ // except according to those terms. // Regression test for #20582. This test caused an ICE related to -// inconsistent region erasure in trans. +// inconsistent region erasure in codegen. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/atomic-compare_exchange.rs b/src/test/run-pass/atomic-compare_exchange.rs index 1d9fa248e3d..2f33eb9ca40 100644 --- a/src/test/run-pass/atomic-compare_exchange.rs +++ b/src/test/run-pass/atomic-compare_exchange.rs @@ -15,7 +15,7 @@ use std::sync::atomic::Ordering::*; static ATOMIC: AtomicIsize = ATOMIC_ISIZE_INIT; fn main() { - // Make sure trans can emit all the intrinsics correctly + // Make sure codegen can emit all the intrinsics correctly ATOMIC.compare_exchange(0, 1, Relaxed, Relaxed).ok(); ATOMIC.compare_exchange(0, 1, Acquire, Relaxed).ok(); ATOMIC.compare_exchange(0, 1, Release, Relaxed).ok(); diff --git a/src/test/run-pass/trans-object-shim.rs b/src/test/run-pass/codegen-object-shim.rs similarity index 100% rename from src/test/run-pass/trans-object-shim.rs rename to src/test/run-pass/codegen-object-shim.rs diff --git a/src/test/run-pass/trans-tag-static-padding.rs b/src/test/run-pass/codegen-tag-static-padding.rs similarity index 100% rename from src/test/run-pass/trans-tag-static-padding.rs rename to src/test/run-pass/codegen-tag-static-padding.rs diff --git a/src/test/run-pass/compiletest-skip-trans.rs b/src/test/run-pass/compiletest-skip-codegen.rs similarity index 85% rename from src/test/run-pass/compiletest-skip-trans.rs rename to src/test/run-pass/compiletest-skip-codegen.rs index d24a6506c2c..d318b8fa44b 100644 --- a/src/test/run-pass/compiletest-skip-trans.rs +++ b/src/test/run-pass/compiletest-skip-codegen.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that with the `skip-trans` option the test isn't executed. +// Test that with the `skip-codegen` option the test isn't executed. -// skip-trans +// skip-codegen fn main() { unreachable!(); diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index c8e9cbdae1e..01bdcfeaefb 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -22,7 +22,7 @@ mod rustrt { #[cfg(bogus)] extern { // This symbol doesn't exist and would be a link error if this - // module was translated + // module was codegened pub fn bogus(); } diff --git a/src/test/run-pass/issue-18425.rs b/src/test/run-pass/issue-18425.rs index eb7e504ae14..797b3197182 100644 --- a/src/test/run-pass/issue-18425.rs +++ b/src/test/run-pass/issue-18425.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Check that trans doesn't ICE when translating an array repeat +// Check that codegen doesn't ICE when codegenning an array repeat // expression with a count of 1 and a non-Copy element type. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issue-18514.rs b/src/test/run-pass/issue-18514.rs index 2a1e55d867f..f8bebb4a40b 100644 --- a/src/test/run-pass/issue-18514.rs +++ b/src/test/run-pass/issue-18514.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that we don't ICE when translating a generic impl method from +// Test that we don't ICE when codegenning a generic impl method from // an extern crate that contains a match expression on a local // variable place where one of the match case bodies contains an // expression that autoderefs through an overloaded generic deref diff --git a/src/test/run-pass/issue-18652.rs b/src/test/run-pass/issue-18652.rs index cea0beaf5f0..1eddc34f5b1 100644 --- a/src/test/run-pass/issue-18652.rs +++ b/src/test/run-pass/issue-18652.rs @@ -9,7 +9,7 @@ // except according to those terms. // Tests multiple free variables being passed by value into an unboxed -// once closure as an optimization by trans. This used to hit an +// once closure as an optimization by codegen. This used to hit an // incorrect assert. fn main() { diff --git a/src/test/run-pass/issue-18661.rs b/src/test/run-pass/issue-18661.rs index 48d29095ec6..4287f449c6f 100644 --- a/src/test/run-pass/issue-18661.rs +++ b/src/test/run-pass/issue-18661.rs @@ -9,7 +9,7 @@ // except according to those terms. // Test that param substitutions from the correct environment are -// used when translating unboxed closure calls. +// used when codegenning unboxed closure calls. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issue-20644.rs b/src/test/run-pass/issue-20644.rs index 7cacc2e1146..65a67d0b41a 100644 --- a/src/test/run-pass/issue-20644.rs +++ b/src/test/run-pass/issue-20644.rs @@ -9,7 +9,7 @@ // except according to those terms. // A reduced version of the rustbook ice. The problem this encountered -// had to do with trans ignoring binders. +// had to do with codegen ignoring binders. // pretty-expanded FIXME #23616 // ignore-cloudabi no std::fs diff --git a/src/test/run-pass/issue-24085.rs b/src/test/run-pass/issue-24085.rs index fde32cb9023..b15ec2986c2 100644 --- a/src/test/run-pass/issue-24085.rs +++ b/src/test/run-pass/issue-24085.rs @@ -10,7 +10,7 @@ // Regression test for #24085. Errors were occurring in region // inference due to the requirement that `'a:b'`, which was getting -// incorrectly translated in connection with the closure below. +// incorrectly codegened in connection with the closure below. #[derive(Copy,Clone)] struct Path<'a:'b, 'b> { diff --git a/src/test/run-pass/issue-34569.rs b/src/test/run-pass/issue-34569.rs index 41d02e96cc2..5c7c5a2b3b9 100644 --- a/src/test/run-pass/issue-34569.rs +++ b/src/test/run-pass/issue-34569.rs @@ -12,7 +12,7 @@ // In this test we just want to make sure that the code below does not lead to // a debuginfo verification assertion during compilation. This was caused by the -// closure in the guard being translated twice due to how match expressions are +// closure in the guard being codegened twice due to how match expressions are // handled. // // See https://github.com/rust-lang/rust/issues/34569 for details. diff --git a/src/test/run-pass/issue-36381.rs b/src/test/run-pass/issue-36381.rs index 6cd991bd942..2694c98dd91 100644 --- a/src/test/run-pass/issue-36381.rs +++ b/src/test/run-pass/issue-36381.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Regression test for #36381. The trans collector was asserting that +// Regression test for #36381. The monomorphization collector was asserting that // there are no projection types, but the `<&str as // StreamOnce>::Position` projection contained a late-bound region, // and we don't currently normalize in that case until the function is diff --git a/src/test/run-pass/issue-38002.rs b/src/test/run-pass/issue-38002.rs index dd6ccec973f..4eb381b9eac 100644 --- a/src/test/run-pass/issue-38002.rs +++ b/src/test/run-pass/issue-38002.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Check that constant ADTs are translated OK, part k of N. +// Check that constant ADTs are codegened OK, part k of N. enum Bar { C diff --git a/src/test/run-pass/issue-5243.rs b/src/test/run-pass/issue-5243.rs index eda0eea7071..9bd13c4d3a0 100644 --- a/src/test/run-pass/issue-5243.rs +++ b/src/test/run-pass/issue-5243.rs @@ -9,7 +9,7 @@ // except according to those terms. // Check that merely having lifetime parameters is not -// enough for trans to consider this as non-monomorphic, +// enough for codegen to consider this as non-monomorphic, // which led to various assertions and failures in turn. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issue24687-embed-debuginfo/main.rs b/src/test/run-pass/issue24687-embed-debuginfo/main.rs index 7754e9c3ad7..abec252c74e 100644 --- a/src/test/run-pass/issue24687-embed-debuginfo/main.rs +++ b/src/test/run-pass/issue24687-embed-debuginfo/main.rs @@ -14,7 +14,7 @@ extern crate issue24687_lib as d; fn main() { - // Create a d, which has a destructor whose body will be trans'ed + // Create a d, which has a destructor whose body will be codegen'ed // into the generated code here, and thus the local debuginfo will // need references into the original source locations from // `importer` above. diff --git a/src/test/run-pass/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/method-two-trait-defer-resolution-2.rs index cf9bc9bb56a..82d747b6c27 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-2.rs @@ -16,7 +16,7 @@ // whether `_1: MyCopy` or `_1 == Box`. However (and this is the // point of the test), we don't have to pick between the two impls -- // it is enough to know that `foo` comes from the `Foo` trait. We can -// translate the call as `Foo::foo(&x)` and let the specific impl get +// codegen the call as `Foo::foo(&x)` and let the specific impl get // chosen later. diff --git a/src/test/run-pass/mir_trans_array.rs b/src/test/run-pass/mir_codegen_array.rs similarity index 100% rename from src/test/run-pass/mir_trans_array.rs rename to src/test/run-pass/mir_codegen_array.rs diff --git a/src/test/run-pass/mir_trans_array_2.rs b/src/test/run-pass/mir_codegen_array_2.rs similarity index 100% rename from src/test/run-pass/mir_trans_array_2.rs rename to src/test/run-pass/mir_codegen_array_2.rs diff --git a/src/test/run-pass/mir_trans_call_converging.rs b/src/test/run-pass/mir_codegen_call_converging.rs similarity index 100% rename from src/test/run-pass/mir_trans_call_converging.rs rename to src/test/run-pass/mir_codegen_call_converging.rs diff --git a/src/test/run-pass/mir_trans_calls.rs b/src/test/run-pass/mir_codegen_calls.rs similarity index 100% rename from src/test/run-pass/mir_trans_calls.rs rename to src/test/run-pass/mir_codegen_calls.rs diff --git a/src/test/run-pass/mir_trans_calls_variadic.rs b/src/test/run-pass/mir_codegen_calls_variadic.rs similarity index 100% rename from src/test/run-pass/mir_trans_calls_variadic.rs rename to src/test/run-pass/mir_codegen_calls_variadic.rs diff --git a/src/test/run-pass/mir_trans_critical_edge.rs b/src/test/run-pass/mir_codegen_critical_edge.rs similarity index 95% rename from src/test/run-pass/mir_trans_critical_edge.rs rename to src/test/run-pass/mir_codegen_critical_edge.rs index f6fe19c4309..c742e71633f 100644 --- a/src/test/run-pass/mir_trans_critical_edge.rs +++ b/src/test/run-pass/mir_codegen_critical_edge.rs @@ -44,7 +44,7 @@ where A: Iterator, B: Iterator } } -// Make sure we actually translate a version of the function +// Make sure we actually codegen a version of the function pub fn do_stuff(mut f: Foo>, Box>>) { let _x = f.next(); } diff --git a/src/test/run-pass/mir_trans_spike1.rs b/src/test/run-pass/mir_codegen_spike1.rs similarity index 92% rename from src/test/run-pass/mir_trans_spike1.rs rename to src/test/run-pass/mir_codegen_spike1.rs index 8474e841e01..27e1583af34 100644 --- a/src/test/run-pass/mir_trans_spike1.rs +++ b/src/test/run-pass/mir_codegen_spike1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// A simple spike test for MIR version of trans. +// A simple spike test for MIR version of codegen. fn sum(x: i32, y: i32) -> i32 { x + y diff --git a/src/test/run-pass/mir_trans_switch.rs b/src/test/run-pass/mir_codegen_switch.rs similarity index 100% rename from src/test/run-pass/mir_trans_switch.rs rename to src/test/run-pass/mir_codegen_switch.rs diff --git a/src/test/run-pass/mir_trans_switchint.rs b/src/test/run-pass/mir_codegen_switchint.rs similarity index 100% rename from src/test/run-pass/mir_trans_switchint.rs rename to src/test/run-pass/mir_codegen_switchint.rs diff --git a/src/test/run-pass/mir_overflow_off.rs b/src/test/run-pass/mir_overflow_off.rs index 0db1e7b4563..a2cfca01dac 100644 --- a/src/test/run-pass/mir_overflow_off.rs +++ b/src/test/run-pass/mir_overflow_off.rs @@ -10,7 +10,7 @@ // compile-flags: -Z force-overflow-checks=off -// Test that with MIR trans, overflow checks can be +// Test that with MIR codegen, overflow checks can be // turned off, even when they're from core::ops::*. use std::ops::*; diff --git a/src/test/run-pass/pattern-bound-var-in-for-each.rs b/src/test/run-pass/pattern-bound-var-in-for-each.rs index 59ead3e3e98..778f355b24b 100644 --- a/src/test/run-pass/pattern-bound-var-in-for-each.rs +++ b/src/test/run-pass/pattern-bound-var-in-for-each.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Tests that trans_path checks whether a -// pattern-bound var is an upvar (when translating +// Tests that codegen_path checks whether a +// pattern-bound var is an upvar (when codegenning // the for-each body) diff --git a/src/test/run-pass/regions-mock-trans.rs b/src/test/run-pass/regions-mock-codegen.rs similarity index 100% rename from src/test/run-pass/regions-mock-trans.rs rename to src/test/run-pass/regions-mock-codegen.rs diff --git a/src/test/run-pass/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp-fns-backwards.rs index 1ab8bc7f88c..4fea07028b6 100644 --- a/src/test/run-pass/sepcomp-fns-backwards.rs +++ b/src/test/run-pass/sepcomp-fns-backwards.rs @@ -11,7 +11,7 @@ // ignore-bitrig // compile-flags: -C codegen-units=3 -// Test references to items that haven't been translated yet. +// Test references to items that haven't been codegened yet. // Generate some code in the first compilation unit before declaring any // modules. This ensures that the first module doesn't go into the same diff --git a/src/test/run-pass/small-enum-range-edge.rs b/src/test/run-pass/small-enum-range-edge.rs index 56abdf6e20a..d2283da8bdd 100644 --- a/src/test/run-pass/small-enum-range-edge.rs +++ b/src/test/run-pass/small-enum-range-edge.rs @@ -13,7 +13,7 @@ #![feature(core)] /*! - * Tests the range assertion wraparound case in trans::middle::adt::load_discr. + * Tests the range assertion wraparound case when reading discriminants. */ #[repr(u8)] diff --git a/src/test/run-pass/union/union-const-trans.rs b/src/test/run-pass/union/union-const-codegen.rs similarity index 100% rename from src/test/run-pass/union/union-const-trans.rs rename to src/test/run-pass/union/union-const-codegen.rs diff --git a/src/test/run-pass/zero-sized-tuple-struct.rs b/src/test/run-pass/zero-sized-tuple-struct.rs index aaffdc4ec7c..9625d6a88ac 100644 --- a/src/test/run-pass/zero-sized-tuple-struct.rs +++ b/src/test/run-pass/zero-sized-tuple-struct.rs @@ -10,7 +10,7 @@ #![allow(unused_assignments)] -// Make sure that the constructor args are translated for zero-sized tuple structs +// Make sure that the constructor args are codegened for zero-sized tuple structs struct Foo(()); diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 06ec9e893f0..f66f5c5b70e 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -224,7 +224,7 @@ pub struct TestProps { // The test must be compiled and run successfully. Only used in UI tests for now. pub run_pass: bool, // Skip any codegen step and running the executable. Only for run-pass. - pub skip_trans: bool, + pub skip_codegen: bool, // Do not pass `-Z ui-testing` to UI tests pub disable_ui_testing_normalization: bool, // customized normalization rules @@ -258,7 +258,7 @@ impl TestProps { compile_pass: false, check_test_line_numbers_match: false, run_pass: false, - skip_trans: false, + skip_codegen: false, disable_ui_testing_normalization: false, normalize_stdout: vec![], normalize_stderr: vec![], @@ -371,8 +371,8 @@ impl TestProps { self.compile_pass = config.parse_compile_pass(ln) || self.run_pass; } - if !self.skip_trans { - self.skip_trans = config.parse_skip_trans(ln); + if !self.skip_codegen { + self.skip_codegen = config.parse_skip_codegen(ln); } if !self.disable_ui_testing_normalization { @@ -532,8 +532,8 @@ impl Config { self.parse_name_directive(line, "run-pass") } - fn parse_skip_trans(&self, line: &str) -> bool { - self.parse_name_directive(line, "skip-trans") + fn parse_skip_codegen(&self, line: &str) -> bool { + self.parse_name_directive(line, "skip-codegen") } fn parse_env(&self, line: &str, name: &str) -> Option<(String, String)> { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 59d94e1fa51..780c8122734 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -357,7 +357,7 @@ impl<'test> TestCx<'test> { "run-pass tests with expected warnings should be moved to ui/" ); - if !self.props.skip_trans { + if !self.props.skip_codegen { let proc_res = self.exec_compiled_test(); if !proc_res.status.success() { self.fatal_proc_rec("test run failed!", &proc_res); @@ -555,7 +555,7 @@ impl<'test> TestCx<'test> { rustc .arg("-") - .arg("-Zno-trans") + .arg("-Zno-codegen") .arg("--out-dir") .arg(&out_dir) .arg(&format!("--target={}", target)) @@ -1703,7 +1703,7 @@ impl<'test> TestCx<'test> { } } - if self.props.skip_trans { + if self.props.skip_codegen { assert!(!self.props.compile_flags.iter().any(|s| s.starts_with("--emit"))); rustc.args(&["--emit", "metadata"]); } @@ -2181,19 +2181,19 @@ impl<'test> TestCx<'test> { self.check_no_compiler_crash(&proc_res); - const PREFIX: &'static str = "TRANS_ITEM "; + const PREFIX: &'static str = "MONO_ITEM "; const CGU_MARKER: &'static str = "@@"; - let actual: Vec = proc_res + let actual: Vec = proc_res .stdout .lines() .filter(|line| line.starts_with(PREFIX)) - .map(str_to_trans_item) + .map(str_to_mono_item) .collect(); - let expected: Vec = errors::load_errors(&self.testpaths.file, None) + let expected: Vec = errors::load_errors(&self.testpaths.file, None) .iter() - .map(|e| str_to_trans_item(&e.msg[..])) + .map(|e| str_to_mono_item(&e.msg[..])) .collect(); let mut missing = Vec::new(); @@ -2271,14 +2271,14 @@ impl<'test> TestCx<'test> { } #[derive(Clone, Eq, PartialEq)] - struct TransItem { + struct MonoItem { name: String, codegen_units: HashSet, string: String, } - // [TRANS_ITEM] name [@@ (cgu)+] - fn str_to_trans_item(s: &str) -> TransItem { + // [MONO_ITEM] name [@@ (cgu)+] + fn str_to_mono_item(s: &str) -> MonoItem { let s = if s.starts_with(PREFIX) { (&s[PREFIX.len()..]).trim() } else { @@ -2307,7 +2307,7 @@ impl<'test> TestCx<'test> { HashSet::new() }; - TransItem { + MonoItem { name: name.to_owned(), codegen_units: cgus, string: full_string, diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index c34cf1bd5ec..5739ec5f325 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -52,7 +52,7 @@ static EXCEPTIONS: &'static [&'static str] = &[ /// Which crates to check against the whitelist? static WHITELIST_CRATES: &'static [CrateVersion] = &[ CrateVersion("rustc", "0.0.0"), - CrateVersion("rustc_trans", "0.0.0"), + CrateVersion("rustc_codegen_llvm", "0.0.0"), ]; /// Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible.