about summary refs log tree commit diff stats
path: root/miasm2/ir/ir.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/ir/ir.py')
-rw-r--r--miasm2/ir/ir.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 9db6d696..b955bac7 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -52,6 +52,18 @@ class irbloc:
         self._dst = dst
         return dst
 
+    def set_dst(self, value):
+        """Find and replace the IRDst affectation's source by @value"""
+        dst = None
+        for ir in self.irs:
+            for i in ir:
+                if isinstance(i.dst, m2_expr.ExprId) and i.dst.name == "IRDst":
+                    if dst is not None:
+                        raise ValueError('Multiple destinations!')
+                    dst = value
+                    i.src = value
+        self._dst = value
+
     dst = property(get_dst)
 
     def get_rw(self):