about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorGAJaloyan <georges-axel.jaloyan@ens.fr>2018-10-26 10:19:17 +0200
committerGAJaloyan <georges-axel.jaloyan@ens.fr>2018-10-26 10:19:17 +0200
commit9c55d1268df6e5b44f9eddf505a0623f9ab29e08 (patch)
treedb6c9037d94b98976fb4354cbcb5e4402d081aac
parent1a9a56806a654654824cc79d0d215e09ac1b85ac (diff)
downloadmiasm-9c55d1268df6e5b44f9eddf505a0623f9ab29e08.tar.gz
miasm-9c55d1268df6e5b44f9eddf505a0623f9ab29e08.zip
adding immediate postdominators computation.
-rw-r--r--miasm2/core/graph.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/miasm2/core/graph.py b/miasm2/core/graph.py
index a817c024..35bcf01d 100644
--- a/miasm2/core/graph.py
+++ b/miasm2/core/graph.py
@@ -456,6 +456,18 @@ class DiGraph(object):
                     break
         return idoms
 
+    def compute_immediate_postdominators(self,tail):
+        """Compute the immediate postdominators of the graph"""
+        postdominators = self.compute_postdominators(tail)
+        ipdoms = {}
+
+        for node in postdominators:
+            for successor in self.walk_postdominators(node, postdominators):
+                if successor in postdominators[node] and node != successor:
+                    ipdoms[node] = successor
+                    break
+        return ipdoms
+
     def compute_dominance_frontier(self, head):
         """
         Compute the dominance frontier of the graph