This would be very convenient to quickly check what a piece of Rust code actually does, or if the Rust compiler generates code as intended.
?godbolt
pub fn foo(x: u32) -> u32 {
x * 4 + 3
}
...will print...
example::foo:
lea eax, [4*rdi + 3]
ret
By default, it would build on release mode (-Copt-level=3). Maybe we could introduce a ?godboltdebug command, but tbh I doubt that there is much use for such thing.
It might be good to allow custom rustc args, to better explore codegen. For example
?godbolt -Ctarget-cpu=native ```rs
pub fn foo(s: &mut [u32]) {
for elem in s {
*elem *= 2;
}
}```
This would be very convenient to quickly check what a piece of Rust code actually does, or if the Rust compiler generates code as intended.
By default, it would build on release mode (
-Copt-level=3
). Maybe we could introduce a?godboltdebug
command, but tbh I doubt that there is much use for such thing.It might be good to allow custom rustc args, to better explore codegen. For example
Godbolt has an API that can be used to implement all of this: https://github.com/compiler-explorer/compiler-explorer/blob/master/docs/API.md#post-apicompilercompiler-idcompile---perform-a-compilation-1