[llvm-dev] Function with multi return path?

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 2 04:51:21 PDT 2017


On 2 Jun 2017, at 03:38, TONGARI J via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I'm aware of the invoke instruction and landingpad. But it's too heavy
> weight for control flow. It's quite expensive to take the exceptional path
> in C++.
> 
> What I want is a more lightweight approach, to pass the return address to
> the callee, and let the callee jump to that address directly.

The best way of implementing this is likely to be to use a custom calling convention along with invoke.  The invoke instruction will handle the semantics correctly in the IR, but you’ll need to modify the back end to understand that it should generate the call site differently and not emit unwind tables.

David



More information about the llvm-dev mailing list