[llvm] r334998 - [WebAssembly] Make rethrow instruction take a target BB argument

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 16:54:29 PDT 2018


Author: aheejin
Date: Mon Jun 18 16:54:29 2018
New Revision: 334998

URL: http://llvm.org/viewvc/llvm-project?rev=334998&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td?rev=334998&r1=334997&r2=334998&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td Mon Jun 18 16:54:29 2018
@@ -152,8 +152,11 @@ defm THROW_I64 : I<(outs), (ins i32imm:$
                    [(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




More information about the llvm-commits mailing list