summaryrefslogtreecommitdiff
path: root/src/ir/branch-utils.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-04-05 17:25:06 -0700
committerGitHub <noreply@github.com>2024-04-06 00:25:06 +0000
commit98f08effb18a94618ef12f25134c289836fc316e (patch)
treec54d719fb8baf25f6d9dd26bf34e3349834d0c95 /src/ir/branch-utils.h
parente862d5c8bb886a5a4dd13ff1559c376ecfde66b2 (diff)
downloadbinaryen-98f08effb18a94618ef12f25134c289836fc316e.tar.gz
binaryen-98f08effb18a94618ef12f25134c289836fc316e.tar.bz2
binaryen-98f08effb18a94618ef12f25134c289836fc316e.zip
[NFC] Refactor Heap2Local logic (#6473)
Separate out an EscapeAnalyzer class that does the escape analysis, and a Struct2Local one that does the optimization. Also make a few things const here to be safer.
Diffstat (limited to 'src/ir/branch-utils.h')
-rw-r--r--src/ir/branch-utils.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h
index f7b024e78..be3f7f7a8 100644
--- a/src/ir/branch-utils.h
+++ b/src/ir/branch-utils.h
@@ -419,10 +419,14 @@ struct BranchTargets {
// Gets the expression that defines this branch target, i.e., where we branch
// to if we branch to that name.
- Expression* getTarget(Name name) { return inner.targets[name]; }
+ Expression* getTarget(Name name) const {
+ auto iter = inner.targets.find(name);
+ assert(iter != inner.targets.end());
+ return iter->second;
+ }
// Gets the expressions branching to a target.
- std::unordered_set<Expression*> getBranches(Name name) {
+ std::unordered_set<Expression*> getBranches(Name name) const {
auto iter = inner.branches.find(name);
if (iter != inner.branches.end()) {
return iter->second;