rust/compiler/rustc_codegen_cranelift/src
bors 9af6fee87d Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung
Support tail calls in mir via `TerminatorKind::TailCall`

This is one of the interesting bits in tail call implementation — MIR support.

This adds a new `TerminatorKind` which represents a tail call:
```rust
    TailCall {
        func: Operand<'tcx>,
        args: Vec<Operand<'tcx>>,
        fn_span: Span,
    },
```

*Structurally* this is very similar to a normal `Call` but is missing a few fields:
- `destination` — tail calls don't write to destination, instead they pass caller's destination to the callee (such that eventual `return` will write to the caller of the function that used tail call)
- `target` — similarly to `destination` tail calls pass the caller's return address to the callee, so there is nothing to do
- `unwind` — I _think_ this is applicable too, although it's a bit confusing
- `call_source` — `become` forbids operators and is not created as a lowering of something else; tail calls always come from HIR (at least for now)

It might be helpful to read the interpreter implementation to understand what `TailCall` means exactly, although I've tried documenting it too.

-----

There are a few `FIXME`-questions still left, ideally we'd be able to answer them during review ':)

-----

r? `@oli-obk`
cc `@scottmcm` `@DrMeepster` `@JakobDegen`
2024-07-08 04:35:04 +00:00
..
abi Fix spans 2024-07-02 15:48:48 -04:00
debuginfo debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
driver Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
intrinsics Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
optimize
allocator.rs Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
analyze.rs
archive.rs remove useless lifetime of ArchiveBuilder 2024-02-26 22:37:04 +08:00
base.rs Support tail calls in mir via TerminatorKind::TailCall 2024-07-07 17:11:04 +02:00
cast.rs
codegen_i128.rs Remove Rvalue::CheckedBinaryOp 2024-05-17 20:33:02 -07:00
common.rs Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
compiler_builtins.rs
concurrency_limiter.rs Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
config.rs Merge commit '3270432f4b' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
constant.rs Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung 2024-07-08 04:35:04 +00:00
discriminant.rs Merge commit '3270432f4b' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
global_asm.rs Merge commit '3270432f4b' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
inline_asm.rs Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
lib.rs Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
linkage.rs
main_shim.rs Fix spans 2024-07-02 15:48:48 -04:00
num.rs Remove Rvalue::CheckedBinaryOp 2024-05-17 20:33:02 -07:00
pointer.rs
pretty_clif.rs
toolchain.rs
trap.rs
unsize.rs Only compute vtable information during codegen 2024-06-14 20:35:45 -04:00
unwind_module.rs Merge commit '49cd5dd454' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
value_and_place.rs ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
vtable.rs Make builtin_deref just return a Ty 2024-05-09 22:55:00 -04:00