summaryrefslogtreecommitdiff
path: root/src/ir/possible-contents.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-09-18 15:55:43 -0700
committerGitHub <noreply@github.com>2024-09-18 15:55:43 -0700
commit5e4a4bae6544eda7d6e5be923bd1086921ffcb1b (patch)
tree4bc7cf991eb4f4709fcdaf1df33ba5f5ff8fce09 /src/ir/possible-contents.h
parentb381a8c82030c2be3d1605d6f2854098f039f617 (diff)
downloadbinaryen-5e4a4bae6544eda7d6e5be923bd1086921ffcb1b.tar.gz
binaryen-5e4a4bae6544eda7d6e5be923bd1086921ffcb1b.tar.bz2
binaryen-5e4a4bae6544eda7d6e5be923bd1086921ffcb1b.zip
[NFC + bugfix] Remove BreakTargetLocation from GUFA (#6956)
Before, a br would send its value to a BreakTargetLocation. That would then be linked to the target: { br's value } => BreakTargetLocation(target name) => { location of target } This PR skips the middle: { br's value } => { location of target } It just connects breaks directly to the targets. We can do that if we keep a map of the targets as we go. This is 2% faster as well as simplifies the code, as an NFC refactoring. But it also fixes a bug: we have handling on ExpressionLocation that filters values as they come in (they must accord with the expression's type). We were not doing that on BreakTargetLocation, leading to an assert. Removing BreakTargetLocation entirely is easier and better than adding filtering logic for it. Fixes #6955
Diffstat (limited to 'src/ir/possible-contents.h')
-rw-r--r--src/ir/possible-contents.h23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/ir/possible-contents.h b/src/ir/possible-contents.h
index 945d59d26..21f5ecb45 100644
--- a/src/ir/possible-contents.h
+++ b/src/ir/possible-contents.h
@@ -402,21 +402,6 @@ struct ResultLocation {
}
};
-// The location of a break target in a function, identified by its name.
-struct BreakTargetLocation {
- Function* func;
- Name target;
- // As in ExpressionLocation, the index inside the tuple, or 0 if not a tuple.
- // That is, if the branch target has a tuple type, then each branch to that
- // location sends a tuple, and we'll have a separate BreakTargetLocation for
- // each, indexed by the index in the tuple that the branch sends.
- Index tupleIndex;
- bool operator==(const BreakTargetLocation& other) const {
- return func == other.func && target == other.target &&
- tupleIndex == other.tupleIndex;
- }
-};
-
// The location of a global in the module.
struct GlobalLocation {
Name name;
@@ -523,7 +508,6 @@ using Location = std::variant<ExpressionLocation,
ParamLocation,
LocalLocation,
ResultLocation,
- BreakTargetLocation,
GlobalLocation,
SignatureParamLocation,
SignatureResultLocation,
@@ -577,13 +561,6 @@ template<> struct hash<wasm::ResultLocation> {
}
};
-template<> struct hash<wasm::BreakTargetLocation> {
- size_t operator()(const wasm::BreakTargetLocation& loc) const {
- return std::hash<std::tuple<size_t, wasm::Name, wasm::Index>>{}(
- {size_t(loc.func), loc.target, loc.tupleIndex});
- }
-};
-
template<> struct hash<wasm::GlobalLocation> {
size_t operator()(const wasm::GlobalLocation& loc) const {
return std::hash<wasm::Name>{}(loc.name);