[PATCH] D43744: [WebAssembly] Fix rethrow's argument type

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 07:55:48 PST 2018


aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, sbc100, jfb.
aheejin added a dependency: D43742: [WebAssembly] Gather EH instructions in one place. NFC..

According to the changed spec, rethrow now takes not an i32 immediate
but an except_ref argument. This patch deletes the old i32imm argument,
and does not add the except_ref argument because the argument will be
added after instruction selection.


Repository:
  rL LLVM

https://reviews.llvm.org/D43744

Files:
  lib/Target/WebAssembly/WebAssemblyInstrControl.td
  test/CodeGen/WebAssembly/exception.ll


Index: test/CodeGen/WebAssembly/exception.ll
===================================================================
--- test/CodeGen/WebAssembly/exception.ll
+++ test/CodeGen/WebAssembly/exception.ll
@@ -15,7 +15,7 @@
 }
 
 ; CHECK-LABEL: rethrow:
-; CHECK-NEXT: rethrow 0
+; CHECK-NEXT: rethrow
 define void @rethrow() {
   call void @llvm.wasm.rethrow()
   ret void
Index: lib/Target/WebAssembly/WebAssemblyInstrControl.td
===================================================================
--- lib/Target/WebAssembly/WebAssemblyInstrControl.td
+++ lib/Target/WebAssembly/WebAssemblyInstrControl.td
@@ -125,8 +125,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>;
+// rethrow instruction takes an except_ref type argument, but it is omitted here
+// because it will be added after instruction selection.
+def RETHROW : I<(outs), (ins), [(int_wasm_rethrow)], "rethrow", 0x09>;
 } // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1
 
 // Region within which an exception is caught: try / end_try
@@ -136,8 +137,3 @@
 } // Uses = [VALUE_STACK], Defs = [VALUE_STACK]
 
 } // Defs = [ARGUMENTS]
-
-// rethrow takes a relative depth as an argument, for which currently only 0 is
-// possible for C++. Once other languages need depths other than 0, depths will
-// be computed in CFGStackify.
-def : Pat<(int_wasm_rethrow), (RETHROW 0)>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43744.135826.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180225/4d3a8a9e/attachment.bin>


More information about the llvm-commits mailing list