This PR refactors the LLVM backend to be a bit simpler when it comes to dealing with calling continuations.
It introduces emit_call which is used to emit any sort of calls: it handles calling basic blocks, functions, closures, bottom/unreachable as well as calling the return parameter of a function.
It's interesting to lift it out as it's own function, different from emit_epilogue, because often we generate an unconditional jump as part of emitting an intrinsic, or a direct-style (returning) call. This simplifies the backend a bit because now there is only one place where LLVM branches are actually emitted.
Furthermore, emitting calls to intrinsics was simplified and now emit_intrinsic* functions all return values, leaving emit_epiloguel the responsibility of calling the next continuation through emit_call.
Testing results
Rodent builds and works, Artic tests all pass, Stincilla builds and passes tests.
This PR refactors the LLVM backend to be a bit simpler when it comes to dealing with calling continuations.
It introduces
emit_call
which is used to emit any sort of calls: it handles calling basic blocks, functions, closures, bottom/unreachable as well as calling the return parameter of a function.It's interesting to lift it out as it's own function, different from emit_epilogue, because often we generate an unconditional jump as part of emitting an intrinsic, or a direct-style (returning) call. This simplifies the backend a bit because now there is only one place where LLVM branches are actually emitted.
Furthermore, emitting calls to intrinsics was simplified and now emit_intrinsic* functions all return values, leaving
emit_epiloguel
the responsibility of calling the next continuation throughemit_call
.Testing results
Rodent builds and works, Artic tests all pass, Stincilla builds and passes tests.