[PATCH] D48260: [WebAssembly] Make rethrow instruction take a target BB argument

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 16 19:14:31 PDT 2018


aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, sbc100.

This patch changes the rethrow instruction to take a BB argument in LLVM
backend, like `br` and `br_if`s. This BB is a target catch BB the
rethrow instruction unwinds to. This BB argument will be converted to an
relative depth immediate at the end of CFGStackify pass, as in the same
way of branches.

RETHROW_TO_CALLER is a codegen-only instruction that should be used when
a rethrow instruction does not have an unwind destination BB, i.e., it
should rethrow to its caller function.


Repository:
  rL LLVM

https://reviews.llvm.org/D48260

Files:
  lib/Target/WebAssembly/WebAssemblyInstrControl.td


Index: lib/Target/WebAssembly/WebAssemblyInstrControl.td
===================================================================
--- lib/Target/WebAssembly/WebAssemblyInstrControl.td
+++ lib/Target/WebAssembly/WebAssemblyInstrControl.td
@@ -130,8 +130,9 @@
 def THROW_I64 : I<(outs), (ins i32imm:$tag, I64:$val),
                   [(int_wasm_throw imm:$tag, I64:$val)], "throw   \t$tag, $val",
                   0x08>;
-def RETHROW : I<(outs), (ins i32imm:$rel_depth), [], "rethrow \t$rel_depth",
-                0x09>;
+def RETHROW : I<(outs), (ins bb_op:$dst), [], "rethrow \t$dst", 0x09>;
+let isCodeGenOnly = 1 in
+def RETHROW_TO_CALLER : I<(outs), (ins), [], "rethrow_to_caller">;
 } // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1
 
 // Region within which an exception is caught: try / end_try


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48260.151630.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180617/bfa3ed83/attachment.bin>


More information about the llvm-commits mailing list