From 5aa642b76845023738e51366f62b2bd6cddbc649 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 3 Jul 2019 22:04:54 +0000 Subject: [PATCH] [WebAssembly] Add option to emit passive segments Summary: Adds `--passive-segments` and `--active-segments` flags to control what kind of segments are emitted. For now the default is always to emit active segments so this is not a breaking change, but in the future the default will be changed to passive segments when shared memory is requested and active segments otherwise. When passive segments are emitted, corresponding memory.init and data.drop instructions are emitted in a `__wasm_init_memory` function that is automatically called at the beginning of `__wasm_call_ctors`. Reviewers: sbc100, aheejin, dschuff Subscribers: azakai, dschuff, jgravelle-google, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59343 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365088 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/BinaryFormat/Wasm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/llvm/BinaryFormat/Wasm.h b/include/llvm/BinaryFormat/Wasm.h index 0f327c188bf..0ff52cbdb33 100644 --- a/include/llvm/BinaryFormat/Wasm.h +++ b/include/llvm/BinaryFormat/Wasm.h @@ -249,6 +249,9 @@ enum : unsigned { WASM_OPCODE_F32_CONST = 0x43, WASM_OPCODE_F64_CONST = 0x44, WASM_OPCODE_I32_ADD = 0x6a, + WASM_OPCODE_MISC_PREFIX = 0xfc, + WASM_OPCODE_MEMORY_INIT = 0x08, + WASM_OPCODE_DATA_DROP = 0x09, }; enum : unsigned { -- 2.40.0