summaryrefslogtreecommitdiff
path: root/src/ast_utils.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-12-27 21:42:44 -0500
committerGitHub <noreply@github.com>2016-12-27 21:42:44 -0500
commit575d695762f545e1c2784595d9c926488062f383 (patch)
tree5f18013a7cb2fa39c7a62aa11b2753e86725477c /src/ast_utils.h
parente5704f392404b1f69d762217b89e3b8736277f08 (diff)
parent97968a879d0b55baccb5f72627fca84a6a015356 (diff)
downloadbinaryen-575d695762f545e1c2784595d9c926488062f383.tar.gz
binaryen-575d695762f545e1c2784595d9c926488062f383.tar.bz2
binaryen-575d695762f545e1c2784595d9c926488062f383.zip
Merge pull request #859 from WebAssembly/linking
Dynamic linking
Diffstat (limited to 'src/ast_utils.h')
-rw-r--r--src/ast_utils.h28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h
index 1a5b2c83f..159762d0b 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