From 9c55d1268df6e5b44f9eddf505a0623f9ab29e08 Mon Sep 17 00:00:00 2001 From: GAJaloyan Date: Fri, 26 Oct 2018 10:19:17 +0200 Subject: adding immediate postdominators computation. --- miasm2/core/graph.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'miasm2/core/graph.py') 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 -- cgit 1.4.1