Issue 166977
Summary [WebAssembly] Support callbr
Labels new issue
Assignees
Reporter dschuff
    As reported in #165589, the WebAssembly backend currently does not support the [callbr](https://llvm.org/docs/LangRef.html#callbr-instruction) instruction.

Currently `callbr` is only used for supporting the `asm goto` extension, which is mostly found in the Linux kernel and similar embedded scenarios where the code wouldn't directly work with Wasm and would need substantial porting effort. Hence there haven't yet been any requests for support or use cases surfaced where it would be needed. A recent [RFC](https://discourse.llvm.org/t/rfc-add-callbr-intrinsic-support/86087) proposed using `callbr` for some intrinsics as well, so it's possible that in the future there might be some intrinsic that we want to support that would also use it.

#165589 has some discussion of the crash that currently occurs when trying to use `callbr` but in order to actually make it work we'd also need to handle the indirect control flow, which seems to operate similarly to [indirectbr](https://llvm.org/docs/LangRef.html#indirectbr-instruction). Wasm currently supports indirectbr by lowering it away to a switch using the IndirectBrExpandPass. Perhaps we could do something similar for `callbr`, although it's not obvious how that would work if we wanted to have some kind of real assembly inside.

But I don't think it makes sense to work on this until we have some kind of concrete use case for it. So I'm thinking we can leave this bug open for now until it becomes clear whether this would be useful for anyone. (If that's you, please leave a comment!)


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to