Skip to content

Commit f41f67d

Browse files
committedAug 1, 2016
[WebAssembly] Add asm.js-style exception handling support
Summary: This patch includes asm.js-style exception handling support for WebAssembly. The WebAssembly MVP does not have any support for unwinding or non-local control flow. In order to support C++ exceptions, emscripten currently uses JavaScript exceptions along with some support code (written in JavaScript) that is bundled by emscripten with the generated code. This scheme lowers exception-related instructions for wasm such that wasm modules can be compatible with emscripten's existing scheme and share the support code. Patch by Heejin Ahn Differential Revision: https://reviews.llvm.org/D22958 llvm-svn: 277391
1 parent 4a7130a commit f41f67d

File tree

5 files changed

+620
-0
lines changed

5 files changed

+620
-0
lines changed
 

‎llvm/lib/Target/WebAssembly/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ add_llvm_target(WebAssemblyCodeGen
2020
WebAssemblyISelLowering.cpp
2121
WebAssemblyInstrInfo.cpp
2222
WebAssemblyLowerBrUnless.cpp
23+
WebAssemblyLowerEmscriptenExceptions.cpp
2324
WebAssemblyMachineFunctionInfo.cpp
2425
WebAssemblyMCInstLower.cpp
2526
WebAssemblyOptimizeLiveIntervals.cpp

‎llvm/lib/Target/WebAssembly/WebAssembly.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@
1616
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
1717
#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLY_H
1818

19+
#include "llvm/PassRegistry.h"
1920
#include "llvm/Support/CodeGen.h"
2021

2122
namespace llvm {
2223

2324
class WebAssemblyTargetMachine;
25+
class ModulePass;
2426
class FunctionPass;
2527

2628
// LLVM IR passes.
29+
ModulePass *createWebAssemblyLowerEmscriptenExceptions();
30+
void initializeWebAssemblyLowerEmscriptenExceptionsPass(PassRegistry &);
2731
FunctionPass *createWebAssemblyOptimizeReturned();
2832

2933
// ISel and immediate followup passes.

0 commit comments

Comments
 (0)
Please sign in to comment.