[PATCH] D57134: [WebAssembly] Exception handling: Switch to the new proposal
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 23 18:30:23 PST 2019
aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, sbc100.
This switches the EH implementation to the new proposal:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
- Instruction changes
- Now we have one single `catch` instruction that returns a except_ref value
- `throw` now can take variable number of operations
- `rethrow` does not have 'depth' argument anymore
- `br_on_exn` queries an except_ref to see if it matches the tag and branches to the given label if true.
- `extract_exception` is a pseudo instruction that simulates popping values from wasm stack. This is to make `br_on_exn`, a very special instruction, work: `br_on_exn` puts values onto the stack only if it is taken, and the # of values can vay depending on the tag.
- Now there's only one `catch` per `try`, this patch removes all special handling for terminate pad with a call to `__clang_call_terminate`. Before it was the only case there are two catch clauses (a normal `catch` and `catch_all` per `try`).
- Make `rethrow` act as a terminator like `throw`. This splits BB after `rethrow` in WasmEHPrepare, and deletes an unnecessary `unreachable` after `rethrow` in LateEHPrepare.
- Now we stop at all catchpads (because we add wasm `catch` instruction that catches all exceptions), this creates new `findWasmUnwindDestinations` function in SelectionDAGBuilder. Also this deletes all EHPadUnwindMap related routines from WasmEHFuncInfo, because we don't need to consider the case an exception is not caught by a catchpad now.
- Now we use `br_on_exn` instrution to figure out if an except_ref
matches the current tag or not, LateEHPrepare generates this sequence
for catch pads:
catch
block except_ref
br_on_exn $__cpp_exception
end_block
extract_exception
- Other various misc. changes to switch to the new proposal.
Repository:
rL LLVM
https://reviews.llvm.org/D57134
Files:
include/llvm/CodeGen/WasmEHFuncInfo.h
include/llvm/IR/IntrinsicsWebAssembly.td
lib/CodeGen/AsmPrinter/WasmException.cpp
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/WasmEHPrepare.cpp
lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
lib/Target/WebAssembly/WebAssemblyEHRestoreStackPointer.cpp
lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.h
lib/Target/WebAssembly/WebAssemblyInstrControl.td
lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
lib/Target/WebAssembly/WebAssemblyInstrInfo.td
lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
lib/Target/WebAssembly/WebAssemblyUtilities.cpp
lib/Target/WebAssembly/WebAssemblyUtilities.h
test/CodeGen/WebAssembly/annotations.mir
test/CodeGen/WebAssembly/cfg-stackify-eh.ll
test/CodeGen/WebAssembly/cfg-stackify-eh.mir
test/CodeGen/WebAssembly/exception.ll
test/CodeGen/WebAssembly/wasmehprepare.ll
test/MC/WebAssembly/annotations.s
test/MC/WebAssembly/basic-assembly.s
unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57134.183226.patch
Type: text/x-patch
Size: 112792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/c7c14b04/attachment.bin>
More information about the llvm-commits
mailing list