diff options
| author | Camille Mougey <commial@gmail.com> | 2018-07-09 12:59:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-09 12:59:26 +0200 |
| commit | 17d48de1951c81fc8b5b4184713a971537747227 (patch) | |
| tree | d6f36c57d1e6d60a24b29234054178b30f2a6f0e /miasm2/core/graph.py | |
| parent | 89cb925f74a29f1ab6dc2dc2b2d68c4f6a9d4158 (diff) | |
| parent | 953676d831c314282a9e113f5617ca7a90b09be6 (diff) | |
| download | miasm-17d48de1951c81fc8b5b4184713a971537747227.tar.gz miasm-17d48de1951c81fc8b5b4184713a971537747227.zip | |
Merge pull request #713 from serpilliere/ssa_transform
Ssa transform
Diffstat (limited to 'miasm2/core/graph.py')
| -rw-r--r-- | miasm2/core/graph.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py index d88f8721..d35148b1 100644 --- a/miasm2/core/graph.py +++ b/miasm2/core/graph.py @@ -339,6 +339,22 @@ class DiGraph(object): self.successors_iter, self.predecessors_iter) + + + + def compute_dominator_tree(self, head): + """ + Computes the dominator tree of a graph + :param head: head of graph + :return: DiGraph + """ + idoms = self.compute_immediate_dominators(head) + dominator_tree = DiGraph() + for node in idoms: + dominator_tree.add_edge(idoms[node], node) + + return dominator_tree + @staticmethod def _walk_generic_dominator(node, gen_dominators, succ_cb): """Generic algorithm to return an iterator of the ordered list of |