summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2017-06-30 00:44:01 +0000
committerHeejin Ahn <aheejin@gmail.com>2017-06-30 00:44:01 +0000
commitb92440eab05b6635350aa5042930a8e4b78c4317 (patch)
treeb5102fb5cc5c794dbf249469678de3d6770eb287 /clang/lib
parentac62b05d055632d849cbf48dfc2fbc423c85f87e (diff)
downloadbcm5719-llvm-b92440eab05b6635350aa5042930a8e4b78c4317.tar.gz
bcm5719-llvm-b92440eab05b6635350aa5042930a8e4b78c4317.zip
[WebAssembly] Add throw/rethrow builtins for exception handling
Summary: Add new builtins for throw/rethrow instructions. This follows exception handling handling proposal in https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md Reviewers: sunfish, dschuff Reviewed By: dschuff Subscribers: jfb, dschuff, sbc100, jgravelle-google Differential Revision: https://reviews.llvm.org/D34783 llvm-svn: 306775
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGBuiltin.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index a6451b7fc3c..2a6e92e7f3c 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -9372,6 +9372,16 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_grow_memory, X->getType());
return Builder.CreateCall(Callee, X);
}
+ case WebAssembly::BI__builtin_wasm_throw: {
+ Value *Tag = EmitScalarExpr(E->getArg(0));
+ Value *Obj = EmitScalarExpr(E->getArg(1));
+ Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_throw);
+ return Builder.CreateCall(Callee, {Tag, Obj});
+ }
+ case WebAssembly::BI__builtin_wasm_rethrow: {
+ Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow);
+ return Builder.CreateCall(Callee);
+ }
default:
return nullptr;
OpenPOWER on IntegriCloud