[WebAssembly] Support instruction selection for catching exceptions
This lowers exception catching-related instructions:
- Lowers wasm.catch intrinsic to catch instruction
- Removes catchpad and cleanuppad instructions; they are not
necessary after isel phase. (MachineBasicBlock::isEHFuncletEntry() or
MachineBasicBlock::isEHPad() can be used instead.)
- Lowers catchret and cleanupret instructions to pseudo catchret
and cleanupret instructions in isel, which will be replaced with other
instructions in WebAssemblyExceptionPrepare pass.
- Adds 'WebAssemblyExceptionPrepare` pass, which is for running various
transformation for EH. Currently this pass only replaces catchret and
cleanupret instructions into appropriate wasm instructions to make
this patch successfully run until the end.
Currently this does not handle lowering of intrinsics related to LSDA
info generation (wasm.landingpad.index and wasm.lsda), because they
cannot be tested without implementing EHStreamer's wasm-specific
handlers. They are marked as TODO, which is needed to make isel pass.
Also this does not generate try and end_try markers yet, which will
be handled in later patches.
This patch is based on the first wasm EH proposal.
Reviewers: dschuff, majnemer
Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D44090