summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm2asm.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index 6edc8fd82..dc7f5c93e 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -755,6 +755,9 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) {
// normal load
assert(curr->bytes == curr->align); // TODO: unaligned
Ref ptr = visit(curr->ptr, EXPRESSION_RESULT);
+ if (curr->offset) {
+ ptr = makeAsmCoercion(ValueBuilder::makeBinary(ptr, PLUS, ValueBuilder::makeNum(curr->offset)), ASM_INT);
+ }
Ref ret;
switch (curr->type) {
case i32: {
@@ -791,6 +794,9 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) {
// normal store
assert(curr->bytes == curr->align); // TODO: unaligned
Ref ptr = visit(curr->ptr, EXPRESSION_RESULT);
+ if (curr->offset) {
+ ptr = makeAsmCoercion(ValueBuilder::makeBinary(ptr, PLUS, ValueBuilder::makeNum(curr->offset)), ASM_INT);
+ }
Ref value = visit(curr->value, EXPRESSION_RESULT);
Ref ret;
switch (curr->type) {