From 98e9e604c7e2e4f928abe8f05691df90cddf09e4 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 15 Nov 2016 21:36:33 -0800 Subject: add a RemoveUnusedModuleElements pass, and make LegalizeJSInterface create TempRet0 if needed (otherwise we might remove it before we use it) --- src/ast_utils.h | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/ast_utils.h') 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> { } }; -// Finds all functions that are reachable via direct calls. - -struct DirectCallGraphAnalyzer : public PostWalker> { - Module *module; - std::vector queue; - std::unordered_set reachable; - - DirectCallGraphAnalyzer(Module* module, const std::vector& 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 -- cgit v1.2.3