Skip to content

Commit

Permalink
[WebAssembly] Make rethrow instruction take a target BB argument
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aheejin committed Jun 18, 2018
1 parent 56e1271 commit 6279d71
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
Expand Up @@ -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
Expand Down

0 comments on commit 6279d71

Please sign in to comment.