summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjgravelle-google <jgravelle@google.com>2017-06-05 09:34:15 -0700
committerGitHub <noreply@github.com>2017-06-05 09:34:15 -0700
commit3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e (patch)
tree17ff1b4155b6ce4c01c7911e20a406df910bec3f
parent4eb81f6cf14b02e77f84f6a5a89d926d4eac535f (diff)
downloadbinaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.tar.gz
binaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.tar.bz2
binaryen-3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e.zip
S2wasm runtime funcs (#1027)
* Generate stackSave function in s2wasm * Generate stackAlloc in s2wasm * Generate stackRestore in s2wasm * Update dot_s tests for runtime functions * Add s2wasm check for exporting runtime functions * Fix flake8 for s2wasm.py * Rename wasmBuilder to builder
-rwxr-xr-xscripts/test/s2wasm.py15
-rw-r--r--src/tools/s2wasm.cpp4
-rw-r--r--src/wasm-emscripten.cpp141
-rw-r--r--src/wasm-emscripten.h3
-rw-r--r--src/wasm-linker.cpp5
-rw-r--r--test/dot_s/alias.wast36
-rw-r--r--test/dot_s/alternate-lcomm.wast36
-rw-r--r--test/dot_s/asm_const.wast36
-rw-r--r--test/dot_s/basics.wast36
-rw-r--r--test/dot_s/bcp-1.wast36
-rw-r--r--test/dot_s/data-offset-folding.wast36
-rw-r--r--test/dot_s/debug.wast36
-rw-r--r--test/dot_s/dso_handle.wast36
-rw-r--r--test/dot_s/dyncall.wast36
-rw-r--r--test/dot_s/exit.wast36
-rw-r--r--test/dot_s/export_malloc_free.wast36
-rw-r--r--test/dot_s/fix_em_ehsjlj_names.wast36
-rw-r--r--test/dot_s/function-data-sections.wast36
-rw-r--r--test/dot_s/globals.wast36
-rw-r--r--test/dot_s/hostFinalize.wast36
-rw-r--r--test/dot_s/indidx.wast36
-rw-r--r--test/dot_s/indirect-import.wast36
-rw-r--r--test/dot_s/initializers.wast36
-rw-r--r--test/dot_s/lcomm-in-text-segment.wast36
-rw-r--r--test/dot_s/local_align.wast36
-rw-r--r--test/dot_s/macClangMetaData.wast36
-rw-r--r--test/dot_s/memops.wast36
-rw-r--r--test/dot_s/minimal.wast36
-rw-r--r--test/dot_s/permute.wast36
-rw-r--r--test/dot_s/relocation.wast36
-rw-r--r--test/dot_s/return.wast36
-rw-r--r--test/dot_s/start_main0.wast36
-rw-r--r--test/dot_s/start_main2.wast36
-rw-r--r--test/dot_s/symbolic-offset.wast36
-rw-r--r--test/dot_s/text_before_type.wast36
-rw-r--r--test/dot_s/unreachable_blocks.wast36
-rw-r--r--test/dot_s/visibilities.wast36
-rw-r--r--test/llvm_autogenerated/byval.wast36
-rw-r--r--test/llvm_autogenerated/call.wast36
-rw-r--r--test/llvm_autogenerated/cfg-stackify.wast36
-rw-r--r--test/llvm_autogenerated/comparisons_f32.wast36
-rw-r--r--test/llvm_autogenerated/comparisons_f64.wast36
-rw-r--r--test/llvm_autogenerated/comparisons_i32.wast36
-rw-r--r--test/llvm_autogenerated/comparisons_i64.wast36
-rw-r--r--test/llvm_autogenerated/conv.wast36
-rw-r--r--test/llvm_autogenerated/copysign-casts.wast36
-rw-r--r--test/llvm_autogenerated/cpus.wast36
-rw-r--r--test/llvm_autogenerated/dead-vreg.wast36
-rw-r--r--test/llvm_autogenerated/divrem-constant.wast36
-rw-r--r--test/llvm_autogenerated/f32.wast36
-rw-r--r--test/llvm_autogenerated/f64.wast36
-rw-r--r--test/llvm_autogenerated/fast-isel-noreg.wast36
-rw-r--r--test/llvm_autogenerated/fast-isel.wast36
-rw-r--r--test/llvm_autogenerated/frem.wast36
-rw-r--r--test/llvm_autogenerated/func.wast36
-rw-r--r--test/llvm_autogenerated/global.wast36
-rw-r--r--test/llvm_autogenerated/globl.wast36
-rw-r--r--test/llvm_autogenerated/i128.wast36
-rw-r--r--test/llvm_autogenerated/i32-load-store-alignment.wast36
-rw-r--r--test/llvm_autogenerated/i32.wast36
-rw-r--r--test/llvm_autogenerated/i64-load-store-alignment.wast36
-rw-r--r--test/llvm_autogenerated/i64.wast36
-rw-r--r--test/llvm_autogenerated/ident.wast36
-rw-r--r--test/llvm_autogenerated/immediates.wast36
-rw-r--r--test/llvm_autogenerated/indirect-import.wast36
-rw-r--r--test/llvm_autogenerated/irreducible-cfg.wast36
-rw-r--r--test/llvm_autogenerated/legalize.wast36
-rw-r--r--test/llvm_autogenerated/load-ext.wast36
-rw-r--r--test/llvm_autogenerated/load-store-i1.wast36
-rw-r--r--test/llvm_autogenerated/load.wast36
-rw-r--r--test/llvm_autogenerated/lower-em-ehsjlj-options.wast36
-rw-r--r--test/llvm_autogenerated/mem-intrinsics.wast36
-rw-r--r--test/llvm_autogenerated/memory-addr32.wast36
-rw-r--r--test/llvm_autogenerated/negative-base-reg.wast36
-rw-r--r--test/llvm_autogenerated/non-executable-stack.wast36
-rw-r--r--test/llvm_autogenerated/offset.wast36
-rw-r--r--test/llvm_autogenerated/phi.wast36
-rw-r--r--test/llvm_autogenerated/reg-stackify.wast36
-rw-r--r--test/llvm_autogenerated/return-int32.wast36
-rw-r--r--test/llvm_autogenerated/return-void.wast36
-rw-r--r--test/llvm_autogenerated/select.wast36
-rw-r--r--test/llvm_autogenerated/signext-zeroext.wast36
-rw-r--r--test/llvm_autogenerated/store-trunc.wast36
-rw-r--r--test/llvm_autogenerated/store.wast36
-rw-r--r--test/llvm_autogenerated/switch.wast36
-rw-r--r--test/llvm_autogenerated/unreachable.wast36
-rw-r--r--test/llvm_autogenerated/unused-argument.wast36
-rw-r--r--test/llvm_autogenerated/userstack.wast36
-rw-r--r--test/llvm_autogenerated/varargs.wast36
89 files changed, 3172 insertions, 20 deletions
diff --git a/scripts/test/s2wasm.py b/scripts/test/s2wasm.py
index bf7c97fbe..e89a65099 100755
--- a/scripts/test/s2wasm.py
+++ b/scripts/test/s2wasm.py
@@ -94,14 +94,21 @@ def test_linker():
# bar should be linked from the archive
fail_if_not_contained(output, '(func $bar')
- # Test exporting memory growth function
+ # Test exporting memory growth function and emscripten runtime functions
cmd = S2WASM + [
os.path.join(options.binaryen_test, 'linker', 'main.s'),
'--emscripten-glue', '--allow-memory-growth']
output = run_command(cmd)
- fail_if_not_contained(
- output, '(export "__growWasmMemory" (func $__growWasmMemory))')
- fail_if_not_contained(output, '(func $__growWasmMemory (param $newSize i32)')
+ expected_funcs = [
+ ('__growWasmMemory', '(param $newSize i32)'),
+ ('stackSave', '(result i32)'),
+ ('stackAlloc', '(param $0 i32) (result i32)'),
+ ('stackRestore', '(param $0 i32)'),
+ ]
+ for name, extra in expected_funcs:
+ space = ' ' if extra else ''
+ fail_if_not_contained(output, '(export "{0}" (func ${0}))'.format(name))
+ fail_if_not_contained(output, '(func ${0}'.format(name + space + extra))
if __name__ == '__main__':
diff --git a/src/tools/s2wasm.cpp b/src/tools/s2wasm.cpp
index 890d74bb4..a35783479 100644
--- a/src/tools/s2wasm.cpp
+++ b/src/tools/s2wasm.cpp
@@ -152,6 +152,10 @@ int main(int argc, const char *argv[]) {
linker.linkArchive(lib);
}
+ if (generateEmscriptenGlue) {
+ emscripten::generateRuntimeFunctions(linker.getOutput());
+ }
+
linker.layout();
std::stringstream meta;
diff --git a/src/wasm-emscripten.cpp b/src/wasm-emscripten.cpp
index 9594b5047..43366e410 100644
--- a/src/wasm-emscripten.cpp
+++ b/src/wasm-emscripten.cpp
@@ -20,6 +20,7 @@
#include "asmjs/shared-constants.h"
#include "shared-constants.h"
#include "wasm-builder.h"
+#include "wasm-linker.h"
#include "wasm-traversal.h"
#include "wasm.h"
@@ -29,24 +30,136 @@ namespace emscripten {
cashew::IString EMSCRIPTEN_ASM_CONST("emscripten_asm_const");
+static constexpr const char* stackPointer = "__stack_pointer";
+
+void addExportedFunction(Module& wasm, Function* function) {
+ wasm.addFunction(function);
+ auto export_ = new Export;
+ export_->name = export_->value = function->name;
+ export_->kind = ExternalKind::Function;
+ wasm.addExport(export_);
+}
+
void generateMemoryGrowthFunction(Module& wasm) {
- Builder wasmBuilder(wasm);
+ Builder builder(wasm);
Name name(GROW_WASM_MEMORY);
std::vector<NameType> params { { NEW_SIZE, i32 } };
- Function* growFunction = wasmBuilder.makeFunction(
+ Function* growFunction = builder.makeFunction(
name, std::move(params), i32, {}
);
- growFunction->body = wasmBuilder.makeHost(
+ growFunction->body = builder.makeHost(
GrowMemory,
Name(),
- { wasmBuilder.makeGetLocal(0, i32) }
+ { builder.makeGetLocal(0, i32) }
);
- wasm.addFunction(growFunction);
- auto export_ = new Export;
- export_->name = export_->value = name;
- export_->kind = ExternalKind::Function;
- wasm.addExport(export_);
+ addExportedFunction(wasm, growFunction);
+}
+
+void addStackPointerRelocation(LinkerObject& linker, uint32_t* data) {
+ linker.addRelocation(new LinkerObject::Relocation(
+ LinkerObject::Relocation::kData,
+ data,
+ Name(stackPointer),
+ 0
+ ));
+}
+
+Load* generateLoadStackPointer(Builder& builder, LinkerObject& linker) {
+ Load* load = builder.makeLoad(
+ /* bytes =*/ 4,
+ /* signed =*/ false,
+ /* offset =*/ 0,
+ /* align =*/ 4,
+ /* ptr =*/ builder.makeConst(Literal(0)),
+ /* type =*/ i32
+ );
+ addStackPointerRelocation(linker, &load->offset.addr);
+ return load;
+}
+
+Store* generateStoreStackPointer(Builder& builder,
+ LinkerObject& linker,
+ Expression* value) {
+ Store* store = builder.makeStore(
+ /* bytes =*/ 4,
+ /* offset =*/ 0,
+ /* align =*/ 4,
+ /* ptr =*/ builder.makeConst(Literal(0)),
+ /* value =*/ value,
+ /* type =*/ i32
+ );
+ addStackPointerRelocation(linker, &store->offset.addr);
+ return store;
+}
+
+void generateStackSaveFunction(LinkerObject& linker) {
+ Module& wasm = linker.wasm;
+ Builder builder(wasm);
+ Name name("stackSave");
+ std::vector<NameType> params { };
+ Function* function = builder.makeFunction(
+ name, std::move(params), i32, {}
+ );
+
+ function->body = generateLoadStackPointer(builder, linker);
+
+ addExportedFunction(wasm, function);
+}
+
+void generateStackAllocFunction(LinkerObject& linker) {
+ Module& wasm = linker.wasm;
+ Builder builder(wasm);
+ Name name("stackAlloc");
+ std::vector<NameType> params { { "0", i32 } };
+ Function* function = builder.makeFunction(
+ name, std::move(params), i32, { { "1", i32 } }
+ );
+ Load* loadStack = generateLoadStackPointer(builder, linker);
+ SetLocal* setStackLocal = builder.makeSetLocal(1, loadStack);
+ GetLocal* getStackLocal = builder.makeGetLocal(1, i32);
+ GetLocal* getSizeArg = builder.makeGetLocal(0, i32);
+ Binary* add = builder.makeBinary(AddInt32, getStackLocal, getSizeArg);
+ const static uint32_t bitAlignment = 16;
+ const static uint32_t bitMask = bitAlignment - 1;
+ Const* addConst = builder.makeConst(Literal(bitMask));
+ Binary* maskedAdd = builder.makeBinary(
+ AndInt32,
+ builder.makeBinary(AddInt32, add, addConst),
+ builder.makeConst(Literal(~bitMask))
+ );
+ Store* storeStack = generateStoreStackPointer(builder, linker, maskedAdd);
+
+ Block* block = builder.makeBlock();
+ block->list.push_back(setStackLocal);
+ block->list.push_back(storeStack);
+ block->list.push_back(getStackLocal);
+ block->type = i32;
+ function->body = block;
+
+ addExportedFunction(wasm, function);
+}
+
+void generateStackRestoreFunction(LinkerObject& linker) {
+ Module& wasm = linker.wasm;
+ Builder builder(wasm);
+ Name name("stackRestore");
+ std::vector<NameType> params { { "0", i32 } };
+ Function* function = builder.makeFunction(
+ name, std::move(params), none, {}
+ );
+ GetLocal* getArg = builder.makeGetLocal(0, i32);
+ Store* store = generateStoreStackPointer(builder, linker, getArg);
+
+ function->body = store;
+
+ addExportedFunction(wasm, function);
+}
+
+void generateRuntimeFunctions(LinkerObject& linker) {
+ generateStackSaveFunction(linker);
+ generateStackAllocFunction(linker);
+ generateStackRestoreFunction(linker);
}
static bool hasI64ResultOrParam(FunctionType* ft) {
@@ -74,7 +187,7 @@ std::vector<Function*> makeDynCallThunks(Module& wasm, std::vector<Name> const&
std::vector<Function*> generatedFunctions;
std::unordered_set<std::string> sigs;
- Builder wasmBuilder(wasm);
+ Builder builder(wasm);
for (const auto& indirectFunc : tableSegmentData) {
std::string sig(getSig(wasm.getFunction(indirectFunc)));
auto* funcType = ensureFunctionType(sig, &wasm);
@@ -84,13 +197,13 @@ std::vector<Function*> makeDynCallThunks(Module& wasm, std::vector<Name> const&
params.emplace_back("fptr", i32); // function pointer param
int p = 0;
for (const auto& ty : funcType->params) params.emplace_back(std::to_string(p++), ty);
- Function* f = wasmBuilder.makeFunction(std::string("dynCall_") + sig, std::move(params), funcType->result, {});
- Expression* fptr = wasmBuilder.makeGetLocal(0, i32);
+ Function* f = builder.makeFunction(std::string("dynCall_") + sig, std::move(params), funcType->result, {});
+ Expression* fptr = builder.makeGetLocal(0, i32);
std::vector<Expression*> args;
for (unsigned i = 0; i < funcType->params.size(); ++i) {
- args.push_back(wasmBuilder.makeGetLocal(i + 1, funcType->params[i]));
+ args.push_back(builder.makeGetLocal(i + 1, funcType->params[i]));
}
- Expression* call = wasmBuilder.makeCallIndirect(funcType, fptr, args);
+ Expression* call = builder.makeCallIndirect(funcType, fptr, args);
f->body = call;
wasm.addFunction(f);
generatedFunctions.push_back(f);
diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h
index f9d2ae38c..7400a8b0f 100644
--- a/src/wasm-emscripten.h
+++ b/src/wasm-emscripten.h
@@ -21,8 +21,11 @@
namespace wasm {
+class LinkerObject;
+
namespace emscripten {
+void generateRuntimeFunctions(LinkerObject& linker);
void generateMemoryGrowthFunction(Module&);
// Create thunks for use with emscripten Runtime.dynCall. Creates one for each
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp
index f50ecab7a..7d1c35d1c 100644
--- a/src/wasm-linker.cpp
+++ b/src/wasm-linker.cpp
@@ -27,6 +27,7 @@ using namespace wasm;
// Name of the dummy function to prevent erroneous nullptr comparisons.
static constexpr const char* dummyFunction = "__wasm_nullptr";
+static constexpr const char* stackPointer = "__stack_pointer";
void Linker::placeStackPointer(Address stackAllocation) {
// ensure this is the first allocation
@@ -34,7 +35,7 @@ void Linker::placeStackPointer(Address stackAllocation) {
const Address pointerSize = 4;
// Unconditionally allocate space for the stack pointer. Emscripten
// allocates the stack itself, and initializes the stack pointer itself.
- out.addStatic(pointerSize, pointerSize, "__stack_pointer");
+ out.addStatic(pointerSize, pointerSize, stackPointer);
if (stackAllocation) {
// If we are allocating the stack, set up a relocation to initialize the
// stack pointer to point to one past-the-end of the stack allocation.
@@ -44,7 +45,7 @@ void Linker::placeStackPointer(Address stackAllocation) {
LinkerObject::Relocation::kData, (uint32_t*)&raw[0], ".stack", stackAllocation);
out.addRelocation(relocation);
assert(out.wasm.memory.segments.empty());
- out.addSegment("__stack_pointer", raw);
+ out.addSegment(stackPointer, raw);
}
}
diff --git a/test/dot_s/alias.wast b/test/dot_s/alias.wast
index f30d62788..7e439bccb 100644
--- a/test/dot_s/alias.wast
+++ b/test/dot_s/alias.wast
@@ -4,6 +4,9 @@
(table 2 2 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $__exit)
(data (i32.const 16) "\d2\04\00\00\00\00\00\00)\t\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "__exit" (func $__exit))
(export "__needs_exit" (func $__needs_exit))
(export "dynCall_v" (func $dynCall_v))
@@ -25,6 +28,39 @@
(i32.const 1)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/alternate-lcomm.wast b/test/dot_s/alternate-lcomm.wast
index 14cc39739..625760209 100644
--- a/test/dot_s/alternate-lcomm.wast
+++ b/test/dot_s/alternate-lcomm.wast
@@ -1,5 +1,41 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 16, "initializers": [] }
diff --git a/test/dot_s/asm_const.wast b/test/dot_s/asm_const.wast
index 2580a905c..3e9ffce65 100644
--- a/test/dot_s/asm_const.wast
+++ b/test/dot_s/asm_const.wast
@@ -4,6 +4,9 @@
(import "env" "emscripten_asm_const_v" (func $emscripten_asm_const_v (param i32)))
(table 0 anyfunc)
(data (i32.const 16) "{ Module.print(\"hello, world!\"); }\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(call $emscripten_asm_const_v
@@ -13,5 +16,38 @@
(i32.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world!\"); }", ["v"]]},"staticBump": 51, "initializers": [] }
diff --git a/test/dot_s/basics.wast b/test/dot_s/basics.wast
index 6b8a8ac57..abdbaaa5a 100644
--- a/test/dot_s/basics.wast
+++ b/test/dot_s/basics.wast
@@ -9,6 +9,9 @@
(data (i32.const 16) "hello, world!\n\00")
(data (i32.const 32) "vcq")
(data (i32.const 48) "\16\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "dynCall_iii" (func $dynCall_iii))
(func $main (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@@ -94,6 +97,39 @@
)
(get_local $0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/bcp-1.wast b/test/dot_s/bcp-1.wast
index d765dceef..1c35fdf76 100644
--- a/test/dot_s/bcp-1.wast
+++ b/test/dot_s/bcp-1.wast
@@ -15,6 +15,9 @@
(data (i32.const 72) "\0f\00\00\00\10\00\00\00\11\00\00\00")
(data (i32.const 96) "hi\00")
(data (i32.const 100) "\00\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "bad0" (func $bad0))
(export "bad1" (func $bad1))
(export "bad2" (func $bad2))
@@ -306,6 +309,39 @@
(call $abort)
(unreachable)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/data-offset-folding.wast b/test/dot_s/data-offset-folding.wast
index 262349a2d..074c8681f 100644
--- a/test/dot_s/data-offset-folding.wast
+++ b/test/dot_s/data-offset-folding.wast
@@ -3,5 +3,41 @@
(table 0 anyfunc)
(data (i32.const 12) "\00\00\00\00")
(data (i32.const 416) "`\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 420, "initializers": [] }
diff --git a/test/dot_s/debug.wast b/test/dot_s/debug.wast
index 0cc0ae20c..57079919a 100644
--- a/test/dot_s/debug.wast
+++ b/test/dot_s/debug.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "fib" (func $fib))
(func $fib (param $0 i32) (result i32)
(local $1 i32)
@@ -53,5 +56,38 @@
(get_local $4)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/dso_handle.wast b/test/dot_s/dso_handle.wast
index 57bdf4de8..cdfc998df 100644
--- a/test/dot_s/dso_handle.wast
+++ b/test/dot_s/dso_handle.wast
@@ -1,11 +1,47 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(return
(i32.const 8)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/dyncall.wast b/test/dot_s/dyncall.wast
index 8b9fc6446..19f6e00bc 100644
--- a/test/dot_s/dyncall.wast
+++ b/test/dot_s/dyncall.wast
@@ -7,6 +7,9 @@
(import "env" "memory" (memory $0 1))
(table 6 6 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $i $i_f $vd $ffjjdi $vd2)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "i" (func $i))
(export "i_f" (func $i_f))
(export "vd" (func $vd))
@@ -47,6 +50,39 @@
)
(i32.const 0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/exit.wast b/test/dot_s/exit.wast
index 905eff7e6..4f585d13c 100644
--- a/test/dot_s/exit.wast
+++ b/test/dot_s/exit.wast
@@ -3,6 +3,9 @@
(import "env" "exit" (func $exit (param i32)))
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(local $0 i32)
@@ -11,5 +14,38 @@
)
(unreachable)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/export_malloc_free.wast b/test/dot_s/export_malloc_free.wast
index 34256b611..7d601ff21 100644
--- a/test/dot_s/export_malloc_free.wast
+++ b/test/dot_s/export_malloc_free.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "malloc" (func $malloc))
(export "free" (func $free))
@@ -23,5 +26,38 @@
(func $not_a_malloc (param $0 i32) (param $1 i32) (result i32)
(i32.const 0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/fix_em_ehsjlj_names.wast b/test/dot_s/fix_em_ehsjlj_names.wast
index 6fb9c0610..429e23494 100644
--- a/test/dot_s/fix_em_ehsjlj_names.wast
+++ b/test/dot_s/fix_em_ehsjlj_names.wast
@@ -15,6 +15,9 @@
(import "env" "memory" (memory $0 1))
(table 5 5 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $_Z5func1v $_Z5func2iii $_Z5func3fd $_Z5func4P8mystructS_)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "dynCall_v" (func $dynCall_v))
(export "dynCall_iiii" (func $dynCall_iiii))
@@ -73,6 +76,39 @@
)
(i32.const 0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/function-data-sections.wast b/test/dot_s/function-data-sections.wast
index 690d9e56c..64a7a67d4 100644
--- a/test/dot_s/function-data-sections.wast
+++ b/test/dot_s/function-data-sections.wast
@@ -4,6 +4,9 @@
(data (i32.const 12) "\00\00\00\00")
(data (i32.const 16) "\01\00\00\00")
(data (i32.const 20) "33\13@")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "foo" (func $foo))
(export "bar" (func $bar))
(export "qux" (func $qux))
@@ -23,5 +26,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 24, "initializers": [] }
diff --git a/test/dot_s/globals.wast b/test/dot_s/globals.wast
index 5e68227c6..2fe329a8c 100644
--- a/test/dot_s/globals.wast
+++ b/test/dot_s/globals.wast
@@ -5,6 +5,9 @@
(data (i32.const 12) "\11\00\00\00")
(data (i32.const 16) "\0c\00\00\00")
(data (i32.const 20) "\0e\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "globals" (func $globals))
(export "import_globals" (func $import_globals))
(export "globals_offset" (func $globals_offset))
@@ -77,5 +80,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 24, "initializers": [] }
diff --git a/test/dot_s/hostFinalize.wast b/test/dot_s/hostFinalize.wast
index b81764e4f..79ba6be0e 100644
--- a/test/dot_s/hostFinalize.wast
+++ b/test/dot_s/hostFinalize.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(func $_main
(drop
(grow_memory
@@ -11,5 +14,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/indidx.wast b/test/dot_s/indidx.wast
index ab194ffa7..07e636621 100644
--- a/test/dot_s/indidx.wast
+++ b/test/dot_s/indidx.wast
@@ -6,6 +6,9 @@
(table 5 5 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $c $b $d $a)
(data (i32.const 16) "\04\00\00\00\02\00\00\00\01\00\00\00\03\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "dynCall_i" (func $dynCall_i))
(func $a (type $FUNCSIG$i) (result i32)
@@ -48,6 +51,39 @@
(unreachable)
(unreachable)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/indirect-import.wast b/test/dot_s/indirect-import.wast
index f6784229d..8df5e85a5 100644
--- a/test/dot_s/indirect-import.wast
+++ b/test/dot_s/indirect-import.wast
@@ -13,6 +13,9 @@
(import "env" "extern_sret" (func $extern_sret (param i32)))
(table 7 7 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $__importThunk_extern_fd $__importThunk_extern_vj $__importThunk_extern_v $__importThunk_extern_ijidf $__importThunk_extern_struct $__importThunk_extern_sret)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "bar" (func $bar))
(export "baz" (func $baz))
(export "dynCall_fd" (func $dynCall_fd))
@@ -85,6 +88,39 @@
(func $baz (result i32)
(i32.const 3)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/dot_s/initializers.wast b/test/dot_s/initializers.wast
index 32973651b..1c51f433f 100644
--- a/test/dot_s/initializers.wast
+++ b/test/dot_s/initializers.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "f1" (func $f1))
(export "f2" (func $f2))
@@ -15,5 +18,38 @@
(func $f2
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": ["main", "f1", "f2"] }
diff --git a/test/dot_s/lcomm-in-text-segment.wast b/test/dot_s/lcomm-in-text-segment.wast
index 81d9ddea4..bbd7d8c48 100644
--- a/test/dot_s/lcomm-in-text-segment.wast
+++ b/test/dot_s/lcomm-in-text-segment.wast
@@ -2,5 +2,41 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 20) "\10\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 24, "initializers": [] }
diff --git a/test/dot_s/local_align.wast b/test/dot_s/local_align.wast
index e7e7bbc4f..1991656fd 100644
--- a/test/dot_s/local_align.wast
+++ b/test/dot_s/local_align.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $foo (param $0 i32)
)
@@ -10,5 +13,38 @@
)
(i32.const 0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 172, "initializers": [] }
diff --git a/test/dot_s/macClangMetaData.wast b/test/dot_s/macClangMetaData.wast
index ab5b85d73..2dd3ff2d2 100644
--- a/test/dot_s/macClangMetaData.wast
+++ b/test/dot_s/macClangMetaData.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 16) "Hello, World!\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (param $0 i32) (param $1 i32) (result i32)
(drop
@@ -15,5 +18,38 @@
(i32.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 30, "initializers": [] }
diff --git a/test/dot_s/memops.wast b/test/dot_s/memops.wast
index af039822a..5cf90fcc7 100644
--- a/test/dot_s/memops.wast
+++ b/test/dot_s/memops.wast
@@ -4,6 +4,9 @@
(import "env" "emscripten_asm_const_v" (func $emscripten_asm_const_v (param i32)))
(table 0 anyfunc)
(data (i32.const 16) "{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $_Z6reporti (param $0 i32)
(i32.store
@@ -205,5 +208,38 @@
(i32.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }", ["v"]]},"staticBump": 67, "initializers": [] }
diff --git a/test/dot_s/minimal.wast b/test/dot_s/minimal.wast
index 06cc8e73c..05c2aafc0 100644
--- a/test/dot_s/minimal.wast
+++ b/test/dot_s/minimal.wast
@@ -1,11 +1,47 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(return
(i32.const 5)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/permute.wast b/test/dot_s/permute.wast
index 5b6b56629..9aa6a1d9b 100644
--- a/test/dot_s/permute.wast
+++ b/test/dot_s/permute.wast
@@ -2,5 +2,41 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 16) "hE?\8ds\0e7\db[g\8f\955it\c4k\0b\e2\ef\bcld\e0\fd\8c\9e\86&~\d8\94\89+\c8\a4\c2\f2\fb\12\1cej\d99\b7\b3W\c6w\af\ae\caM>\92ub\96\84\b6\b0N\ec;q\11\f7\bf\e31\e6\a7\90\fc\03\e4\aa\d7\cc- \15\83DH\80r\fa\01X\eb:_\00A\cd\e9o`n\ac(\ad\ba0\dcyS#\f4$\"\82\7f}\8e\f6\93L\'\bb\bdZ\ed4\18\f3\c0\cf\ff\a3\f8\07\05\9c\d3\0f\a0\06m%\\\f9^B<\e7\b1\17\98]\0c\dd\c5\f5p\e5\fezJ\ab,F\a5@\08R\85!\b8\1a\ce\d5\04\nI\a6\d1\9f\8a\c9\a9|\97\9aG\be8Y\8b\c1\1b\d4\ea\b9\19\14\9b\9163\d0\1d\d2\df=C\1f\0dc\e1\c7QUv\02\b5aK\b4\tV\c3x\e8\a1\1e\81\de/{\da\d6Pf\10T\f0)\88\16\ee\a8\9d\f1\cbO*\b2\99\132\87.\a2")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 272, "initializers": [] }
diff --git a/test/dot_s/relocation.wast b/test/dot_s/relocation.wast
index 12c9d7b01..c05180954 100644
--- a/test/dot_s/relocation.wast
+++ b/test/dot_s/relocation.wast
@@ -3,6 +3,9 @@
(table 0 anyfunc)
(data (i32.const 12) "\10\00\00\00")
(data (i32.const 16) "\0c\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(local $0 i32)
@@ -12,5 +15,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 20, "initializers": [] }
diff --git a/test/dot_s/return.wast b/test/dot_s/return.wast
index aee9cf37d..28631d103 100644
--- a/test/dot_s/return.wast
+++ b/test/dot_s/return.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "return_i32" (func $return_i32))
(export "return_void" (func $return_void))
(func $return_i32 (result i32)
@@ -17,5 +20,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/start_main0.wast b/test/dot_s/start_main0.wast
index cd3758321..1ffa0a347 100644
--- a/test/dot_s/start_main0.wast
+++ b/test/dot_s/start_main0.wast
@@ -1,11 +1,47 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "_start" (func $_start))
(start $_start)
(func $main
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $_start
(call $main)
)
diff --git a/test/dot_s/start_main2.wast b/test/dot_s/start_main2.wast
index 6cb7fbf10..1b5a2f50e 100644
--- a/test/dot_s/start_main2.wast
+++ b/test/dot_s/start_main2.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(export "_start" (func $_start))
(start $_start)
@@ -9,6 +12,39 @@
(get_local $0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $_start
(local $0 i32)
(local $1 i32)
diff --git a/test/dot_s/symbolic-offset.wast b/test/dot_s/symbolic-offset.wast
index 0b3b1636f..7ec41fff9 100644
--- a/test/dot_s/symbolic-offset.wast
+++ b/test/dot_s/symbolic-offset.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 12) "\01\00\00\00\00\00\00\00\00\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "f" (func $f))
(func $f (param $0 i32) (param $1 i32)
(i32.store offset=16
@@ -10,5 +13,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 24, "initializers": [] }
diff --git a/test/dot_s/text_before_type.wast b/test/dot_s/text_before_type.wast
index a4e2b15f1..29edaa45d 100644
--- a/test/dot_s/text_before_type.wast
+++ b/test/dot_s/text_before_type.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(call $foo)
@@ -8,5 +11,38 @@
)
(func $foo
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/unreachable_blocks.wast b/test/dot_s/unreachable_blocks.wast
index dbd4a8626..1d0a66c06 100644
--- a/test/dot_s/unreachable_blocks.wast
+++ b/test/dot_s/unreachable_blocks.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(func $unreachable_block_void (result i32)
(block $label$0
)
@@ -86,5 +89,38 @@
(br $label$0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/dot_s/visibilities.wast b/test/dot_s/visibilities.wast
index 47fe62e8c..4cb94d2ce 100644
--- a/test/dot_s/visibilities.wast
+++ b/test/dot_s/visibilities.wast
@@ -1,6 +1,9 @@
(module
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "foo" (func $foo))
(export "bar" (func $bar))
(export "qux" (func $qux))
@@ -13,5 +16,38 @@
(func $qux
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }
diff --git a/test/llvm_autogenerated/byval.wast b/test/llvm_autogenerated/byval.wast
index 6fcc9970f..cd9b39334 100644
--- a/test/llvm_autogenerated/byval.wast
+++ b/test/llvm_autogenerated/byval.wast
@@ -12,6 +12,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "byval_arg" (func $byval_arg))
(export "byval_arg_align8" (func $byval_arg_align8))
(export "byval_arg_double" (func $byval_arg_double))
@@ -179,5 +182,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/call.wast b/test/llvm_autogenerated/call.wast
index 248c2cba3..1f3cbb253 100644
--- a/test/llvm_autogenerated/call.wast
+++ b/test/llvm_autogenerated/call.wast
@@ -17,6 +17,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "call_i32_nullary" (func $call_i32_nullary))
(export "call_i64_nullary" (func $call_i64_nullary))
(export "call_float_nullary" (func $call_float_nullary))
@@ -112,5 +115,38 @@
(call $void_nullary)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/cfg-stackify.wast b/test/llvm_autogenerated/cfg-stackify.wast
index e7eaa9956..32f3cdc7f 100644
--- a/test/llvm_autogenerated/cfg-stackify.wast
+++ b/test/llvm_autogenerated/cfg-stackify.wast
@@ -9,6 +9,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "test0" (func $test0))
(export "test1" (func $test1))
(export "test2" (func $test2))
@@ -960,5 +963,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/comparisons_f32.wast b/test/llvm_autogenerated/comparisons_f32.wast
index 0f35a36dd..0711f7bd4 100644
--- a/test/llvm_autogenerated/comparisons_f32.wast
+++ b/test/llvm_autogenerated/comparisons_f32.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "ord_f32" (func $ord_f32))
(export "uno_f32" (func $uno_f32))
(export "oeq_f32" (func $oeq_f32))
@@ -212,5 +215,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/comparisons_f64.wast b/test/llvm_autogenerated/comparisons_f64.wast
index b220186a1..2b256e57c 100644
--- a/test/llvm_autogenerated/comparisons_f64.wast
+++ b/test/llvm_autogenerated/comparisons_f64.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "ord_f64" (func $ord_f64))
(export "uno_f64" (func $uno_f64))
(export "oeq_f64" (func $oeq_f64))
@@ -212,5 +215,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/comparisons_i32.wast b/test/llvm_autogenerated/comparisons_i32.wast
index 7a9972b3e..4cac9bd73 100644
--- a/test/llvm_autogenerated/comparisons_i32.wast
+++ b/test/llvm_autogenerated/comparisons_i32.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "eq_i32" (func $eq_i32))
(export "ne_i32" (func $ne_i32))
(export "slt_i32" (func $slt_i32))
@@ -92,5 +95,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/comparisons_i64.wast b/test/llvm_autogenerated/comparisons_i64.wast
index f87d71dd1..213181dfb 100644
--- a/test/llvm_autogenerated/comparisons_i64.wast
+++ b/test/llvm_autogenerated/comparisons_i64.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "eq_i64" (func $eq_i64))
(export "ne_i64" (func $ne_i64))
(export "slt_i64" (func $slt_i64))
@@ -92,5 +95,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/conv.wast b/test/llvm_autogenerated/conv.wast
index 94d8cd5a9..f07ebecca 100644
--- a/test/llvm_autogenerated/conv.wast
+++ b/test/llvm_autogenerated/conv.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "i32_wrap_i64" (func $i32_wrap_i64))
(export "i64_extend_s_i32" (func $i64_extend_s_i32))
(export "i64_extend_u_i32" (func $i64_extend_u_i32))
@@ -213,5 +216,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/copysign-casts.wast b/test/llvm_autogenerated/copysign-casts.wast
index c8d19595f..66cd3da05 100644
--- a/test/llvm_autogenerated/copysign-casts.wast
+++ b/test/llvm_autogenerated/copysign-casts.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "fold_promote" (func $fold_promote))
(export "fold_demote" (func $fold_demote))
(func $fold_promote (param $0 f64) (param $1 f32) (result f64)
@@ -22,5 +25,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/cpus.wast b/test/llvm_autogenerated/cpus.wast
index 04961906a..5d9578354 100644
--- a/test/llvm_autogenerated/cpus.wast
+++ b/test/llvm_autogenerated/cpus.wast
@@ -2,9 +2,45 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "f" (func $f))
(func $f (param $0 i32) (result i32)
(get_local $0)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/dead-vreg.wast b/test/llvm_autogenerated/dead-vreg.wast
index 1d3f6a490..1f8161302 100644
--- a/test/llvm_autogenerated/dead-vreg.wast
+++ b/test/llvm_autogenerated/dead-vreg.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "foo" (func $foo))
(func $foo (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
@@ -93,5 +96,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/divrem-constant.wast b/test/llvm_autogenerated/divrem-constant.wast
index 9445ed6d6..25a673cef 100644
--- a/test/llvm_autogenerated/divrem-constant.wast
+++ b/test/llvm_autogenerated/divrem-constant.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "test_udiv_2" (func $test_udiv_2))
(export "test_udiv_5" (func $test_udiv_5))
(export "test_sdiv_2" (func $test_sdiv_2))
@@ -58,5 +61,38 @@
(i32.const 5)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/f32.wast b/test/llvm_autogenerated/f32.wast
index 8519a1031..d62e4e046 100644
--- a/test/llvm_autogenerated/f32.wast
+++ b/test/llvm_autogenerated/f32.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "fadd32" (func $fadd32))
(export "fsub32" (func $fsub32))
(export "fmul32" (func $fmul32))
@@ -141,5 +144,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/f64.wast b/test/llvm_autogenerated/f64.wast
index dad747dac..f3bcd3d8f 100644
--- a/test/llvm_autogenerated/f64.wast
+++ b/test/llvm_autogenerated/f64.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "fadd64" (func $fadd64))
(export "fsub64" (func $fsub64))
(export "fmul64" (func $fmul64))
@@ -141,5 +144,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/fast-isel-noreg.wast b/test/llvm_autogenerated/fast-isel-noreg.wast
index 91025736a..82486303b 100644
--- a/test/llvm_autogenerated/fast-isel-noreg.wast
+++ b/test/llvm_autogenerated/fast-isel-noreg.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "a" (func $a))
(export "b" (func $b))
(export "c" (func $c))
@@ -30,5 +33,38 @@
(i32.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/fast-isel.wast b/test/llvm_autogenerated/fast-isel.wast
index 0dd95b2da..9bc1fb44c 100644
--- a/test/llvm_autogenerated/fast-isel.wast
+++ b/test/llvm_autogenerated/fast-isel.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "immediate_f32" (func $immediate_f32))
(export "immediate_f64" (func $immediate_f64))
(export "bitcast_i32_f32" (func $bitcast_i32_f32))
@@ -34,5 +37,38 @@
(get_local $0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/frem.wast b/test/llvm_autogenerated/frem.wast
index 9f0c5363f..31ba4bb50 100644
--- a/test/llvm_autogenerated/frem.wast
+++ b/test/llvm_autogenerated/frem.wast
@@ -6,6 +6,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "frem32" (func $frem32))
(export "frem64" (func $frem64))
(func $frem32 (param $0 f32) (param $1 f32) (result f32)
@@ -24,5 +27,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/func.wast b/test/llvm_autogenerated/func.wast
index a407b9d96..dbd9c39ab 100644
--- a/test/llvm_autogenerated/func.wast
+++ b/test/llvm_autogenerated/func.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "f0" (func $f0))
(export "f1" (func $f1))
(export "f2" (func $f2))
@@ -45,5 +48,38 @@
(func $f5 (result f32)
(unreachable)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/global.wast b/test/llvm_autogenerated/global.wast
index eaa881d36..ccf0da15f 100644
--- a/test/llvm_autogenerated/global.wast
+++ b/test/llvm_autogenerated/global.wast
@@ -16,6 +16,9 @@
(data (i32.const 136) "\00\00\00\00\00\00\00@")
(data (i32.const 656) "\e0\00\00\00")
(data (i32.const 1192) "\a4\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "foo" (func $foo))
(export "call_memcpy" (func $call_memcpy))
(func $foo (result i32)
@@ -34,5 +37,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 2224, "initializers": [] }
diff --git a/test/llvm_autogenerated/globl.wast b/test/llvm_autogenerated/globl.wast
index 1f0b36266..b3c547bdb 100644
--- a/test/llvm_autogenerated/globl.wast
+++ b/test/llvm_autogenerated/globl.wast
@@ -2,8 +2,44 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "foo" (func $foo))
(func $foo
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/i128.wast b/test/llvm_autogenerated/i128.wast
index 70d421414..3cc5c0aae 100644
--- a/test/llvm_autogenerated/i128.wast
+++ b/test/llvm_autogenerated/i128.wast
@@ -12,6 +12,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "add128" (func $add128))
(export "sub128" (func $sub128))
(export "mul128" (func $mul128))
@@ -1005,5 +1008,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/i32-load-store-alignment.wast b/test/llvm_autogenerated/i32-load-store-alignment.wast
index efbeb9126..c084dd3fa 100644
--- a/test/llvm_autogenerated/i32-load-store-alignment.wast
+++ b/test/llvm_autogenerated/i32-load-store-alignment.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "ldi32_a1" (func $ldi32_a1))
(export "ldi32_a2" (func $ldi32_a2))
(export "ldi32_a4" (func $ldi32_a4))
@@ -162,5 +165,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/i32.wast b/test/llvm_autogenerated/i32.wast
index caed4c6b3..2ee13f2c3 100644
--- a/test/llvm_autogenerated/i32.wast
+++ b/test/llvm_autogenerated/i32.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "add32" (func $add32))
(export "sub32" (func $sub32))
(export "mul32" (func $mul32))
@@ -203,5 +206,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/i64-load-store-alignment.wast b/test/llvm_autogenerated/i64-load-store-alignment.wast
index 8e7a4ffb3..5d3d4e963 100644
--- a/test/llvm_autogenerated/i64-load-store-alignment.wast
+++ b/test/llvm_autogenerated/i64-load-store-alignment.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "ldi64_a1" (func $ldi64_a1))
(export "ldi64_a2" (func $ldi64_a2))
(export "ldi64_a4" (func $ldi64_a4))
@@ -242,5 +245,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/i64.wast b/test/llvm_autogenerated/i64.wast
index 9424c9e45..2ffbfc964 100644
--- a/test/llvm_autogenerated/i64.wast
+++ b/test/llvm_autogenerated/i64.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "add64" (func $add64))
(export "sub64" (func $sub64))
(export "mul64" (func $mul64))
@@ -203,5 +206,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/ident.wast b/test/llvm_autogenerated/ident.wast
index 6b7e830a9..071206e3b 100644
--- a/test/llvm_autogenerated/ident.wast
+++ b/test/llvm_autogenerated/ident.wast
@@ -2,5 +2,41 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/immediates.wast b/test/llvm_autogenerated/immediates.wast
index 6a17a90fd..9b4715433 100644
--- a/test/llvm_autogenerated/immediates.wast
+++ b/test/llvm_autogenerated/immediates.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "zero_i32" (func $zero_i32))
(export "one_i32" (func $one_i32))
(export "max_i32" (func $max_i32))
@@ -170,5 +173,38 @@
(f64.const -nan:0x2bcdef0123456)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/indirect-import.wast b/test/llvm_autogenerated/indirect-import.wast
index 0bb6825b3..f8269e80a 100644
--- a/test/llvm_autogenerated/indirect-import.wast
+++ b/test/llvm_autogenerated/indirect-import.wast
@@ -15,6 +15,9 @@
(table 7 7 anyfunc)
(elem (i32.const 0) $__wasm_nullptr $__importThunk_extern_fd $__importThunk_extern_vj $__importThunk_extern_v $__importThunk_extern_ijidf $__importThunk_extern_struct $__importThunk_extern_sret)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "bar" (func $bar))
(export "dynCall_fd" (func $dynCall_fd))
(export "dynCall_v" (func $dynCall_v))
@@ -85,6 +88,39 @@
(get_local $0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/llvm_autogenerated/irreducible-cfg.wast b/test/llvm_autogenerated/irreducible-cfg.wast
index fe74e05a5..e01218f1b 100644
--- a/test/llvm_autogenerated/irreducible-cfg.wast
+++ b/test/llvm_autogenerated/irreducible-cfg.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "test0" (func $test0))
(export "test1" (func $test1))
(func $test0 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
@@ -252,5 +255,38 @@
(br $label$2)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/legalize.wast b/test/llvm_autogenerated/legalize.wast
index 0ebf4a7e5..b3306d424 100644
--- a/test/llvm_autogenerated/legalize.wast
+++ b/test/llvm_autogenerated/legalize.wast
@@ -5,6 +5,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "shl_i3" (func $shl_i3))
(export "shl_i53" (func $shl_i53))
(export "sext_in_reg_i32_i64" (func $sext_in_reg_i32_i64))
@@ -2416,5 +2419,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/load-ext.wast b/test/llvm_autogenerated/load-ext.wast
index 1836e860b..768d5e539 100644
--- a/test/llvm_autogenerated/load-ext.wast
+++ b/test/llvm_autogenerated/load-ext.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "sext_i8_i32" (func $sext_i8_i32))
(export "zext_i8_i32" (func $zext_i8_i32))
(export "sext_i16_i32" (func $sext_i16_i32))
@@ -82,5 +85,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/load-store-i1.wast b/test/llvm_autogenerated/load-store-i1.wast
index bf3587a27..94dc05594 100644
--- a/test/llvm_autogenerated/load-store-i1.wast
+++ b/test/llvm_autogenerated/load-store-i1.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "load_u_i1_i32" (func $load_u_i1_i32))
(export "load_s_i1_i32" (func $load_s_i1_i32))
(export "load_u_i1_i64" (func $load_u_i1_i64))
@@ -68,5 +71,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/load.wast b/test/llvm_autogenerated/load.wast
index 2a1e1e671..20b3bcf68 100644
--- a/test/llvm_autogenerated/load.wast
+++ b/test/llvm_autogenerated/load.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "ldi32" (func $ldi32))
(export "ldi64" (func $ldi64))
(export "ldf32" (func $ldf32))
@@ -34,5 +37,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/lower-em-ehsjlj-options.wast b/test/llvm_autogenerated/lower-em-ehsjlj-options.wast
index 10ba8f663..becf166b9 100644
--- a/test/llvm_autogenerated/lower-em-ehsjlj-options.wast
+++ b/test/llvm_autogenerated/lower-em-ehsjlj-options.wast
@@ -18,6 +18,9 @@
(data (i32.const 12) "\00\00\00\00")
(data (i32.const 16) "\00\00\00\00")
(data (i32.const 20) "\00\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "exception" (func $exception))
(export "setjmp_longjmp" (func $setjmp_longjmp))
(export "setThrew" (func $setThrew))
@@ -105,6 +108,39 @@
(get_local $0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
(func $__wasm_nullptr (type $FUNCSIG$v)
(unreachable)
)
diff --git a/test/llvm_autogenerated/mem-intrinsics.wast b/test/llvm_autogenerated/mem-intrinsics.wast
index 96ac13c9a..8707407bd 100644
--- a/test/llvm_autogenerated/mem-intrinsics.wast
+++ b/test/llvm_autogenerated/mem-intrinsics.wast
@@ -10,6 +10,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "copy_yes" (func $copy_yes))
(export "copy_no" (func $copy_no))
(export "move_yes" (func $move_yes))
@@ -181,5 +184,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/memory-addr32.wast b/test/llvm_autogenerated/memory-addr32.wast
index 1c82ed8fe..b81880a6e 100644
--- a/test/llvm_autogenerated/memory-addr32.wast
+++ b/test/llvm_autogenerated/memory-addr32.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "current_memory" (func $current_memory))
(export "grow_memory" (func $grow_memory))
(func $current_memory (result i32)
@@ -17,5 +20,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/negative-base-reg.wast b/test/llvm_autogenerated/negative-base-reg.wast
index 0788e2d22..b3f17724c 100644
--- a/test/llvm_autogenerated/negative-base-reg.wast
+++ b/test/llvm_autogenerated/negative-base-reg.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\90\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "main" (func $main))
(func $main (result i32)
(local $0 i32)
@@ -29,5 +32,38 @@
(i32.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1168, "initializers": [] }
diff --git a/test/llvm_autogenerated/non-executable-stack.wast b/test/llvm_autogenerated/non-executable-stack.wast
index 6b7e830a9..071206e3b 100644
--- a/test/llvm_autogenerated/non-executable-stack.wast
+++ b/test/llvm_autogenerated/non-executable-stack.wast
@@ -2,5 +2,41 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/offset.wast b/test/llvm_autogenerated/offset.wast
index 0df9d5a8d..1d6e903a7 100644
--- a/test/llvm_autogenerated/offset.wast
+++ b/test/llvm_autogenerated/offset.wast
@@ -3,6 +3,9 @@
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
(data (i32.const 12) "\00\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "load_i32_with_folded_offset" (func $load_i32_with_folded_offset))
(export "load_i32_with_folded_gep_offset" (func $load_i32_with_folded_gep_offset))
(export "load_i32_with_unfolded_gep_negative_offset" (func $load_i32_with_unfolded_gep_negative_offset))
@@ -321,5 +324,38 @@
(i64.const 0)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/phi.wast b/test/llvm_autogenerated/phi.wast
index d1159327c..3ed5e4409 100644
--- a/test/llvm_autogenerated/phi.wast
+++ b/test/llvm_autogenerated/phi.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "test0" (func $test0))
(export "test1" (func $test1))
(func $test0 (param $0 i32) (result i32)
@@ -63,5 +66,38 @@
(get_local $1)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/reg-stackify.wast b/test/llvm_autogenerated/reg-stackify.wast
index f7426aac9..4917dacc2 100644
--- a/test/llvm_autogenerated/reg-stackify.wast
+++ b/test/llvm_autogenerated/reg-stackify.wast
@@ -21,6 +21,9 @@
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
(data (i32.const 12) "\00\00\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "no0" (func $no0))
(export "no1" (func $no1))
(export "yes0" (func $yes0))
@@ -592,5 +595,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/return-int32.wast b/test/llvm_autogenerated/return-int32.wast
index a68f57b42..658133704 100644
--- a/test/llvm_autogenerated/return-int32.wast
+++ b/test/llvm_autogenerated/return-int32.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "return_i32" (func $return_i32))
(export "return_i32_twice" (func $return_i32_twice))
(func $return_i32 (param $0 i32) (result i32)
@@ -28,5 +31,38 @@
)
(i32.const 3)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/return-void.wast b/test/llvm_autogenerated/return-void.wast
index 15205ea82..09da984a6 100644
--- a/test/llvm_autogenerated/return-void.wast
+++ b/test/llvm_autogenerated/return-void.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "return_void" (func $return_void))
(export "return_void_twice" (func $return_void_twice))
(func $return_void
@@ -24,5 +27,38 @@
(i32.const 1)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/select.wast b/test/llvm_autogenerated/select.wast
index 8e7423710..f49a78c8a 100644
--- a/test/llvm_autogenerated/select.wast
+++ b/test/llvm_autogenerated/select.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "select_i32_bool" (func $select_i32_bool))
(export "select_i32_eq" (func $select_i32_eq))
(export "select_i32_ne" (func $select_i32_ne))
@@ -122,5 +125,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/signext-zeroext.wast b/test/llvm_autogenerated/signext-zeroext.wast
index 5d467fc69..383af3908 100644
--- a/test/llvm_autogenerated/signext-zeroext.wast
+++ b/test/llvm_autogenerated/signext-zeroext.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "z2s_func" (func $z2s_func))
(export "s2z_func" (func $s2z_func))
(export "z2s_call" (func $z2s_call))
@@ -54,5 +57,38 @@
)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/store-trunc.wast b/test/llvm_autogenerated/store-trunc.wast
index 25ead21d6..b33660666 100644
--- a/test/llvm_autogenerated/store-trunc.wast
+++ b/test/llvm_autogenerated/store-trunc.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "trunc_i8_i32" (func $trunc_i8_i32))
(export "trunc_i16_i32" (func $trunc_i16_i32))
(export "trunc_i8_i64" (func $trunc_i8_i64))
@@ -37,5 +40,38 @@
(get_local $1)
)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/store.wast b/test/llvm_autogenerated/store.wast
index 0fffd3ac3..f1496dd1f 100644
--- a/test/llvm_autogenerated/store.wast
+++ b/test/llvm_autogenerated/store.wast
@@ -2,6 +2,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "sti32" (func $sti32))
(export "sti64" (func $sti64))
(export "stf32" (func $stf32))
@@ -34,5 +37,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/switch.wast b/test/llvm_autogenerated/switch.wast
index 43de19833..43dbf2b99 100644
--- a/test/llvm_autogenerated/switch.wast
+++ b/test/llvm_autogenerated/switch.wast
@@ -9,6 +9,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "bar32" (func $bar32))
(export "bar64" (func $bar64))
(func $bar32 (param $0 i32)
@@ -87,5 +90,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/unreachable.wast b/test/llvm_autogenerated/unreachable.wast
index 1b6805d4a..fc775b2c2 100644
--- a/test/llvm_autogenerated/unreachable.wast
+++ b/test/llvm_autogenerated/unreachable.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "f1" (func $f1))
(export "f2" (func $f2))
(export "f3" (func $f3))
@@ -17,5 +20,38 @@
(func $f3
(unreachable)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/unused-argument.wast b/test/llvm_autogenerated/unused-argument.wast
index c3c8a8c91..2cfb37f47 100644
--- a/test/llvm_autogenerated/unused-argument.wast
+++ b/test/llvm_autogenerated/unused-argument.wast
@@ -4,6 +4,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "unused_first" (func $unused_first))
(export "unused_second" (func $unused_second))
(export "call_something" (func $call_something))
@@ -23,5 +26,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/userstack.wast b/test/llvm_autogenerated/userstack.wast
index 226596c8c..be1ada7a6 100644
--- a/test/llvm_autogenerated/userstack.wast
+++ b/test/llvm_autogenerated/userstack.wast
@@ -6,6 +6,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "alloca32" (func $alloca32))
(export "alloca3264" (func $alloca3264))
(export "allocarray" (func $allocarray))
@@ -455,5 +458,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }
diff --git a/test/llvm_autogenerated/varargs.wast b/test/llvm_autogenerated/varargs.wast
index 6e7742b16..96fc57caf 100644
--- a/test/llvm_autogenerated/varargs.wast
+++ b/test/llvm_autogenerated/varargs.wast
@@ -5,6 +5,9 @@
(import "env" "memory" (memory $0 1))
(table 0 anyfunc)
(data (i32.const 4) "\10\04\00\00")
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
(export "start" (func $start))
(export "end" (func $end))
(export "copy" (func $copy))
@@ -184,5 +187,38 @@
)
(return)
)
+ (func $stackSave (result i32)
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (func $stackAlloc (param $0 i32) (result i32)
+ (local $1 i32)
+ (set_local $1
+ (i32.load offset=4
+ (i32.const 0)
+ )
+ )
+ (i32.store offset=4
+ (i32.const 0)
+ (i32.and
+ (i32.add
+ (i32.add
+ (get_local $1)
+ (get_local $0)
+ )
+ (i32.const 15)
+ )
+ (i32.const -16)
+ )
+ )
+ (get_local $1)
+ )
+ (func $stackRestore (param $0 i32)
+ (i32.store offset=4
+ (i32.const 0)
+ (get_local $0)
+ )
+ )
)
;; METADATA: { "asmConsts": {},"staticBump": 1040, "initializers": [] }