diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-28 18:15:33 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-07 09:55:58 -0700 |
commit | d58adf43956c65615c9cd8d6c2f4c2a3cceff8bb (patch) | |
tree | ec30ccb497799ff31d68ac76dc0b485f55fd24a9 /src/asm2wasm.h | |
parent | fd0160dafa25699404c1603adfcf965c75115854 (diff) | |
download | binaryen-d58adf43956c65615c9cd8d6c2f4c2a3cceff8bb.tar.gz binaryen-d58adf43956c65615c9cd8d6c2f4c2a3cceff8bb.tar.bz2 binaryen-d58adf43956c65615c9cd8d6c2f4c2a3cceff8bb.zip |
support HEAP8[x | 0| notation in asm2wasm
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r-- | src/asm2wasm.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 0cb9b8dbe..059e51c59 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -1819,7 +1819,9 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { // if there is a shift, we can just look through it, etc. processUnshifted = [&](Ref ptr, unsigned bytes) { auto shifts = bytesToShift(bytes); - if (ptr[0] == BINARY && ptr[1] == RSHIFT && ptr[3][0] == NUM && ptr[3][1]->getInteger() == shifts) { + // HEAP?[addr >> ?], or HEAP8[x | 0] + if ((ptr[0] == BINARY && ptr[1] == RSHIFT && ptr[3][0] == NUM && ptr[3][1]->getInteger() == shifts) || + (bytes == 1 && ptr[0] == BINARY && ptr[1] == OR && ptr[3][0] == NUM && ptr[3][1]->getInteger() == 0)) { return process(ptr[2]); // look through it } else if (ptr[0] == NUM) { // constant, apply a shift (e.g. HEAP32[1] is address 4) |