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.
This commit is contained in:
bjorn3 2024-08-10 14:16:53 +00:00
parent bb6571fd63
commit 1b9645853a
6 changed files with 15 additions and 47 deletions

View File

@ -14,7 +14,6 @@
static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target"); static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
pub(crate) fn run( pub(crate) fn run(
channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
dirs: &Dirs, dirs: &Dirs,
cg_clif_dylib: &CodegenBackend, cg_clif_dylib: &CodegenBackend,
@ -28,7 +27,6 @@ pub(crate) fn run(
eprintln!("Building sysroot for abi-cafe"); eprintln!("Building sysroot for abi-cafe");
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
dirs, dirs,
channel,
sysroot_kind, sysroot_kind,
cg_clif_dylib, cg_clif_dylib,
bootstrap_host_compiler, bootstrap_host_compiler,

View File

@ -10,7 +10,6 @@
pub(crate) fn build_backend( pub(crate) fn build_backend(
dirs: &Dirs, dirs: &Dirs,
channel: &str,
bootstrap_host_compiler: &Compiler, bootstrap_host_compiler: &Compiler,
use_unstable_features: bool, use_unstable_features: bool,
) -> PathBuf { ) -> PathBuf {
@ -32,13 +31,7 @@ pub(crate) fn build_backend(
cmd.arg("--features").arg("unstable-features"); cmd.arg("--features").arg("unstable-features");
} }
match channel { cmd.arg("--release");
"debug" => {}
"release" => {
cmd.arg("--release");
}
_ => unreachable!(),
}
rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags); rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags);
@ -48,6 +41,6 @@ pub(crate) fn build_backend(
CG_CLIF CG_CLIF
.target_dir(dirs) .target_dir(dirs)
.join(&bootstrap_host_compiler.triple) .join(&bootstrap_host_compiler.triple)
.join(channel) .join("release")
.join(get_file_name(&bootstrap_host_compiler.rustc, "rustc_codegen_cranelift", "dylib")) .join(get_file_name(&bootstrap_host_compiler.rustc, "rustc_codegen_cranelift", "dylib"))
} }

View File

@ -15,7 +15,6 @@
pub(crate) fn build_sysroot( pub(crate) fn build_sysroot(
dirs: &Dirs, dirs: &Dirs,
channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
cg_clif_dylib_src: &CodegenBackend, cg_clif_dylib_src: &CodegenBackend,
bootstrap_host_compiler: &Compiler, bootstrap_host_compiler: &Compiler,
@ -84,7 +83,6 @@ pub(crate) fn build_sysroot(
let host = build_sysroot_for_triple( let host = build_sysroot_for_triple(
dirs, dirs,
channel,
bootstrap_host_compiler.clone(), bootstrap_host_compiler.clone(),
&cg_clif_dylib_path, &cg_clif_dylib_path,
sysroot_kind, sysroot_kind,
@ -94,7 +92,6 @@ pub(crate) fn build_sysroot(
if !is_native { if !is_native {
build_sysroot_for_triple( build_sysroot_for_triple(
dirs, dirs,
channel,
{ {
let mut bootstrap_target_compiler = bootstrap_host_compiler.clone(); let mut bootstrap_target_compiler = bootstrap_host_compiler.clone();
bootstrap_target_compiler.triple = target_triple.clone(); bootstrap_target_compiler.triple = target_triple.clone();
@ -167,7 +164,6 @@ fn install_into_sysroot(&self, sysroot: &Path) {
#[must_use] #[must_use]
fn build_sysroot_for_triple( fn build_sysroot_for_triple(
dirs: &Dirs, dirs: &Dirs,
channel: &str,
compiler: Compiler, compiler: Compiler,
cg_clif_dylib_path: &CodegenBackend, cg_clif_dylib_path: &CodegenBackend,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
@ -176,9 +172,7 @@ fn build_sysroot_for_triple(
SysrootKind::None => build_rtstartup(dirs, &compiler) SysrootKind::None => build_rtstartup(dirs, &compiler)
.unwrap_or(SysrootTarget { triple: compiler.triple, libs: vec![] }), .unwrap_or(SysrootTarget { triple: compiler.triple, libs: vec![] }),
SysrootKind::Llvm => build_llvm_sysroot_for_triple(compiler), SysrootKind::Llvm => build_llvm_sysroot_for_triple(compiler),
SysrootKind::Clif => { SysrootKind::Clif => build_clif_sysroot_for_triple(dirs, compiler, cg_clif_dylib_path),
build_clif_sysroot_for_triple(dirs, channel, compiler, cg_clif_dylib_path)
}
} }
} }
@ -219,7 +213,6 @@ fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget {
#[must_use] #[must_use]
fn build_clif_sysroot_for_triple( fn build_clif_sysroot_for_triple(
dirs: &Dirs, dirs: &Dirs,
channel: &str,
mut compiler: Compiler, mut compiler: Compiler,
cg_clif_dylib_path: &CodegenBackend, cg_clif_dylib_path: &CodegenBackend,
) -> SysrootTarget { ) -> SysrootTarget {
@ -231,7 +224,7 @@ fn build_clif_sysroot_for_triple(
target_libs.libs.extend(rtstartup_target_libs.libs); target_libs.libs.extend(rtstartup_target_libs.libs);
} }
let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(&compiler.triple).join(channel); let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(&compiler.triple).join("release");
if !config::get_bool("keep_sysroot") { if !config::get_bool("keep_sysroot") {
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster // Cleanup the deps dir, but keep build scripts and the incremental cache for faster
@ -252,12 +245,12 @@ fn build_clif_sysroot_for_triple(
// Necessary for MinGW to find rsbegin.o and rsend.o // Necessary for MinGW to find rsbegin.o and rsend.o
rustflags.push("--sysroot".to_owned()); rustflags.push("--sysroot".to_owned());
rustflags.push(RTSTARTUP_SYSROOT.to_path(dirs).to_str().unwrap().to_owned()); rustflags.push(RTSTARTUP_SYSROOT.to_path(dirs).to_str().unwrap().to_owned());
if channel == "release" {
// Incremental compilation by default disables mir inlining. This leads to both a decent // Incremental compilation by default disables mir inlining. This leads to both a decent
// compile perf and a significant runtime perf regression. As such forcefully enable mir // compile perf and a significant runtime perf regression. As such forcefully enable mir
// inlining. // inlining.
rustflags.push("-Zinline-mir".to_owned()); rustflags.push("-Zinline-mir".to_owned());
}
if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") { if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
rustflags.push("--remap-path-prefix".to_owned()); rustflags.push("--remap-path-prefix".to_owned());
rustflags.push(format!( rustflags.push(format!(
@ -268,9 +261,7 @@ fn build_clif_sysroot_for_triple(
} }
compiler.rustflags.extend(rustflags); compiler.rustflags.extend(rustflags);
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs); let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
if channel == "release" { build_cmd.arg("--release");
build_cmd.arg("--release");
}
build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128"); build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128");
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true"); build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif"); build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");

View File

@ -81,7 +81,6 @@ fn main() {
let mut out_dir = PathBuf::from("."); let mut out_dir = PathBuf::from(".");
let mut download_dir = None; let mut download_dir = None;
let mut channel = "release";
let mut sysroot_kind = SysrootKind::Clif; let mut sysroot_kind = SysrootKind::Clif;
let mut use_unstable_features = true; let mut use_unstable_features = true;
let mut frozen = false; let mut frozen = false;
@ -99,7 +98,6 @@ fn main() {
arg_error!("--download-dir requires argument"); arg_error!("--download-dir requires argument");
}))); })));
} }
"--debug" => channel = "debug",
"--sysroot" => { "--sysroot" => {
sysroot_kind = match args.next().as_deref() { sysroot_kind = match args.next().as_deref() {
Some("none") => SysrootKind::None, Some("none") => SysrootKind::None,
@ -206,7 +204,6 @@ fn main() {
} else { } else {
CodegenBackend::Local(build_backend::build_backend( CodegenBackend::Local(build_backend::build_backend(
&dirs, &dirs,
channel,
&bootstrap_host_compiler, &bootstrap_host_compiler,
use_unstable_features, use_unstable_features,
)) ))
@ -218,7 +215,6 @@ fn main() {
Command::Test => { Command::Test => {
tests::run_tests( tests::run_tests(
&dirs, &dirs,
channel,
sysroot_kind, sysroot_kind,
use_unstable_features, use_unstable_features,
&skip_tests.iter().map(|test| &**test).collect::<Vec<_>>(), &skip_tests.iter().map(|test| &**test).collect::<Vec<_>>(),
@ -234,7 +230,6 @@ fn main() {
process::exit(1); process::exit(1);
} }
abi_cafe::run( abi_cafe::run(
channel,
sysroot_kind, sysroot_kind,
&dirs, &dirs,
&cg_clif_dylib, &cg_clif_dylib,
@ -245,7 +240,6 @@ fn main() {
Command::Build => { Command::Build => {
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
&dirs, &dirs,
channel,
sysroot_kind, sysroot_kind,
&cg_clif_dylib, &cg_clif_dylib,
&bootstrap_host_compiler, &bootstrap_host_compiler,
@ -256,7 +250,6 @@ fn main() {
Command::Bench => { Command::Bench => {
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
&dirs, &dirs,
channel,
sysroot_kind, sysroot_kind,
&cg_clif_dylib, &cg_clif_dylib,
&bootstrap_host_compiler, &bootstrap_host_compiler,

View File

@ -244,7 +244,6 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
pub(crate) fn run_tests( pub(crate) fn run_tests(
dirs: &Dirs, dirs: &Dirs,
channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
use_unstable_features: bool, use_unstable_features: bool,
skip_tests: &[&str], skip_tests: &[&str],
@ -260,7 +259,6 @@ pub(crate) fn run_tests(
if config::get_bool("testsuite.no_sysroot") && !skip_tests.contains(&"testsuite.no_sysroot") { if config::get_bool("testsuite.no_sysroot") && !skip_tests.contains(&"testsuite.no_sysroot") {
let target_compiler = build_sysroot::build_sysroot( let target_compiler = build_sysroot::build_sysroot(
dirs, dirs,
channel,
SysrootKind::None, SysrootKind::None,
cg_clif_dylib, cg_clif_dylib,
bootstrap_host_compiler, bootstrap_host_compiler,
@ -291,7 +289,6 @@ pub(crate) fn run_tests(
if run_base_sysroot || run_extended_sysroot { if run_base_sysroot || run_extended_sysroot {
let target_compiler = build_sysroot::build_sysroot( let target_compiler = build_sysroot::build_sysroot(
dirs, dirs,
channel,
sysroot_kind, sysroot_kind,
cg_clif_dylib, cg_clif_dylib,
bootstrap_host_compiler, bootstrap_host_compiler,

View File

@ -2,16 +2,12 @@ The build system of cg_clif.
USAGE: USAGE:
./y.sh prepare [--out-dir DIR] [--download-dir DIR] ./y.sh prepare [--out-dir DIR] [--download-dir DIR]
./y.sh build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] ./y.sh build [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
./y.sh test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] [--skip-test TESTNAME] ./y.sh test [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] [--skip-test TESTNAME]
./y.sh abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] ./y.sh abi-cafe [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
./y.sh bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] ./y.sh bench [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
OPTIONS: OPTIONS:
--debug
Build cg_clif and the standard library in debug mode rather than release mode.
Warning: An unoptimized cg_clif is very slow.
--sysroot none|clif|llvm --sysroot none|clif|llvm
Which sysroot libraries to use: Which sysroot libraries to use:
`none` will not include any standard library in the sysroot. `none` will not include any standard library in the sysroot.