about summary refs log tree commit diff stats
path: root/miasm2/analysis
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-12-04 18:46:48 +0100
committerAjax <commial@gmail.com>2015-12-07 11:15:43 +0100
commit308a634b7c2c20692e85f5b72178e00d072b7bcd (patch)
tree3e091aef76acdf18d6592c2a058345d87489227b /miasm2/analysis
parent42d4998c1646e48fd9cb150d1aa0e9970b5717c8 (diff)
downloadmiasm-308a634b7c2c20692e85f5b72178e00d072b7bcd.tar.gz
miasm-308a634b7c2c20692e85f5b72178e00d072b7bcd.zip
IR: replace `.g` with a lazy built `.graph`, avoiding the need of `gen_graph`
Diffstat (limited to 'miasm2/analysis')
-rw-r--r--miasm2/analysis/data_analysis.py6
-rw-r--r--miasm2/analysis/depgraph.py6
2 files changed, 4 insertions, 8 deletions
diff --git a/miasm2/analysis/data_analysis.py b/miasm2/analysis/data_analysis.py
index 8462f150..9451a407 100644
--- a/miasm2/analysis/data_analysis.py
+++ b/miasm2/analysis/data_analysis.py
@@ -150,7 +150,7 @@ def inter_bloc_flow_link(ir_arch, flow_graph, todo, link_exec_to_data):
     x_nodes = tuple(sorted(list(irb.dst.get_r())))
 
     todo = set()
-    for lbl_dst in ir_arch.g.successors(irb.label):
+    for lbl_dst in ir_arch.graph.successors(irb.label):
         todo.add((lbl_dst, tuple(current_nodes.items()), x_nodes))
 
     # pp(('OUT', lbl, [(str(x[0]), str(x[1])) for x in current_nodes.items()]))
@@ -166,7 +166,7 @@ def create_implicit_flow(ir_arch, flow_graph):
     while todo:
         lbl = todo.pop()
         irb = ir_arch.blocs[lbl]
-        for lbl_son in ir_arch.g.successors(irb.label):
+        for lbl_son in ir_arch.graph.successors(irb.label):
             if not lbl_son in ir_arch.blocs:
                 print "cannot find bloc!!", lbl
                 continue
@@ -189,7 +189,7 @@ def create_implicit_flow(ir_arch, flow_graph):
                     irb.in_nodes[n_r] = irb.label, 0, n_r
                 node_n_r = irb.in_nodes[n_r]
                 # print "###", node_n_r
-                for lbl_p in ir_arch.g.predecessors(irb.label):
+                for lbl_p in ir_arch.graph.predecessors(irb.label):
                     todo.add(lbl_p)
 
                 flow_graph.add_uniq_edge(node_n_r, node_n_w)
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index 838183bf..0a5d38aa 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -686,7 +686,6 @@ class DependencyGraph(object):
     def __init__(self, ira, implicit=False, apply_simp=True, follow_mem=True,
                  follow_call=True):
         """Create a DependencyGraph linked to @ira
-        The IRA graph must have been computed
 
         @ira: IRAnalysis instance
         @implicit: (optional) Imply implicit dependencies
@@ -702,9 +701,6 @@ class DependencyGraph(object):
         self._step_counter = itertools.count()
         self._current_step = next(self._step_counter)
 
-        # The IRA graph must be computed
-        assert hasattr(self._ira, 'g')
-
         # Create callback filters. The order is relevant.
         self._cb_follow = []
         if apply_simp:
@@ -892,7 +888,7 @@ class DependencyGraph(object):
     def _get_previousblocks(self, label):
         """Return an iterator on predecessors blocks of @label, with their
         lengths"""
-        preds = self._ira.g.predecessors_iter(label)
+        preds = self._ira.graph.predecessors_iter(label)
         for pred_label in preds:
             length = len(self._get_irs(pred_label))
             yield (pred_label, length)