Skip to content

Commit

Permalink
Add State::getPath (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
can-leh-emmtrix authored Aug 5, 2024
1 parent 952b417 commit 4ad46d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ir/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,21 @@ bool State::isAsmMode() const {
return getFn().has(FnAttrs::Asm);
}

expr State::getPath(BasicBlock &bb) const {
if (&f.getFirstBB() == &bb)
return true;

auto I = predecessor_data.find(&bb);
if (I == predecessor_data.end())
return false; // Block is unreachable

OrExpr path;
for (auto &[src, data] : I->second) {
path.add(data.path);
}
return std::move(path)();
}

void State::cleanup(const Value &val) {
values.erase(&val);
seen_bbs.clear();
Expand Down
2 changes: 2 additions & 0 deletions ir/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class State {

bool isAsmMode() const;

smt::expr getPath(BasicBlock &bb) const;

// only used by alive-exec to support execution of the same BB multiple times
void cleanup(const Value &val);
void cleanupPredecessorData();
Expand Down

0 comments on commit 4ad46d6

Please sign in to comment.