about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2018-10-28 22:40:09 +0100
committerGitHub <noreply@github.com>2018-10-28 22:40:09 +0100
commit8276ac5629fdcf3ad885c8e4b9d2d7ed6e1e1d77 (patch)
treedb6c9037d94b98976fb4354cbcb5e4402d081aac
parent1a9a56806a654654824cc79d0d215e09ac1b85ac (diff)
parent9c55d1268df6e5b44f9eddf505a0623f9ab29e08 (diff)
downloadmiasm-8276ac5629fdcf3ad885c8e4b9d2d7ed6e1e1d77.tar.gz
miasm-8276ac5629fdcf3ad885c8e4b9d2d7ed6e1e1d77.zip
Merge pull request #874 from GAJaloyan/prpdom
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