diff options
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r-- | src/ast_utils.h | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h index f10fb40eb..2565ee24a 100644 --- a/src/ast_utils.h +++ b/src/ast_utils.h @@ -68,34 +68,6 @@ struct BreakSeeker : public PostWalker<BreakSeeker, Visitor<BreakSeeker>> { } }; -// Finds all functions that are reachable via direct calls. - -struct DirectCallGraphAnalyzer : public PostWalker<DirectCallGraphAnalyzer, Visitor<DirectCallGraphAnalyzer>> { - Module *module; - std::vector<Function*> queue; - std::unordered_set<Function*> reachable; - - DirectCallGraphAnalyzer(Module* module, const std::vector<Function*>& root) : module(module) { - for (auto* curr : root) { - queue.push_back(curr); - } - while (queue.size()) { - auto* curr = queue.back(); - queue.pop_back(); - if (reachable.count(curr) == 0) { - reachable.insert(curr); - walk(curr->body); - } - } - } - void visitCall(Call *curr) { - auto* target = module->getFunction(curr->target); - if (reachable.count(target) == 0) { - queue.push_back(target); - } - } -}; - // Look for side effects, including control flow // TODO: optimize |