diff options
author | Alon Zakai <azakai@google.com> | 2023-11-13 17:01:07 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 17:01:07 -0800 |
commit | 53e6e86d1e1d56dd39159fcfcefd9513c0f97079 (patch) | |
tree | b1b66872b45b8bd7b2faecf2106634e93a1e34f7 /src/ir/possible-contents.h | |
parent | c0d19024c7b11ccb30d452d81d3c32252d6bc924 (diff) | |
download | binaryen-53e6e86d1e1d56dd39159fcfcefd9513c0f97079.tar.gz binaryen-53e6e86d1e1d56dd39159fcfcefd9513c0f97079.tar.bz2 binaryen-53e6e86d1e1d56dd39159fcfcefd9513c0f97079.zip |
[NFC] Add LocalLocation for future use (#6105)
This is not needed in GUFA as it tracks local values precisely (each set is connected to
the gets that actually read from it), but in a future PR it will be useful to track local
values per index (each set is connected to all gets for that index, i.e., each local index
is a single "location").
Diffstat (limited to 'src/ir/possible-contents.h')
-rw-r--r-- | src/ir/possible-contents.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ir/possible-contents.h b/src/ir/possible-contents.h index 2fd6c39c7..2773c1d31 100644 --- a/src/ir/possible-contents.h +++ b/src/ir/possible-contents.h @@ -380,6 +380,15 @@ struct ParamLocation { } }; +// The location of a value in a local. +struct LocalLocation { + Function* func; + Index index; + bool operator==(const LocalLocation& other) const { + return func == other.func && index == other.index; + } +}; + // The location of one of the results of a function. struct ResultLocation { Function* func; @@ -494,6 +503,7 @@ struct ConeReadLocation { // have. using Location = std::variant<ExpressionLocation, ParamLocation, + LocalLocation, ResultLocation, BreakTargetLocation, GlobalLocation, @@ -534,6 +544,13 @@ template<> struct hash<wasm::ParamLocation> { } }; +template<> struct hash<wasm::LocalLocation> { + size_t operator()(const wasm::LocalLocation& loc) const { + return std::hash<std::pair<size_t, wasm::Index>>{}( + {size_t(loc.func), loc.index}); + } +}; + template<> struct hash<wasm::ResultLocation> { size_t operator()(const wasm::ResultLocation& loc) const { return std::hash<std::pair<size_t, wasm::Index>>{}( |