aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2025-02-25 09:53:01 -0800
committerGitHub <noreply@github.com>2025-02-25 09:53:01 -0800
commitd2d469eb7981885eac188bf7988c72d7e85b2d4e (patch)
treecf9e474b47adfe68ff3a629ef2b6360fa9af9014 /clang/lib/CodeGen/CodeGenModule.cpp
parent041b7f508533417bcda4feaa03d6c16ff85275f5 (diff)
downloadllvm-d2d469eb7981885eac188bf7988c72d7e85b2d4e.zip
llvm-d2d469eb7981885eac188bf7988c72d7e85b2d4e.tar.gz
llvm-d2d469eb7981885eac188bf7988c72d7e85b2d4e.tar.bz2
[WebAssembly] Make llvm.wasm.throw invokable (#128104)
`llvm.wasm.throw` intrinsic can throw but it was not invokable. Not sure what the rationale was when it was first written that way, but I think at least in Emscripten's C++ exception support with the Wasm port of libunwind, `__builtin_wasm_throw`, which is lowered down to `llvm.wasm.rethrow`, is used only within `_Unwind_RaiseException`, which is an one-liner and thus does not need an `invoke`: https://github.com/emscripten-core/emscripten/blob/720e97f76d6f19e0c6a2d6988988cfe23f0517fb/system/lib/libunwind/src/Unwind-wasm.c#L69 (`_Unwind_RaiseException` is called by `__cxa_throw`, which is generated by the `throw` C++ keyword) But this does not address other direct uses of the builtin in C++, whose use I'm not sure about but is not prohibited. Also other language frontends may need to use the builtin in different functions, which has `try`-`catch`es or destructors. This makes `llvm.wasm.throw` invokable in the backend. To do that, this adds a custom lowering routine to `SelectionDAGBuilder::visitInvoke`, like we did for `llvm.wasm.rethrow`. This does not generate `invoke`s for `__builtin_wasm_throw` yet, which will be done by a follow-up PR. Addresses #124710.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions