about summary refs log tree commit diff stats
path: root/miasm2/expression/expression.py
diff options
context:
space:
mode:
authorCaroline Leman <caroline.leman@cea.fr>2015-04-28 15:37:32 +0200
committerCaroline LEMAN <caroline.leman@cea.fr>2015-04-29 14:07:29 +0200
commit52c87a2468ce235717a13e31f65cdf32683bf430 (patch)
treeb7a750809de5ce817955bb99b71a8dc88e8334aa /miasm2/expression/expression.py
parent8969f53fbac8c9e0578ec05c244b3c944d3812e2 (diff)
downloadmiasm-52c87a2468ce235717a13e31f65cdf32683bf430.tar.gz
miasm-52c87a2468ce235717a13e31f65cdf32683bf430.zip
IR: Improve dead code elimination
Dead code analysis computed using Ken Kennedy Algorithm

Ref: A survey of data flow analysis techniques, IBM Thomas J. Watson Research Division, 1979
Diffstat (limited to 'miasm2/expression/expression.py')
-rw-r--r--miasm2/expression/expression.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/miasm2/expression/expression.py b/miasm2/expression/expression.py
index 154da7cc..2b51ef61 100644
--- a/miasm2/expression/expression.py
+++ b/miasm2/expression/expression.py
@@ -152,6 +152,11 @@ class Expr(object):
     def get_w(self):
         return self.arg.get_w()
 
+    def is_function_call(self):
+        """Returns true if the considered Expr is a function call
+        """
+        return False
+
     def __repr__(self):
         if self._repr is None:
             self._repr = self._exprrepr()
@@ -512,6 +517,9 @@ class ExprAff(Expr):
         else:
             return self._dst.get_w()
 
+    def is_function_call(self):
+        return isinstance(self.src, ExprOp) and self.src.op.startswith('call')
+
     def _exprhash(self):
         return hash((EXPRAFF, hash(self._dst), hash(self._src)))