You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #144232 - xacrimon:explicit-tail-call, r=WaffleLapkin
Implement support for `become` and explicit tail call codegen for the LLVM backend
This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (#112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged.
During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).
// Consts for the LLVM CallConv type, pre-cast to usize.
99
99
100
+
#[derive(Copy,Clone,PartialEq,Debug)]
101
+
#[repr(C)]
102
+
#[allow(dead_code)]
103
+
pub(crate)enumTailCallKind{
104
+
None = 0,
105
+
Tail = 1,
106
+
MustTail = 2,
107
+
NoTail = 3,
108
+
}
109
+
100
110
/// LLVM CallingConv::ID. Should we wrap this?
101
111
///
102
112
/// See <https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/CallingConv.h>
0 commit comments