[WebAssembly] Make rethrow instruction take a target BB argument

Summary:
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.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D48260

llvm-svn: 334998
This commit is contained in:
Heejin Ahn 2018-06-18 23:54:29 +00:00
parent 56e1271020
commit 6279d71227
1 changed files with 5 additions and 2 deletions

View File

@ -152,8 +152,11 @@ defm THROW_I64 : I<(outs), (ins i32imm:$tag, I64:$val),
[(int_wasm_throw imm:$tag, I64:$val)],
"throw \t$tag, $val", "throw \t$tag",
0x08>;
defm RETHROW : NRI<(outs), (ins i32imm:$rel_depth), [], "rethrow \t$rel_depth",
0x09>;
defm RETHROW : NRI<(outs), (ins bb_op:$dst), [], "rethrow \t$dst", 0x09>;
let isCodeGenOnly = 1 in
// This is used when the destination for rethrow is the caller function. This
// will be converted to a rethrow in CFGStackify.
defm RETHROW_TO_CALLER : NRI<(outs), (ins), [], "rethrow">;
} // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1
// Region within which an exception is caught: try / end_try