summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-26 20:24:35 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-26 20:24:35 -0800
commita7bfbd7ab12aca7d1592e04165c3d0ec00c962e8 (patch)
tree3405cd3de6471e4c934c6e3c4b71776df25af720
parent05d212cb44ec58c83f714338fb9c5089373a581e (diff)
downloadbinaryen-a7bfbd7ab12aca7d1592e04165c3d0ec00c962e8.tar.gz
binaryen-a7bfbd7ab12aca7d1592e04165c3d0ec00c962e8.tar.bz2
binaryen-a7bfbd7ab12aca7d1592e04165c3d0ec00c962e8.zip
wasm2asm progress
-rw-r--r--src/wasm2asm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index cdccd680d..4785f7322 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -570,6 +570,17 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) {
return ValueBuilder::makeAssign(ret, value);
}
void visitConst(Const *curr) override {
+ switch (curr->type) {
+ case i32: return ValueBuilder::makeInt(curr->value.i32);
+ // TODO: i64. statementize?
+ case f32: {
+ Ref ret = ValueBuilder:makeCall(MATH_FROUND);
+ ret[2]->push_back(ValueBuilder::makeDouble(curr->value.f32));
+ return ret;
+ }
+ case f64: return ValueBuilder::makeDouble(curr->value.f64);
+ default: abort();
+ }
}
void visitUnary(Unary *curr) override {
}