Skip to content

Subtree sync for rustc_codegen_cranelift #142959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
4f24d14
Merge commit '979dcf8e2f213e4f4b645cb62e7fe9f4f2c0c785' into sync_cg_…
bjorn3 May 25, 2025
2357fb6
Merge branch 'sync_from_rust'
bjorn3 May 25, 2025
ea26272
clif: Provide better output messages for failed copies
tgross35 May 18, 2025
99e783d
atomic_load intrinsic: use const generic parameter for ordering
RalfJung May 24, 2025
26242be
Sync from rust 70b3f4666e24ce22fc32f5e357dbcf85d3254e63
bjorn3 May 31, 2025
bc74556
Rustup to rustc 1.89.0-nightly (70b3f4666 2025-05-30)
bjorn3 May 31, 2025
814ef9f
Rustup to rustc 1.89.0-nightly (5d707b07e 2025-06-02)
bjorn3 Jun 3, 2025
ad43500
Only borrow EncodedMetadata in codegen_crate
bjorn3 May 30, 2025
2974c99
Move metadata object generation for dylibs to the linker code
bjorn3 May 30, 2025
b97136c
Add impl for `llvm.roundeven` in cg_clif
sayantn Jun 3, 2025
12be26f
cg_clif: convert to CanonAbi
workingjubilee May 21, 2025
decbfcd
Auto merge of #141229 - tgross35:builtins-josh-subtree, r=Kobzol
bors Jun 3, 2025
582ad1f
Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
matthiaskrgr Jun 3, 2025
112e5e8
Auto merge of #141984 - matthiaskrgr:rollup-wy6j9ca, r=matthiaskrgr
bors Jun 3, 2025
57d0559
Change `tag_field` to `FieldIdx` in `Variants::Multiple`
scottmcm Jun 4, 2025
8f889f8
Sync from rust 4b27a04cc8ed4da10a546a871e23e665d03f7a79
bjorn3 Jun 5, 2025
bcac194
Rustup to rustc 1.89.0-nightly (4b27a04cc 2025-06-04)
bjorn3 Jun 5, 2025
59549af
Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None
oli-obk Jun 4, 2025
2192d86
Update `InterpCx::project_field` to take `FieldIdx`
scottmcm Jun 4, 2025
3630039
Rollup merge of #142103 - scottmcm:fieldidx-in-interp, r=oli-obk
GuillaumeGomez Jun 6, 2025
83be7a8
Auto merge of #141964 - sayantn:update-stdarch, r=Amanieu
bors Jun 7, 2025
46e0b21
Sync from rust 44f415c1d617ebc7b931a243b7b321ef8a6ca47c
bjorn3 Jun 7, 2025
4e3bf2d
Rustup to rustc 1.89.0-nightly (44f415c1d 2025-06-06)
bjorn3 Jun 7, 2025
18b1221
intrinsics: use const generic to set atomic ordering
RalfJung May 28, 2025
d004022
Sync from rust cdd545be1b4f024d38360aa9f000dcb782fbc81b
bjorn3 Jun 8, 2025
7988b8c
Rustup to rustc 1.89.0-nightly (cdd545be1 2025-06-07)
bjorn3 Jun 8, 2025
d5e9833
Remove rustc's notion of "preferred" alignment AKA `__alignof`
workingjubilee Feb 12, 2025
30c48bc
Use Operand::constant() in a couple of places
bjorn3 Jun 10, 2025
2457bb2
Apply ABI attributes on return types in `rustc_codegen_cranelift`
beetrees Jun 11, 2025
a9fd42e
intrinsics: rename min_align_of to align_of
RalfJung Jun 12, 2025
047a106
Sync from rust e703dff8fe220b78195c53478e83fb2f68d8499c
bjorn3 Jun 12, 2025
9594d67
Rustup to rustc 1.89.0-nightly (e703dff8f 2025-06-11)
bjorn3 Jun 12, 2025
dcc4874
add `extern "custom"` functions
folkertdev May 7, 2025
a6ecde3
Unimplement unsized_locals
mejrs Jun 12, 2025
393e46e
Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr
bors Jun 13, 2025
8b24077
Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
matthiaskrgr Jun 14, 2025
2f2a0b9
Sync from rust 8da623945f83933dd38644d5745532ee032e855b
bjorn3 Jun 14, 2025
600a8a7
Rustup to rustc 1.89.0-nightly (8da623945 2025-06-13)
bjorn3 Jun 14, 2025
3e59f14
Update to abi-cafe 1.0
bjorn3 Jun 15, 2025
8a39619
Use the new abi-cafe-rules.toml support
bjorn3 Jun 15, 2025
aafdccf
Merge pull request #1582 from rust-lang/update_abi_cafe
bjorn3 Jun 15, 2025
9795908
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=wo…
fmease Jun 15, 2025
262e821
Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3
fmease Jun 15, 2025
ab385a9
Sync from rust 586ad391f5ee4519acc7cae340e34673bae762b1
bjorn3 Jun 16, 2025
1ade48f
Rustup to rustc 1.89.0-nightly (586ad391f 2025-06-15)
bjorn3 Jun 16, 2025
b7cfe2f
Use the new --debug flag of abi-cafe
bjorn3 Jun 16, 2025
e391603
Fix RISC-V C function ABI when passing/returning structs containing f…
beetrees Apr 3, 2025
db5a427
Change __rust_no_alloc_shim_is_unstable to be a function
dpaoliello May 15, 2025
cfa4c8f
cranelift/gcc: `{Meta,Pointee,}Sized` in minicore
davidtwco Mar 5, 2025
7ed06e5
Sync from rust 45acf54eea118ed27927282b5e0bfdcd80b7987c
bjorn3 Jun 17, 2025
da831be
Rustup to rustc 1.89.0-nightly (45acf54ee 2025-06-16)
bjorn3 Jun 17, 2025
1ba842d
Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
bors Jun 17, 2025
ca578bf
Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
bors Jun 18, 2025
856ffb6
Sync from rust c68340350c78eea402c4a85f8d9c1b7d3d607635
bjorn3 Jun 19, 2025
8dea73a
Rustup to rustc 1.89.0-nightly (c68340350 2025-06-18)
bjorn3 Jun 19, 2025
3719abb
Update to Cranelift 0.121
bjorn3 Jun 7, 2025
e388261
cranelift: fix target feature name type: "fxsr"
marxin Jun 22, 2025
fc8631b
Sync from rust be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6
bjorn3 Jun 23, 2025
9f5fc01
Rustup to rustc 1.89.0-nightly (be19eda0d 2025-06-22)
bjorn3 Jun 23, 2025
8c848e0
Rustup to rustc 1.90.0-nightly (706f244db 2025-06-23)
bjorn3 Jun 24, 2025
16c041d
Merge commit '8c848e0604b5d26fad120914f822f564fe05c52a' into sync_cg_…
bjorn3 Jun 24, 2025
dbe8682
Update tidy exceptions
bjorn3 Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 50 additions & 34 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,42 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-assembler-x64"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff8e35182c7372df00447cb90a04e584e032c42b9b9b6e8c50ddaaf0d7900d5"
checksum = "f6f53499803b1607b6ee0ba0de4ba036e6da700c2e489fe8f9d0f683d0b84d31"
dependencies = [
"cranelift-assembler-x64-meta",
]

