summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2017-06-30 00:43:15 +0000
committerHeejin Ahn <aheejin@gmail.com>2017-06-30 00:43:15 +0000
commitac62b05d055632d849cbf48dfc2fbc423c85f87e (patch)
treec9ed58744c502fc83bb4c853267f621b68f1a9e5 /llvm/test/CodeGen/WebAssembly
parent48bccc9448237a9fa6c7f694137d3d2490e725c7 (diff)
downloadbcm5719-llvm-ac62b05d055632d849cbf48dfc2fbc423c85f87e.tar.gz
bcm5719-llvm-ac62b05d055632d849cbf48dfc2fbc423c85f87e.zip
[WebAssembly] Add support for exception handling instructions
Summary: This adds backend support for throw, rethrow, try, and try_end instructions. This needs the corresponding clang builtin support: https://reviews.llvm.org/D34783 This follows the Wasm exception handling proposal in https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md Reviewers: sunfish, dschuff Reviewed By: dschuff Subscribers: jfb, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D34826 llvm-svn: 306774
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly')
-rw-r--r--llvm/test/CodeGen/WebAssembly/exception.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/exception.ll b/llvm/test/CodeGen/WebAssembly/exception.ll
new file mode 100644
index 00000000000..eedb5c78b24
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/exception.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown-wasm"
+
+declare void @llvm.wasm.throw(i32, i8*)
+declare void @llvm.wasm.rethrow()
+
+; CHECK-LABEL: throw:
+; CHECK-NEXT: i32.const $push0=, 0
+; CHECK-NEXT: throw 0, $pop0
+define void @throw() {
+ call void @llvm.wasm.throw(i32 0, i8* null)
+ ret void
+}
+
+; CHECK-LABEL: rethrow:
+; CHECK-NEXT: rethrow 0
+define void @rethrow() {
+ call void @llvm.wasm.rethrow()
+ ret void
+}
OpenPOWER on IntegriCloud