Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ir/branch-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/ir/parents.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ namespace wasm {
struct Parents {
Parents(Expression* expr) { inner.walk(expr); }

Expression* getParent(Expression* curr) { return inner.parentMap[curr]; }
Expression* getParent(Expression* curr) const {
auto iter = inner.parentMap.find(curr);
if (iter != inner.parentMap.end()) {
return iter->second;
}
return nullptr;
}

private:
struct Inner
Expand Down
Loading