diff options
Diffstat (limited to 'src/ir/possible-contents.h')
-rw-r--r-- | src/ir/possible-contents.h | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/ir/possible-contents.h b/src/ir/possible-contents.h index 863a0dbab..a6a27062a 100644 --- a/src/ir/possible-contents.h +++ b/src/ir/possible-contents.h @@ -286,26 +286,21 @@ struct ExpressionLocation { } }; -// The location of one of the results of a function. -struct ResultLocation { +// The location of one of the parameters of a function. +struct ParamLocation { Function* func; Index index; - bool operator==(const ResultLocation& other) const { + bool operator==(const ParamLocation& other) const { return func == other.func && index == other.index; } }; -// The location of one of the locals in a function (either a param or a var). -// TODO: would separating params from vars help? (SSA might be enough) -struct LocalLocation { +// The location of one of the results of a function. +struct ResultLocation { Function* func; - // The index of the local. Index index; - // As in ExpressionLocation, the index inside the tuple, or 0 if not a tuple. - Index tupleIndex; - bool operator==(const LocalLocation& other) const { - return func == other.func && index == other.index && - tupleIndex == other.tupleIndex; + bool operator==(const ResultLocation& other) const { + return func == other.func && index == other.index; } }; @@ -407,8 +402,8 @@ struct ConeReadLocation { // A location is a variant over all the possible flavors of locations that we // have. using Location = std::variant<ExpressionLocation, + ParamLocation, ResultLocation, - LocalLocation, BreakTargetLocation, GlobalLocation, SignatureParamLocation, @@ -441,17 +436,17 @@ template<> struct hash<wasm::ExpressionLocation> { } }; -template<> struct hash<wasm::ResultLocation> { - size_t operator()(const wasm::ResultLocation& loc) const { +template<> struct hash<wasm::ParamLocation> { + size_t operator()(const wasm::ParamLocation& loc) const { return std::hash<std::pair<size_t, wasm::Index>>{}( {size_t(loc.func), loc.index}); } }; -template<> struct hash<wasm::LocalLocation> { - size_t operator()(const wasm::LocalLocation& loc) const { - return std::hash<std::pair<size_t, std::pair<wasm::Index, wasm::Index>>>{}( - {size_t(loc.func), {loc.index, loc.tupleIndex}}); +template<> struct hash<wasm::ResultLocation> { + size_t operator()(const wasm::ResultLocation& loc) const { + return std::hash<std::pair<size_t, wasm::Index>>{}( + {size_t(loc.func), loc.index}); } }; |