forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306774 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |