diff options
author | Daniel Wirtz <dcode@dcode.io> | 2017-08-24 18:31:15 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-08-24 09:31:15 -0700 |
commit | b07fafcebebab82dba46012256edc6445862cfce (patch) | |
tree | d819f110386bfe6ce3dab4aee6daeefc7f1a81ca /src/wasm2asm.h | |
parent | ac8ee6c9e7c43c80d8fb2c8166fd73f23e212069 (diff) | |
download | binaryen-b07fafcebebab82dba46012256edc6445862cfce.tar.gz binaryen-b07fafcebebab82dba46012256edc6445862cfce.tar.bz2 binaryen-b07fafcebebab82dba46012256edc6445862cfce.zip |
Initial asm.js output for binaryen-c / binaryen.js (#1136)
* Added BinaryenModulePrintAsmjs (using wasm2asm) + Module#emitAsmjs JS binding
Diffstat (limited to 'src/wasm2asm.h')
-rw-r--r-- | src/wasm2asm.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 7ba9d5175..7a760da26 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -523,7 +523,7 @@ Ref Wasm2AsmBuilder::processFunction(Function* func) { temps[i32] = temps[f32] = temps[f64] = 0; // arguments for (Index i = 0; i < func->getNumParams(); i++) { - IString name = fromName(func->getLocalName(i)); + IString name = fromName(func->getLocalNameOrGeneric(i)); ValueBuilder::appendArgumentToFunction(ret, name); ret[3]->push_back( ValueBuilder::makeStatement( @@ -559,7 +559,7 @@ Ref Wasm2AsmBuilder::processFunction(Function* func) { } // vars, including new temp vars for (Index i = func->getVarIndexBase(); i < func->getNumLocals(); i++) { - ValueBuilder::appendToVar(theVar, fromName(func->getLocalName(i)), makeAsmCoercedZero(wasmToAsmType(func->getLocalType(i)))); + ValueBuilder::appendToVar(theVar, fromName(func->getLocalNameOrGeneric(i)), makeAsmCoercedZero(wasmToAsmType(func->getLocalType(i)))); } if (theVar[1]->size() == 0) { ret[3]->splice(theVarIndex, 1); @@ -928,12 +928,12 @@ Ref Wasm2AsmBuilder::processFunctionBody(Function* func, IString result) { return makeStatementizedCall(curr->operands, ret, theCall, result, curr->type); } Ref visitGetLocal(GetLocal *curr) { - return ValueBuilder::makeName(fromName(func->getLocalName(curr->index))); + return ValueBuilder::makeName(fromName(func->getLocalNameOrGeneric(curr->index))); } Ref visitSetLocal(SetLocal *curr) { if (!isStatement(curr)) { return ValueBuilder::makeBinary( - ValueBuilder::makeName(fromName(func->getLocalName(curr->index))), + ValueBuilder::makeName(fromName(func->getLocalNameOrGeneric(curr->index))), SET, visit(curr->value, EXPRESSION_RESULT)); } ScopedTemp temp(curr->type, parent, func, result); // if result was provided, our child can just assign there. otherwise, allocate a temp for it to assign to. @@ -941,7 +941,7 @@ Ref Wasm2AsmBuilder::processFunctionBody(Function* func, IString result) { // the output was assigned to result, so we can just assign it to our target ret[1]->push_back(ValueBuilder::makeStatement( ValueBuilder::makeBinary( - ValueBuilder::makeName(fromName(func->getLocalName(curr->index))), + ValueBuilder::makeName(fromName(func->getLocalNameOrGeneric(curr->index))), SET, temp.getAstName()))); return ret; } |