diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-12 09:33:32 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-12 09:33:32 -0500 |
commit | 722bb6a82070fa8bd3a263f478b3d2779eee7f1d (patch) | |
tree | 4660341e1971cccac8048376b27f6ea8a2127b5b /src/s2wasm.h | |
parent | 54e70e4b391d87482024efcf0829e967e46da866 (diff) | |
download | binaryen-722bb6a82070fa8bd3a263f478b3d2779eee7f1d.tar.gz binaryen-722bb6a82070fa8bd3a263f478b3d2779eee7f1d.tar.bz2 binaryen-722bb6a82070fa8bd3a263f478b3d2779eee7f1d.zip |
work on call_indirect in s2wasm
Diffstat (limited to 'src/s2wasm.h')
-rw-r--r-- | src/s2wasm.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 19fd426ac..1d42a08e6 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -5,6 +5,7 @@ #include "wasm.h" #include "parsing.h" +#include "asm_v_wasm.h" namespace wasm { @@ -362,7 +363,7 @@ private: if (match("_import")) { curr = allocator.alloc<CallImport>(); } else if (match("_indirect")) { - curr = allocator.alloc<CallImport>(); + curr = allocator.alloc<CallIndirect>(); } else { curr = allocator.alloc<Call>(); } @@ -384,6 +385,16 @@ private: } std::reverse(curr->operands.begin(), curr->operands.end()); setOutput(curr, assign); + if (curr->is<CallIndirect>()) { + auto call = curr->dyn_cast<CallIndirect>(); + auto type = allocator.alloc<FunctionType>(); + call->fullType = type; + type->name = cashew::IString((std::string("FUNCSIG_") + getSig(call)).c_str(), false); + // TODO type->result + for (auto operand : call->operands) { + type->params.push_back(operand->type); + } + } } else if (match("block")) { auto curr = allocator.alloc<Block>(); curr->name = getStr(); |