diff options
author | Sam Clegg <sbc@chromium.org> | 2020-09-22 17:00:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 17:00:48 -0700 |
commit | fd15ea4e8cdadcaadebbf9be1e4c4f554e7a678d (patch) | |
tree | d8fabe37ce359d327bb719ed383fff3aae5d20bb /src/passes/PostEmscripten.cpp | |
parent | b867a54c92e36b5a53bb1c2d97c043bb6173a3af (diff) | |
download | binaryen-fd15ea4e8cdadcaadebbf9be1e4c4f554e7a678d.tar.gz binaryen-fd15ea4e8cdadcaadebbf9be1e4c4f554e7a678d.tar.bz2 binaryen-fd15ea4e8cdadcaadebbf9be1e4c4f554e7a678d.zip |
Remove unused stack-pointer and emscripten-sbrk-ptr pass args from PostEmscripten (#3161)
These were removed completely from the emscripten side in #12057
Diffstat (limited to 'src/passes/PostEmscripten.cpp')
-rw-r--r-- | src/passes/PostEmscripten.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp index aa6c90977..0c7521afc 100644 --- a/src/passes/PostEmscripten.cpp +++ b/src/passes/PostEmscripten.cpp @@ -78,58 +78,6 @@ struct OptimizeCalls : public WalkerPass<PostWalker<OptimizeCalls>> { struct PostEmscripten : public Pass { void run(PassRunner* runner, Module* module) override { - // Apply the stack pointer, if it was provided. This is needed here - // because the emscripten JS compiler can add static data allocations that - // come before the stack. - auto stackPtrStr = - runner->options.getArgumentOrDefault("stack-pointer", ""); - if (stackPtrStr != "") { - Global* stackPointer = getStackPointerGlobal(*module); - BYN_TRACE("stack_pointer: " << stackPtrStr << "\n"); - if (stackPointer && !stackPointer->imported()) { - auto stackPtr = std::stoi(stackPtrStr); - auto oldValue = stackPointer->init->cast<Const>()->value; - BYN_TRACE("updating __stack_pointer: " << oldValue.geti32() << " -> " - << stackPtr << "\n"); - stackPointer->init = Builder(*module).makeConst(int32_t(stackPtr)); - } - } - - // Apply the sbrk ptr, if it was provided. - auto sbrkPtrStr = - runner->options.getArgumentOrDefault("emscripten-sbrk-ptr", ""); - if (sbrkPtrStr != "") { - auto sbrkPtr = std::stoi(sbrkPtrStr); - ImportInfo imports(*module); - auto* func = imports.getImportedFunction(ENV, "emscripten_get_sbrk_ptr"); - if (func) { - Builder builder(*module); - func->body = builder.makeConst(int32_t(sbrkPtr)); - func->module = func->base = Name(); - } - // Apply the sbrk ptr value, if it was provided. This lets emscripten set - // up sbrk entirely in wasm, without depending on the JS side to init - // anything; this is necessary for standalone wasm mode, in which we do - // not have any JS. Otherwise, the JS would set this value during - // startup. - auto sbrkValStr = - runner->options.getArgumentOrDefault("emscripten-sbrk-val", ""); - if (sbrkValStr != "") { - uint32_t sbrkVal = std::stoi(sbrkValStr); - auto end = sbrkPtr + sizeof(sbrkVal); - // Flatten memory to make it simple to write to. Later passes can - // re-optimize it. - MemoryUtils::ensureExists(module->memory); - if (!MemoryUtils::flatten(module->memory, end, module)) { - Fatal() << "cannot apply sbrk-val since memory is not flattenable\n"; - } - auto& segment = module->memory.segments[0]; - assert(segment.offset->cast<Const>()->value.geti32() == 0); - assert(end <= segment.data.size()); - memcpy(segment.data.data() + sbrkPtr, &sbrkVal, sizeof(sbrkVal)); - } - } - // Optimize imports optimizeImports(runner, module); |