about summary refs log tree commit diff stats
path: root/miasm2/core/graph.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2018-07-09 12:59:26 +0200
committerGitHub <noreply@github.com>2018-07-09 12:59:26 +0200
commit17d48de1951c81fc8b5b4184713a971537747227 (patch)
treed6f36c57d1e6d60a24b29234054178b30f2a6f0e /miasm2/core/graph.py
parent89cb925f74a29f1ab6dc2dc2b2d68c4f6a9d4158 (diff)
parent953676d831c314282a9e113f5617ca7a90b09be6 (diff)
downloadmiasm-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.py16
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