[[package]]
name = "cranelift-assembler-x64-meta"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14220f9c2698015c3b94dc6b84ae045c1c45509ddc406e43c6139252757fdb7a"
checksum = "1aadaa5bc8430d0e7bb999459369bedd0e5816ad4a82a0e20748341c4e333eda"
dependencies = [
"cranelift-srcgen",
]

[[package]]
name = "cranelift-bforest"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d372ef2777ceefd75829e1390211ac240e9196bc60699218f7ea2419038288ee"
checksum = "2005fda2fc52a2dbce58229b4fb4483b70cbc806ba8ecc11b3f050c1a2d26cac"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-bitset"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56323783e423818fa89ce8078e90a3913d2a6e0810399bfce8ebd7ee87baa81f"
checksum = "56935e02452ca1249d39ad5c45a96304d0b4300a158a391fd113451e0cd4483d"

[[package]]
name = "cranelift-codegen"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74ffb780aab6186c6e9ba26519654b1ac55a09c0a866f6088a4efbbd84da68ed"
checksum = "62612786bf00e10999f50217d6f455d02b31591155881a45a903d1a95d1a4043"
dependencies = [
"bumpalo",
"cranelift-assembler-x64",
Expand All @@ -97,13 +97,14 @@ dependencies = [
"serde",
"smallvec",
"target-lexicon",
"wasmtime-math",
]

[[package]]
name = "cranelift-codegen-meta"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c23ef13814d3b39c869650d5961128cbbecad83fbdff4e6836a03ecf6862d7ed"
checksum = "07bae789df91ef236079733af9df11d852256c64af196f0bc6471ea0f5f301be"
dependencies = [
"cranelift-assembler-x64-meta",
"cranelift-codegen-shared",
Expand All @@ -112,33 +113,33 @@ dependencies = [

[[package]]
name = "cranelift-codegen-shared"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f623300657679f847803ce80811454bfff89cea4f6bf684be5c468d4a73631"
checksum = "1be319616d36527782558a8312508757815f64deb19b094c7b8f4337229a9bc6"

[[package]]
name = "cranelift-control"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f4168af69989aa6b91fab46799ed4df6096f3209f4a6c8fb4358f49c60188f"
checksum = "8810ee1ab5e9bd5cff4c0c8d240e2009cb5c2b79888fde1d5256d605712314b7"
dependencies = [
"arbitrary",
]

[[package]]
name = "cranelift-entity"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6fa9bae1c8de26d71ac2162f069447610fd91e7780cb480ee0d76ac81eabb8"
checksum = "086452c97cfbe116bf17dbe622dc5fdf2ea97299c7d4ce42460f284387c9928a"
dependencies = [
"cranelift-bitset",
]

[[package]]
name = "cranelift-frontend"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8219205608aa0b0e6769b580284a7e055c7e0c323c1041cde7ca078add3e412"
checksum = "4c27947010ab759330f252610c17a8cd64d123358be4f33164233d04fcd77b80"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -148,15 +149,15 @@ dependencies = [

[[package]]
name = "cranelift-isle"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588d0c5964f10860b04043e55aab26d7f7a206b0fd4f10c5260e8aa5773832bd"
checksum = "ec67bfb8bd55b1e9760eb9f5186dca8d81bd4d86110f8d5af01154a044c91802"

[[package]]
name = "cranelift-jit"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56bd917ddc524f84f4066f954062875bdfc0dffea068ee94e906d98de5ac7c33"
checksum = "d67cdfc447f2abdb46bb30a6582cce189539c3c051c1d5330692376e1400edff"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -174,9 +175,9 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68a03c057d8a992e06596c871341e446af43ff9224f941e5b8adea39137a5391"
checksum = "e4597eaa52bca1ed111986c7a7f70cdbe192f83d271d627201365078e37b7e84"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -185,9 +186,9 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19ed3c94cb97b14f92b6a94a1d45ef8c851f6a2ad9114e5d91d233f7da638fed"
checksum = "75a9b63edea46e013fce459c46e500462cb03a0490fdd9c18fe42b1dd7b93aa1"
dependencies = [
"cranelift-codegen",
"libc",
Expand All @@ -196,9 +197,9 @@ dependencies = [

[[package]]
name = "cranelift-object"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a64dacef362a69375a604f6636e5e9a174fb96dba3b273646fcd9fa85c1d0997"
checksum = "ce706f0166d5b7f31693dff521e87cb9858e12adf22ffcde93c4a2826f8f04a9"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -211,9 +212,9 @@ dependencies = [

[[package]]
name = "cranelift-srcgen"
version = "0.120.0"
version = "0.121.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85256fac1519a7d25a040c1d850fba67478f3f021ad5fdf738ba4425ee862dbf"
checksum = "7d5870e266df8237b56cc98b04f5739c228565c92dd629ec6c66efa87271a158"

[[package]]
name = "crc32fast"
Expand Down Expand Up @@ -288,6 +289,12 @@ dependencies = [
"windows-targets",
]

[[package]]
name = "libm"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"

[[package]]
name = "log"
version = "0.4.22"
Expand Down Expand Up @@ -446,16 +453,25 @@ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"

[[package]]
name = "wasmtime-jit-icache-coherence"
version = "33.0.0"
version = "34.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175e924dbc944c185808466d1e90b5a7feb610f3b9abdfe26f8ee25fd1086d1c"
checksum = "2eedc0324e37cf39b049f4dca0c30997eaab49f09006d5f4c1994e64e7b7dba8"
dependencies = [
"anyhow",
"cfg-if",
"libc",
"windows-sys 0.59.0",
]

[[package]]
name = "wasmtime-math"
version = "34.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd35fae4cf51d2b4a9bd2ef04b0eb309fa1849cab6a6ab5ac27cbd054ea284d"
dependencies = [
"libm",
]

[[package]]
name = "windows-sys"
version = "0.52.0"
Expand Down
24 changes: 12 additions & 12 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.120.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
cranelift-frontend = { version = "0.120.0" }
cranelift-module = { version = "0.120.0" }
cranelift-native = { version = "0.120.0" }
cranelift-jit = { version = "0.120.0", optional = true }
cranelift-object = { version = "0.120.0" }
cranelift-codegen = { version = "0.121.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
cranelift-frontend = { version = "0.121.0" }
cranelift-module = { version = "0.121.0" }
cranelift-native = { version = "0.121.0" }
cranelift-jit = { version = "0.121.0", optional = true }
cranelift-object = { version = "0.121.0" }
target-lexicon = "0.13"
gimli = { version = "0.31", default-features = false, features = ["write"] }
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
Expand All @@ -24,12 +24,12 @@ smallvec = "1.8.1"

[patch.crates-io]
# Uncomment to use an unreleased version of cranelift
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-33.0.0", version = "0.120.0" }
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }

# Uncomment to use local checkout of cranelift
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::{CodegenBackend, SysrootKind, build_sysroot};
static ABI_CAFE_REPO: GitRepo = GitRepo::github(
"Gankra",
"abi-cafe",
"f1220cfd13b57f5c0082c26529163865ee25e115",
"fe93a9acd461425d",
"94d38030419eb00a1ba80e5e2b4d763dcee58db4",
"6efb4457893c8670",
"abi-cafe",
);

Expand Down Expand Up @@ -46,6 +46,10 @@ pub(crate) fn run(
let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
cmd.arg("--");

cmd.arg("--debug");

cmd.arg("--rules").arg(dirs.source_dir.join("scripts/abi-cafe-rules.toml"));

// stdcall, vectorcall and such don't work yet
cmd.arg("--conventions").arg("c").arg("--conventions").arg("rust");

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2025-05-25"
channel = "nightly-2025-06-24"
components = ["rust-src", "rustc-dev", "llvm-tools"]
profile = "minimal"
17 changes: 17 additions & 0 deletions compiler/rustc_codegen_cranelift/scripts/abi-cafe-rules.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[target.'cfg(all(target_arch = "aarch64", target_os = "linux"))']
'F32Array::conv_c'.busted = "check"

[target.'cfg(all(target_arch = "aarch64", target_os = "macos"))']
'SingleVariantUnion::conv_c::repr_c'.busted = "check"
'OptionU128::conv_rust::repr_c::rustc_caller'.busted = "run"
'OptionU128::conv_rust::repr_c::cgclif_caller'.busted = "check"

[target.'cfg(all(target_arch = "x86_64", windows))']
'simple::conv_rust'.busted = "check"
'simple::conv_rust::rustc_caller'.busted = "run"

[target.'*'.'f16']
run = "skip"

[target.'*'.'f128']
run = "skip"
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn pointer_for_allocation<'tcx>(
crate::pointer::Pointer::new(global_ptr)
}

pub(crate) fn data_id_for_alloc_id(
fn data_id_for_alloc_id(
cx: &mut ConstantCx,
module: &mut dyn Module,
alloc_id: AllocId,
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>(
};
let x = codegen_operand(fx, &x.node);
let y = codegen_operand(fx, &y.node);
let kind = match &kind.node {
Operand::Constant(const_) => crate::constant::eval_mir_constant(fx, const_).0,
Operand::Copy(_) | Operand::Move(_) => unreachable!("{kind:?}"),
let kind = if let Some(const_) = kind.node.constant() {
crate::constant::eval_mir_constant(fx, const_).0
} else {
unreachable!("{kind:?}")
};

let flt_cc = match kind
Expand Down
Loading
Loading