Skip to content

Commit 1b96458

Browse files
committed
Remove --debug argument of y.sh
I rarely need a debug build of cg_clif, and even if I actually need one, using package overrides in Cargo.toml to only do a debug build for the rustc_codegen_cranelift crate works much better.
1 parent bb6571f commit 1b96458

File tree

6 files changed

+15
-47
lines changed

6 files changed

+15
-47
lines changed

build_system/abi_cafe.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ static ABI_CAFE_REPO: GitRepo = GitRepo::github(
1414
static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
1515

1616
pub(crate) fn run(
17-
channel: &str,
1817
sysroot_kind: SysrootKind,
1918
dirs: &Dirs,
2019
cg_clif_dylib: &CodegenBackend,
@@ -28,7 +27,6 @@ pub(crate) fn run(
2827
eprintln!("Building sysroot for abi-cafe");
2928
build_sysroot::build_sysroot(
3029
dirs,
31-
channel,
3230
sysroot_kind,
3331
cg_clif_dylib,
3432
bootstrap_host_compiler,

build_system/build_backend.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "c
1010

1111
pub(crate) fn build_backend(
1212
dirs: &Dirs,
13-
channel: &str,
1413
bootstrap_host_compiler: &Compiler,
1514
use_unstable_features: bool,
1615
) -> PathBuf {
@@ -32,13 +31,7 @@ pub(crate) fn build_backend(
3231
cmd.arg("--features").arg("unstable-features");
3332
}
3433

35-
match channel {
36-
"debug" => {}
37-
"release" => {
38-
cmd.arg("--release");
39-
}
40-
_ => unreachable!(),
41-
}
34+
cmd.arg("--release");
4235

4336
rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags);
4437

@@ -48,6 +41,6 @@ pub(crate) fn build_backend(
4841
CG_CLIF
4942
.target_dir(dirs)
5043
.join(&bootstrap_host_compiler.triple)
51-
.join(channel)
44+
.join("release")
5245
.join(get_file_name(&bootstrap_host_compiler.rustc, "rustc_codegen_cranelift", "dylib"))
5346
}

build_system/build_sysroot.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ static LIB_DIR: RelPath = RelPath::DIST.join("lib");
1515

1616
pub(crate) fn build_sysroot(
1717
dirs: &Dirs,
18-
channel: &str,
1918
sysroot_kind: SysrootKind,
2019
cg_clif_dylib_src: &CodegenBackend,
2120
bootstrap_host_compiler: &Compiler,
@@ -84,7 +83,6 @@ pub(crate) fn build_sysroot(
8483

8584
let host = build_sysroot_for_triple(
8685
dirs,
87-
channel,
8886
bootstrap_host_compiler.clone(),
8987
&cg_clif_dylib_path,
9088
sysroot_kind,
@@ -94,7 +92,6 @@ pub(crate) fn build_sysroot(
9492
if !is_native {
9593
build_sysroot_for_triple(
9694
dirs,
97-
channel,
9895
{
9996
let mut bootstrap_target_compiler = bootstrap_host_compiler.clone();
10097
bootstrap_target_compiler.triple = target_triple.clone();
@@ -167,7 +164,6 @@ pub(crate) static RTSTARTUP_SYSROOT: RelPath = RelPath::BUILD.join("rtstartup");
167164
#[must_use]
168165
fn build_sysroot_for_triple(
169166
dirs: &Dirs,
170-
channel: &str,
171167
compiler: Compiler,
172168
cg_clif_dylib_path: &CodegenBackend,
173169
sysroot_kind: SysrootKind,
@@ -176,9 +172,7 @@ fn build_sysroot_for_triple(
176172
SysrootKind::None => build_rtstartup(dirs, &compiler)
177173
.unwrap_or(SysrootTarget { triple: compiler.triple, libs: vec![] }),
178174
SysrootKind::Llvm => build_llvm_sysroot_for_triple(compiler),
179-
SysrootKind::Clif => {
180-
build_clif_sysroot_for_triple(dirs, channel, compiler, cg_clif_dylib_path)
181-
}
175+
SysrootKind::Clif => build_clif_sysroot_for_triple(dirs, compiler, cg_clif_dylib_path),
182176
}
183177
}
184178

@@ -219,7 +213,6 @@ fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget {
219213
#[must_use]
220214
fn build_clif_sysroot_for_triple(
221215
dirs: &Dirs,
222-
channel: &str,
223216
mut compiler: Compiler,
224217
cg_clif_dylib_path: &CodegenBackend,
225218
) -> SysrootTarget {
@@ -231,7 +224,7 @@ fn build_clif_sysroot_for_triple(
231224
target_libs.libs.extend(rtstartup_target_libs.libs);
232225
}
233226

234-
let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(&compiler.triple).join(channel);
227+
let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(&compiler.triple).join("release");
235228

236229
if !config::get_bool("keep_sysroot") {
237230
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
@@ -252,12 +245,12 @@ fn build_clif_sysroot_for_triple(
252245
// Necessary for MinGW to find rsbegin.o and rsend.o
253246
rustflags.push("--sysroot".to_owned());
254247
rustflags.push(RTSTARTUP_SYSROOT.to_path(dirs).to_str().unwrap().to_owned());
255-
if channel == "release" {
256-
// Incremental compilation by default disables mir inlining. This leads to both a decent
257-
// compile perf and a significant runtime perf regression. As such forcefully enable mir
258-
// inlining.
259-
rustflags.push("-Zinline-mir".to_owned());
260-
}
248+
249+
// Incremental compilation by default disables mir inlining. This leads to both a decent
250+
// compile perf and a significant runtime perf regression. As such forcefully enable mir
251+
// inlining.
252+
rustflags.push("-Zinline-mir".to_owned());
253+
261254
if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
262255
rustflags.push("--remap-path-prefix".to_owned());
263256
rustflags.push(format!(
@@ -268,9 +261,7 @@ fn build_clif_sysroot_for_triple(
268261
}
269262
compiler.rustflags.extend(rustflags);
270263
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
271-
if channel == "release" {
272-
build_cmd.arg("--release");
273-
}
264+
build_cmd.arg("--release");
274265
build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128");
275266
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
276267
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");

build_system/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ fn main() {
8181

8282
let mut out_dir = PathBuf::from(".");
8383
let mut download_dir = None;
84-
let mut channel = "release";
8584
let mut sysroot_kind = SysrootKind::Clif;
8685
let mut use_unstable_features = true;
8786
let mut frozen = false;
@@ -99,7 +98,6 @@ fn main() {
9998
arg_error!("--download-dir requires argument");
10099
})));
101100
}
102-
"--debug" => channel = "debug",
103101
"--sysroot" => {
104102
sysroot_kind = match args.next().as_deref() {
105103
Some("none") => SysrootKind::None,
@@ -206,7 +204,6 @@ fn main() {
206204
} else {
207205
CodegenBackend::Local(build_backend::build_backend(
208206
&dirs,
209-
channel,
210207
&bootstrap_host_compiler,
211208
use_unstable_features,
212209
))
@@ -218,7 +215,6 @@ fn main() {
218215
Command::Test => {
219216
tests::run_tests(
220217
&dirs,
221-
channel,
222218
sysroot_kind,
223219
use_unstable_features,
224220
&skip_tests.iter().map(|test| &**test).collect::<Vec<_>>(),
@@ -234,7 +230,6 @@ fn main() {
234230
process::exit(1);
235231
}
236232
abi_cafe::run(
237-
channel,
238233
sysroot_kind,
239234
&dirs,
240235
&cg_clif_dylib,
@@ -245,7 +240,6 @@ fn main() {
245240
Command::Build => {
246241
build_sysroot::build_sysroot(
247242
&dirs,
248-
channel,
249243
sysroot_kind,
250244
&cg_clif_dylib,
251245
&bootstrap_host_compiler,
@@ -256,7 +250,6 @@ fn main() {
256250
Command::Bench => {
257251
build_sysroot::build_sysroot(
258252
&dirs,
259-
channel,
260253
sysroot_kind,
261254
&cg_clif_dylib,
262255
&bootstrap_host_compiler,

build_system/tests.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
244244

245245
pub(crate) fn run_tests(
246246
dirs: &Dirs,
247-
channel: &str,
248247
sysroot_kind: SysrootKind,
249248
use_unstable_features: bool,
250249
skip_tests: &[&str],
@@ -260,7 +259,6 @@ pub(crate) fn run_tests(
260259
if config::get_bool("testsuite.no_sysroot") && !skip_tests.contains(&"testsuite.no_sysroot") {
261260
let target_compiler = build_sysroot::build_sysroot(
262261
dirs,
263-
channel,
264262
SysrootKind::None,
265263
cg_clif_dylib,
266264
bootstrap_host_compiler,
@@ -291,7 +289,6 @@ pub(crate) fn run_tests(
291289
if run_base_sysroot || run_extended_sysroot {
292290
let target_compiler = build_sysroot::build_sysroot(
293291
dirs,
294-
channel,
295292
sysroot_kind,
296293
cg_clif_dylib,
297294
bootstrap_host_compiler,

build_system/usage.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ The build system of cg_clif.
22

33
USAGE:
44
./y.sh prepare [--out-dir DIR] [--download-dir DIR]
5-
./y.sh build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
6-
./y.sh test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] [--skip-test TESTNAME]
7-
./y.sh abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
8-
./y.sh bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
5+
./y.sh build [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
6+
./y.sh test [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] [--skip-test TESTNAME]
7+
./y.sh abi-cafe [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
8+
./y.sh bench [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
99

1010
OPTIONS:
11-
--debug
12-
Build cg_clif and the standard library in debug mode rather than release mode.
13-
Warning: An unoptimized cg_clif is very slow.
14-
1511
--sysroot none|clif|llvm
1612
Which sysroot libraries to use:
1713
`none` will not include any standard library in the sysroot.

0 commit comments

Comments
 (0)