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 replaces catchret/cleanupret instructions with br and rethrow instructions appropriately.
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.
Based on this comment I assume we are marking 'IsEHFuncletEntry' for a different purpose than MSVC (since we don't need a function prologue)? In that case I guess this comment should be updated. Likewise below. (what do we use it for?)