about summary refs log tree commit diff stats
path: root/miasm2/core/graph.py
diff options
context:
space:
mode:
authorTim Blazytko <tim.blazytko@rub.de>2018-04-11 10:01:49 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-07-09 12:31:29 +0200
commitbb40c1a13c70d308091724755e00f661470046ee (patch)
tree6a3f0b86c6da63f0812f2548064ce051e9ebc9ba /miasm2/core/graph.py
parent89cb925f74a29f1ab6dc2dc2b2d68c4f6a9d4158 (diff)
downloadmiasm-bb40c1a13c70d308091724755e00f661470046ee.tar.gz
miasm-bb40c1a13c70d308091724755e00f661470046ee.zip
Analysis: Add SSA transformation
Joint work with Niko Schmidt
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