diff options
author | Heejin Ahn <aheejin@gmail.com> | 2018-11-14 02:46:21 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2018-11-14 02:46:21 +0000 |
commit | da419bdb5e3e167ea90c6923660059f35fa17d67 (patch) | |
tree | 0264ae56ecdddf59399c2b355e1dee8eeffafb63 /llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | |
parent | 6a3c279d1cdcd4205a233952b4bacd5941cd355e (diff) | |
download | bcm5719-llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.tar.gz bcm5719-llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.zip |
[WebAssembly] Add support for the event section
Summary:
This adds support for the 'event section' specified in the exception
handling proposal. (This was named 'exception section' first, but later
renamed to 'event section' to take possibilities of other kinds of
events into consideration. But currently we only store exception info in
this section.)
The event section is added between the global section and the export
section. This is for ease of validation per request of the V8 team.
This patch:
- Creates the event symbol type, which is a weak symbol
- Makes 'throw' instruction take the event symbol '__cpp_exception'
- Adds relocation support for events
- Adds WasmObjectWriter / WasmObjectFile (Reader) support
- Adds obj2yaml / yaml2obj support
- Adds '.eventtype' printing support
Reviewers: dschuff, sbc100, aardappel
Subscribers: jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D54096
llvm-svn: 346825
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 1e21ab92b62..66fa91bd4d9 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -79,11 +79,12 @@ WebAssemblyTargetStreamer *WebAssemblyAsmPrinter::getTargetStreamer() { void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { for (auto &It : OutContext.getSymbols()) { - // Emit a .globaltype declaration. + // Emit a .globaltype and .eventtype declaration. auto Sym = cast<MCSymbolWasm>(It.getValue()); - if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_GLOBAL) { + if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_GLOBAL) getTargetStreamer()->emitGlobalType(Sym); - } + else if (Sym->getType() == wasm::WASM_SYMBOL_TYPE_EVENT) + getTargetStreamer()->emitEventType(Sym); } for (const auto &F : M) { |