rustc_codegen_cranelift
rustc_codegen_cranelift copied to clipboard
Full asm!() support
- [x] Support
constoperands.- [x] For inline asm (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1350)
- [x] For global asm (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1351)
- [ ] Support
symoperands.- [x] For inline asm (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1350)
- [ ] For global asm (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1351, but doesn't work when the function is made private to the codegen unit)
- [ ] Support asm goto (https://github.com/rust-lang/rust/pull/133870 will stabilize it for cg_llvm)
- [x] Support register classes. This will require writing a mini register allocator to solve all register constraints. (#1206)
- [x] Optimize
- [x] Overlap input and output stack slots. (#1206)
- [x] Skip saving caller saved registers. (#1206)
- [ ] Support more architectures
- [x] aarch64 (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1396)
- [x] riscv64 (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1398)
- [ ] ...
- [x] Support inline asm on macOS (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1397)
- [x] Support inline asm on Windows (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1403)
- [x] Avoid the object file linking hack. It doesn't work on macOS and Windows but is currently necessary as incr comp expects each codegen unit to provide a single object file instead of allowing an extra object file for the compiled assembly. (#1264)
- [x] Use cgu name instead of function name as base for assembly stub names. The same function name may be used in multiple cgus when using
#[inline]. (122219237437ee1deee33df9806a4316194a6f76) - [x] Run inline asm tests from the rustc test suite (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1397)
- [x] Enable support by default (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1403)
~~Tracking issue for stabilizing asm!(): https://github.com/rust-lang/rust/issues/72016~~ Has been stabilized.
Avoid the object file linking hack. It doesn't work on macOS and Windows but is currently necessary as incr comp expects each codegen unit to provide a single object file instead of allowing an extra object file for the compiled assembly.
I managed to do this on the parallel_comp_refactor branch.
Merged in #1264.
Mostly implemented const and sym operands for both inline and global asm.
As of https://github.com/rust-lang/rustc_codegen_cranelift/pull/1403 inline asm is now supported and stable on all targets supported by cg_clif.
awesome!
did a quick test with building our codebase with this and did fail on wasmtime-runtime using inline asm:
error: asm! and global_asm! sym operands are not yet supported
--> /home/repi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-runtime-14.0.2/src/libcalls.rs:156:5
|
156 | wasmtime_environ::foreach_builtin_function!(libcall);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `std::arch::global_asm` which comes from the expansion of the macro `wasmtime_environ::foreach_builtin_function` (in Nightly builds, run with -Z macro-backtrace for more info)
related to this note?
For global asm (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1351, but doesn't work when the function is made private to the codegen unit)
or maybe this was not part of the new deployed rustup component?
related to this note?
Correct. So far I had only checked wasmtime with unstable features enabled (as is the default for building it using ./y.sh in this repo), but not with unstable features disabled (as is the case for the rustc-codegen-cranelift-preview rustup component) With unstable features enabled the entire wasmtime test suite passes with the exception of a couple of tests that need panic=unwind.
ah good to know, and fantastic that the full test suite passes!