summaryrefslogtreecommitdiff
path: root/src/wasm-stack.h
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-02-27 20:08:06 -0800
committerGitHub <noreply@github.com>2020-02-27 20:08:06 -0800
commit1f682f4323cb6b7d81dabccb0b989e6e542da7ce (patch)
tree6e8b23a20c485cf41fb083b89118f12e27b88fad /src/wasm-stack.h
parentf0834cc1aa293f779005d11c39cd2874be9510f2 (diff)
downloadbinaryen-1f682f4323cb6b7d81dabccb0b989e6e542da7ce.tar.gz
binaryen-1f682f4323cb6b7d81dabccb0b989e6e542da7ce.tar.bz2
binaryen-1f682f4323cb6b7d81dabccb0b989e6e542da7ce.zip
Generalize binary writing for tuples (#2670)
Updates `BinaryInstWriter::mapLocalsAndEmitHeader` so it no longer hardcodes each possible local type. Also adds a new inner loop over the elements of any local tuple type in the IR. Updates the map from IR local indices to binary indices to be additionally keyed on the index within a tuple type. Since we do not generate tuple types yet, this additional index is hardcoded to zero everywhere it is used for now. A later PR adding tuple creation operations will extend this functionality and add tests.
Diffstat (limited to 'src/wasm-stack.h')
-rw-r--r--src/wasm-stack.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wasm-stack.h b/src/wasm-stack.h
index 863bbbf51..b42ae1253 100644
--- a/src/wasm-stack.h
+++ b/src/wasm-stack.h
@@ -166,8 +166,8 @@ private:
// type => number of locals of that type in the compact form
std::map<Type, size_t> numLocalsByType;
- // local index => index in compact form of [all int32s][all int64s]etc
- std::map<Index, size_t> mappedLocals;
+ // (local index, tuple index) => binary local index
+ std::map<std::pair<Index, Index>, size_t> mappedLocals;
};
// Takes binaryen IR and converts it to something else (binary or stack IR)