Skip to content

Commit dbd10f8

Browse files
committed
Auto merge of #50615 - irinagpopa:rename-trans, r=nikomatsakis
Rename trans to codegen everywhere. Part of #45274.
2 parents e315056 + b63d7e2 commit dbd10f8

File tree

264 files changed

+1547
-1548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+1547
-1548
lines changed

src/Cargo.lock

+47-47
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,52 @@ dependencies = [
18961896
"syntax_pos 0.0.0",
18971897
]
18981898

1899+
[[package]]
1900+
name = "rustc_codegen_llvm"
1901+
version = "0.0.0"
1902+
dependencies = [
1903+
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1904+
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
1905+
"env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
1906+
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1907+
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
1908+
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
1909+
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1910+
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1911+
"rustc 0.0.0",
1912+
"rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
1913+
"rustc_allocator 0.0.0",
1914+
"rustc_apfloat 0.0.0",
1915+
"rustc_codegen_utils 0.0.0",
1916+
"rustc_data_structures 0.0.0",
1917+
"rustc_errors 0.0.0",
1918+
"rustc_incremental 0.0.0",
1919+
"rustc_llvm 0.0.0",
1920+
"rustc_mir 0.0.0",
1921+
"rustc_platform_intrinsics 0.0.0",
1922+
"rustc_target 0.0.0",
1923+
"serialize 0.0.0",
1924+
"syntax 0.0.0",
1925+
"syntax_pos 0.0.0",
1926+
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
1927+
]
1928+
1929+
[[package]]
1930+
name = "rustc_codegen_utils"
1931+
version = "0.0.0"
1932+
dependencies = [
1933+
"ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1934+
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1935+
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1936+
"rustc 0.0.0",
1937+
"rustc_data_structures 0.0.0",
1938+
"rustc_incremental 0.0.0",
1939+
"rustc_mir 0.0.0",
1940+
"rustc_target 0.0.0",
1941+
"syntax 0.0.0",
1942+
"syntax_pos 0.0.0",
1943+
]
1944+
18991945
[[package]]
19001946
name = "rustc_cratesio_shim"
19011947
version = "0.0.0"
@@ -1932,6 +1978,7 @@ dependencies = [
19321978
"rustc-rayon 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
19331979
"rustc_allocator 0.0.0",
19341980
"rustc_borrowck 0.0.0",
1981+
"rustc_codegen_utils 0.0.0",
19351982
"rustc_data_structures 0.0.0",
19361983
"rustc_errors 0.0.0",
19371984
"rustc_incremental 0.0.0",
@@ -1945,7 +1992,6 @@ dependencies = [
19451992
"rustc_save_analysis 0.0.0",
19461993
"rustc_target 0.0.0",
19471994
"rustc_traits 0.0.0",
1948-
"rustc_trans_utils 0.0.0",
19491995
"rustc_typeck 0.0.0",
19501996
"scoped-tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
19511997
"serialize 0.0.0",
@@ -2155,52 +2201,6 @@ dependencies = [
21552201
"syntax_pos 0.0.0",
21562202
]
21572203

2158-
[[package]]
2159-
name = "rustc_trans"
2160-
version = "0.0.0"
2161-
dependencies = [
2162-
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2163-
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
2164-
"env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
2165-
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2166-
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
2167-
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
2168-
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
2169-
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2170-
"rustc 0.0.0",
2171-
"rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
2172-
"rustc_allocator 0.0.0",
2173-
"rustc_apfloat 0.0.0",
2174-
"rustc_data_structures 0.0.0",
2175-
"rustc_errors 0.0.0",
2176-
"rustc_incremental 0.0.0",
2177-
"rustc_llvm 0.0.0",
2178-
"rustc_mir 0.0.0",
2179-
"rustc_platform_intrinsics 0.0.0",
2180-
"rustc_target 0.0.0",
2181-
"rustc_trans_utils 0.0.0",
2182-
"serialize 0.0.0",
2183-
"syntax 0.0.0",
2184-
"syntax_pos 0.0.0",
2185-
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
2186-
]
2187-
2188-
[[package]]
2189-
name = "rustc_trans_utils"
2190-
version = "0.0.0"
2191-
dependencies = [
2192-
"ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
2193-
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2194-
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
2195-
"rustc 0.0.0",
2196-
"rustc_data_structures 0.0.0",
2197-
"rustc_incremental 0.0.0",
2198-
"rustc_mir 0.0.0",
2199-
"rustc_target 0.0.0",
2200-
"syntax 0.0.0",
2201-
"syntax_pos 0.0.0",
2202-
]
2203-
22042204
[[package]]
22052205
name = "rustc_tsan"
22062206
version = "0.0.0"

src/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = [
44
"rustc",
55
"libstd",
66
"libtest",
7-
"librustc_trans",
7+
"librustc_codegen_llvm",
88
"tools/cargotest",
99
"tools/clippy",
1010
"tools/compiletest",

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ impl<'a> Builder<'a> {
844844
// default via `-ldylib=winapi_foo`. That is, they're linked with the
845845
// `dylib` type with a `winapi_` prefix (so the winapi ones don't
846846
// conflict with the system MinGW ones). This consequently means that
847-
// the binaries we ship of things like rustc_trans (aka the rustc_trans
847+
// the binaries we ship of things like rustc_codegen_llvm (aka the rustc_codegen_llvm
848848
// DLL) when linked against *again*, for example with procedural macros
849849
// or plugins, will trigger the propagation logic of `-ldylib`, passing
850850
// `-lwinapi_foo` to the linker again. This isn't actually available in

src/bootstrap/check.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Step for CodegenBackend {
118118
const DEFAULT: bool = true;
119119

120120
fn should_run(run: ShouldRun) -> ShouldRun {
121-
run.all_krates("rustc_trans")
121+
run.all_krates("rustc_codegen_llvm")
122122
}
123123

124124
fn make_run(run: RunConfig) {
@@ -139,12 +139,12 @@ impl Step for CodegenBackend {
139139

140140
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check");
141141
let features = builder.rustc_features().to_string();
142-
cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_trans/Cargo.toml"));
142+
cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
143143
rustc_cargo_env(builder, &mut cargo);
144144

145145
// We won't build LLVM if it's not available, as it shouldn't affect `check`.
146146

147-
let _folder = builder.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
147+
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
148148
run_cargo(builder,
149149
cargo.arg("--features").arg(features),
150150
&codegen_backend_stamp(builder, compiler, target, backend),
@@ -259,14 +259,14 @@ pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned<St
259259
builder.cargo_out(compiler, Mode::Librustc, target).join(".librustc-check.stamp")
260260
}
261261

262-
/// Cargo's output path for librustc_trans in a given stage, compiled by a particular
262+
/// Cargo's output path for librustc_codegen_llvm in a given stage, compiled by a particular
263263
/// compiler for the specified target and backend.
264264
fn codegen_backend_stamp(builder: &Builder,
265265
compiler: Compiler,
266266
target: Interned<String>,
267267
backend: Interned<String>) -> PathBuf {
268268
builder.cargo_out(compiler, Mode::Librustc, target)
269-
.join(format!(".librustc_trans-{}-check.stamp", backend))
269+
.join(format!(".librustc_codegen_llvm-{}-check.stamp", backend))
270270
}
271271

272272
/// Cargo's output path for rustdoc in a given stage, compiled by a particular

src/bootstrap/compile.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl Step for CodegenBackend {
603603
const DEFAULT: bool = true;
604604

605605
fn should_run(run: ShouldRun) -> ShouldRun {
606-
run.all_krates("rustc_trans")
606+
run.all_krates("rustc_codegen_llvm")
607607
}
608608

609609
fn make_run(run: RunConfig) {
@@ -637,15 +637,15 @@ impl Step for CodegenBackend {
637637
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
638638
let mut features = builder.rustc_features().to_string();
639639
cargo.arg("--manifest-path")
640-
.arg(builder.src.join("src/librustc_trans/Cargo.toml"));
640+
.arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
641641
rustc_cargo_env(builder, &mut cargo);
642642

643643
features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
644644

645645
let tmp_stamp = builder.cargo_out(compiler, Mode::Librustc, target)
646646
.join(".tmp.stamp");
647647

648-
let _folder = builder.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
648+
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
649649
let files = run_cargo(builder,
650650
cargo.arg("--features").arg(features),
651651
&tmp_stamp,
@@ -656,7 +656,7 @@ impl Step for CodegenBackend {
656656
let mut files = files.into_iter()
657657
.filter(|f| {
658658
let filename = f.file_name().unwrap().to_str().unwrap();
659-
is_dylib(filename) && filename.contains("rustc_trans-")
659+
is_dylib(filename) && filename.contains("rustc_codegen_llvm-")
660660
});
661661
let codegen_backend = match files.next() {
662662
Some(f) => f,
@@ -697,7 +697,7 @@ pub fn build_codegen_backend(builder: &Builder,
697697
compiler.stage, &compiler.host, target, backend));
698698

699699
// Pass down configuration from the LLVM build into the build of
700-
// librustc_llvm and librustc_trans.
700+
// librustc_llvm and librustc_codegen_llvm.
701701
if builder.is_rust_llvm(target) {
702702
cargo.env("LLVM_RUSTLLVM", "1");
703703
}
@@ -762,7 +762,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
762762
t!(t!(File::open(&stamp)).read_to_string(&mut dylib));
763763
let file = Path::new(&dylib);
764764
let filename = file.file_name().unwrap().to_str().unwrap();
765-
// change `librustc_trans-xxxxxx.so` to `librustc_trans-llvm.so`
765+
// change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so`
766766
let target_filename = {
767767
let dash = filename.find("-").unwrap();
768768
let dot = filename.find(".").unwrap();
@@ -808,14 +808,14 @@ pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned<St
808808
builder.cargo_out(compiler, Mode::Librustc, target).join(".librustc.stamp")
809809
}
810810

811-
/// Cargo's output path for librustc_trans in a given stage, compiled by a particular
811+
/// Cargo's output path for librustc_codegen_llvm in a given stage, compiled by a particular
812812
/// compiler for the specified target and backend.
813813
fn codegen_backend_stamp(builder: &Builder,
814814
compiler: Compiler,
815815
target: Interned<String>,
816816
backend: Interned<String>) -> PathBuf {
817817
builder.cargo_out(compiler, Mode::Librustc, target)
818-
.join(format!(".librustc_trans-{}.stamp", backend))
818+
.join(format!(".librustc_codegen_llvm-{}.stamp", backend))
819819
}
820820

821821
pub fn compiler_file(builder: &Builder,

src/doc/rustc-ux-guidelines.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ for details on how to format and write long error codes.
6969
[librustc_passes](https://github.com/rust-lang/rust/blob/master/src/librustc_passes/diagnostics.rs),
7070
[librustc_privacy](https://github.com/rust-lang/rust/blob/master/src/librustc_privacy/diagnostics.rs),
7171
[librustc_resolve](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/diagnostics.rs),
72-
[librustc_trans](https://github.com/rust-lang/rust/blob/master/src/librustc_trans/diagnostics.rs),
72+
[librustc_codegen_llvm](https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/diagnostics.rs),
7373
[librustc_plugin](https://github.com/rust-lang/rust/blob/master/src/librustc_plugin/diagnostics.rs),
7474
[librustc_typeck](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/diagnostics.rs).
7575
* Explanations have full markdown support. Use it, especially to highlight

src/liballoc/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ unsafe impl Alloc for Global {
134134
}
135135

136136
/// The allocator for unique pointers.
137-
// This function must not unwind. If it does, MIR trans will fail.
137+
// This function must not unwind. If it does, MIR codegen will fail.
138138
#[cfg(not(test))]
139139
#[lang = "exchange_malloc"]
140140
#[inline]

src/libcore/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! rustc compiler intrinsics.
1212
//!
13-
//! The corresponding definitions are in librustc_trans/intrinsic.rs.
13+
//! The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs.
1414
//!
1515
//! # Volatiles
1616
//!

src/librustc/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ byteorder = { version = "1.1", features = ["i128"]}
3535
# rlib/dylib pair but all crates.io crates tend to just be rlibs. This means
3636
# we've got a problem for dependency graphs that look like:
3737
#
38-
# foo - rustc_trans
38+
# foo - rustc_codegen_llvm
3939
# / \
4040
# rustc ---- rustc_driver
4141
# \ /
4242
# foo - rustc_metadata
4343
#
44-
# Here the crate `foo` is linked into the `rustc_trans` and the
44+
# Here the crate `foo` is linked into the `rustc_codegen_llvm` and the
4545
# `rustc_metadata` dylibs, meaning we've got duplicate copies! When we then
4646
# go to link `rustc_driver` the compiler notices this and gives us a compiler
4747
# error.
4848
#
4949
# To work around this problem we just add these crates.io dependencies to the
5050
# `rustc` crate which is a shared dependency above. That way the crate `foo`
5151
# shows up in the dylib for the `rustc` crate, deduplicating it and allowing
52-
# crates like `rustc_trans` to use `foo` *through* the `rustc` crate.
52+
# crates like `rustc_codegen_llvm` to use `foo` *through* the `rustc` crate.
5353
#
5454
# tl;dr; this is not needed to get `rustc` to compile, but if you remove it then
5555
# later crate stop compiling. If you can remove this and everything

src/librustc/cfg/construct.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,13 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
452452
// The CFG for match expression is quite complex, so no ASCII
453453
// art for it (yet).
454454
//
455-
// The CFG generated below matches roughly what trans puts
456-
// out. Each pattern and guard is visited in parallel, with
455+
// The CFG generated below matches roughly what MIR contains.
456+
// Each pattern and guard is visited in parallel, with
457457
// arms containing multiple patterns generating multiple nodes
458458
// for the same guard expression. The guard expressions chain
459459
// into each other from top to bottom, with a specific
460460
// exception to allow some additional valid programs
461-
// (explained below). Trans differs slightly in that the
461+
// (explained below). MIR differs slightly in that the
462462
// pattern matching may continue after a guard but the visible
463463
// behaviour should be the same.
464464
//

src/librustc/dep_graph/dep_node.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ define_dep_nodes!( <'tcx>
565565
[] IsUnreachableLocalDefinition(DefId),
566566
[] IsMirAvailable(DefId),
567567
[] ItemAttrs(DefId),
568-
[] TransFnAttrs(DefId),
568+
[] CodegenFnAttrs(DefId),
569569
[] FnArgNames(DefId),
570570
[] RenderedConst(DefId),
571571
[] DylibDepFormats(CrateNum),
@@ -637,8 +637,8 @@ define_dep_nodes!( <'tcx>
637637
[eval_always] AllTraits,
638638
[input] AllCrateNums,
639639
[] ExportedSymbols(CrateNum),
640-
[eval_always] CollectAndPartitionTranslationItems,
641-
[] IsTranslatedItem(DefId),
640+
[eval_always] CollectAndPartitionMonoItems,
641+
[] IsCodegenedItem(DefId),
642642
[] CodegenUnit(InternedString),
643643
[] CompileCodegenUnit(InternedString),
644644
[input] OutputFilenames,

src/librustc/dep_graph/graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,10 @@ impl DepGraph {
856856
/// each partition. In the first run, we create partitions based on
857857
/// the symbols that need to be compiled. For each partition P, we
858858
/// hash the symbols in P and create a `WorkProduct` record associated
859-
/// with `DepNode::TransPartition(P)`; the hash is the set of symbols
859+
/// with `DepNode::CodegenUnit(P)`; the hash is the set of symbols
860860
/// in P.
861861
///
862-
/// The next time we compile, if the `DepNode::TransPartition(P)` is
862+
/// The next time we compile, if the `DepNode::CodegenUnit(P)` is
863863
/// judged to be clean (which means none of the things we read to
864864
/// generate the partition were found to be dirty), it will be loaded
865865
/// into previous work products. We will then regenerate the set of

src/librustc/hir/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
5858
/// Check any attribute.
5959
fn check_attributes(&self, item: &hir::Item, target: Target) {
6060
if target == Target::Fn {
61-
self.tcx.trans_fn_attrs(self.tcx.hir.local_def_id(item.id));
61+
self.tcx.codegen_fn_attrs(self.tcx.hir.local_def_id(item.id));
6262
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) {
6363
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
6464
.span_label(item.span, "not a function")

0 commit comments

Comments
 (0)