about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--example/expression/basic_simplification.py4
-rw-r--r--example/expression/expr_grapher.py8
-rw-r--r--example/expression/expr_reduce.py2
-rw-r--r--example/expression/simplification_add.py2
-rw-r--r--example/expression/simplification_tools.py10
-rw-r--r--example/expression/solve_condition_stp.py2
-rw-r--r--example/symbol_exec/depgraph.py4
-rw-r--r--miasm2/arch/aarch64/arch.py2
-rw-r--r--miasm2/arch/arm/arch.py6
-rw-r--r--miasm2/arch/arm/regs.py32
-rw-r--r--miasm2/arch/mips32/jit.py10
-rw-r--r--miasm2/arch/mips32/regs.py4
-rw-r--r--miasm2/arch/mips32/sem.py22
-rw-r--r--miasm2/arch/sh4/arch.py6
-rw-r--r--miasm2/arch/x86/regs.py54
-rw-r--r--miasm2/expression/expression.py5
-rw-r--r--miasm2/expression/simplifications_cond.py6
-rw-r--r--miasm2/ir/ir.py2
-rw-r--r--miasm2/jitter/llvmconvert.py20
-rw-r--r--test/analysis/data_flow.py28
-rw-r--r--test/analysis/depgraph.py46
-rw-r--r--test/core/sembuilder.py8
-rw-r--r--test/expression/expression.py2
-rwxr-xr-xtest/expression/expression_helper.py4
-rw-r--r--test/expression/simplifications.py28
-rw-r--r--test/ir/ir.py4
-rwxr-xr-xtest/ir/symbexec.py6
27 files changed, 165 insertions, 162 deletions
diff --git a/example/expression/basic_simplification.py b/example/expression/basic_simplification.py
index ef904686..eefdc765 100644
--- a/example/expression/basic_simplification.py
+++ b/example/expression/basic_simplification.py
@@ -6,8 +6,8 @@ Simple expression simplification demo
 """
 
 
-a = ExprId('eax')
-b = ExprId('ebx')
+a = ExprId('eax', 32)
+b = ExprId('ebx', 32)
 
 exprs = [a + b - a,
          ExprInt(0x12, 32) + ExprInt(0x30, 32) - a,
diff --git a/example/expression/expr_grapher.py b/example/expression/expr_grapher.py
index 0de2142b..9bf6cd84 100644
--- a/example/expression/expr_grapher.py
+++ b/example/expression/expr_grapher.py
@@ -2,10 +2,10 @@ from miasm2.expression.expression import *
 
 print "Simple Expression grapher demo"
 
-a = ExprId("A")
-b = ExprId("B")
-c = ExprId("C")
-d = ExprId("D")
+a = ExprId("A", 32)
+b = ExprId("B", 32)
+c = ExprId("C", 32)
+d = ExprId("D", 32)
 m = ExprMem(a + b + c + a)
 
 e1 = ExprCompose(a + b - (c * a) / m | b, a + m)
diff --git a/example/expression/expr_reduce.py b/example/expression/expr_reduce.py
index bb94ceb9..7c6e0c4c 100644
--- a/example/expression/expr_reduce.py
+++ b/example/expression/expr_reduce.py
@@ -75,7 +75,7 @@ class StructLookup(ExprReducer):
 def test():
     struct_lookup = StructLookup()
 
-    ptr = ExprId('ECX')
+    ptr = ExprId('ECX', 32)
     int4 = ExprInt(4, 32)
     tests = [
         (ptr, StructLookup.FIELD_A_PTR),
diff --git a/example/expression/simplification_add.py b/example/expression/simplification_add.py
index 41720f3a..621d1139 100644
--- a/example/expression/simplification_add.py
+++ b/example/expression/simplification_add.py
@@ -30,7 +30,7 @@ def simp_add_mul(expr_simp, expr):
         # Do not simplify
         return expr
 
-a = m2_expr.ExprId('a')
+a = m2_expr.ExprId('a', 32)
 base_expr = a + a + a
 print "Without adding the simplification:"
 print "\t%s = %s" % (base_expr, expr_simp(base_expr))
diff --git a/example/expression/simplification_tools.py b/example/expression/simplification_tools.py
index 258b5ce4..1fb95a80 100644
--- a/example/expression/simplification_tools.py
+++ b/example/expression/simplification_tools.py
@@ -7,11 +7,11 @@ Expression simplification demo.
 """
 
 
-a = ExprId('a')
-b = ExprId('b')
-c = ExprId('c')
-d = ExprId('d')
-e = ExprId('e')
+a = ExprId('a', 32)
+b = ExprId('b', 32)
+c = ExprId('c', 32)
+d = ExprId('d', 32)
+e = ExprId('e', 32)
 
 m = ExprMem(a)
 s = a[:8]
diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py
index b3ee6938..24d2dd50 100644
--- a/example/expression/solve_condition_stp.py
+++ b/example/expression/solve_condition_stp.py
@@ -109,7 +109,7 @@ if __name__ == '__main__':
 
     argc = ExprId('argc', 32)
     argv = ExprId('argv', 32)
-    ret_addr = ExprId('ret_addr')
+    ret_addr = ExprId('ret_addr', 32)
     reg_and_id[argc.name] = argc
     reg_and_id[argv.name] = argv
     reg_and_id[ret_addr.name] = ret_addr
diff --git a/example/symbol_exec/depgraph.py b/example/symbol_exec/depgraph.py
index e24f7f9b..b8d838ae 100644
--- a/example/symbol_exec/depgraph.py
+++ b/example/symbol_exec/depgraph.py
@@ -55,8 +55,8 @@ if args.rename_args:
     if arch == "x86_32":
         # StdCall example
         for i in xrange(4):
-            e_mem = ExprMem(ExprId("ESP_init") + ExprInt(4 * (i + 1), 32), 32)
-            init_ctx[e_mem] = ExprId("arg%d" % i)
+            e_mem = ExprMem(ExprId("ESP_init", 32) + ExprInt(4 * (i + 1), 32), 32)
+            init_ctx[e_mem] = ExprId("arg%d" % i, 32)
 
 # Disassemble the targeted function
 blocks = mdis.dis_multiblock(int(args.func_addr, 0))
diff --git a/miasm2/arch/aarch64/arch.py b/miasm2/arch/aarch64/arch.py
index 7af1953a..2712e60a 100644
--- a/miasm2/arch/aarch64/arch.py
+++ b/miasm2/arch/aarch64/arch.py
@@ -219,7 +219,7 @@ simdregs_h_zero = (simd32_info.parser |
 
 def ast_id2expr(t):
     if not t in mn_aarch64.regs.all_regs_ids_byname:
-        r = m2_expr.ExprId(AsmLabel(t))
+        r = m2_expr.ExprId(AsmLabel(t), 32)
     else:
         r = mn_aarch64.regs.all_regs_ids_byname[t]
     return r
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py
index c74d10a8..5e4b02f9 100644
--- a/miasm2/arch/arm/arch.py
+++ b/miasm2/arch/arm/arch.py
@@ -18,7 +18,7 @@ log.addHandler(console_handler)
 log.setLevel(logging.DEBUG)
 
 # arm regs ##############
-reg_dum = ExprId('DumReg')
+reg_dum = ExprId('DumReg', 32)
 
 gen_reg('PC', globals())
 
@@ -66,13 +66,13 @@ spsr_regs = reg_info(spsr_regs_str, spsr_regs_expr)
 
 # CP
 cpregs_str = ['c%d' % r for r in xrange(0x10)]
-cpregs_expr = [ExprId(x) for x in cpregs_str]
+cpregs_expr = [ExprId(x, 32) for x in cpregs_str]
 
 cp_regs = reg_info(cpregs_str, cpregs_expr)
 
 # P
 pregs_str = ['p%d' % r for r in xrange(0x10)]
-pregs_expr = [ExprId(x) for x in pregs_str]
+pregs_expr = [ExprId(x, 32) for x in pregs_str]
 
 p_regs = reg_info(pregs_str, pregs_expr)
 
diff --git a/miasm2/arch/arm/regs.py b/miasm2/arch/arm/regs.py
index 400c6080..8587d7c2 100644
--- a/miasm2/arch/arm/regs.py
+++ b/miasm2/arch/arm/regs.py
@@ -29,22 +29,22 @@ SP = regs32_expr[13]
 LR = regs32_expr[14]
 PC = regs32_expr[15]
 
-R0_init = ExprId("R0_init")
-R1_init = ExprId("R1_init")
-R2_init = ExprId("R2_init")
-R3_init = ExprId("R3_init")
-R4_init = ExprId("R4_init")
-R5_init = ExprId("R5_init")
-R6_init = ExprId("R6_init")
-R7_init = ExprId("R7_init")
-R8_init = ExprId("R8_init")
-R9_init = ExprId("R9_init")
-R10_init = ExprId("R10_init")
-R11_init = ExprId("R11_init")
-R12_init = ExprId("R12_init")
-SP_init = ExprId("SP_init")
-LR_init = ExprId("LR_init")
-PC_init = ExprId("PC_init")
+R0_init = ExprId("R0_init", 32)
+R1_init = ExprId("R1_init", 32)
+R2_init = ExprId("R2_init", 32)
+R3_init = ExprId("R3_init", 32)
+R4_init = ExprId("R4_init", 32)
+R5_init = ExprId("R5_init", 32)
+R6_init = ExprId("R6_init", 32)
+R7_init = ExprId("R7_init", 32)
+R8_init = ExprId("R8_init", 32)
+R9_init = ExprId("R9_init", 32)
+R10_init = ExprId("R10_init", 32)
+R11_init = ExprId("R11_init", 32)
+R12_init = ExprId("R12_init", 32)
+SP_init = ExprId("SP_init", 32)
+LR_init = ExprId("LR_init", 32)
+PC_init = ExprId("PC_init", 32)
 
 
 reg_zf = 'zf'
diff --git a/miasm2/arch/mips32/jit.py b/miasm2/arch/mips32/jit.py
index f3e54a7d..1d2ec483 100644
--- a/miasm2/arch/mips32/jit.py
+++ b/miasm2/arch/mips32/jit.py
@@ -35,8 +35,8 @@ class mipsCGen(CGen):
 
     def __init__(self, ir_arch):
         super(mipsCGen, self).__init__(ir_arch)
-        self.delay_slot_dst = m2_expr.ExprId("branch_dst_irdst")
-        self.delay_slot_set = m2_expr.ExprId("branch_dst_set")
+        self.delay_slot_dst = m2_expr.ExprId("branch_dst_irdst", 32)
+        self.delay_slot_set = m2_expr.ExprId("branch_dst_set", 32)
 
     def block2assignblks(self, block):
         irblocks_list = super(mipsCGen, self).block2assignblks(block)
@@ -58,7 +58,7 @@ class mipsCGen(CGen):
                     assignments[self.delay_slot_set] = m2_expr.ExprInt(1, 32)
                     # Replace IRDst with next instruction
                     assignments[self.ir_arch.IRDst] = m2_expr.ExprId(
-                        self.ir_arch.get_next_instr(assignblock.instr))
+                        self.ir_arch.get_next_instr(assignblock.instr), 32)
                     irs.append(AssignBlock(assignments, assignblock.instr))
                 irblocks[blk_idx] = IRBlock(irblock.label, irs)
 
@@ -72,8 +72,8 @@ class mipsCGen(CGen):
         lbl = self.get_block_post_label(block)
         out = (self.CODE_RETURN_NO_EXCEPTION % (self.label_to_jitlabel(lbl),
                                                 self.C_PC,
-                                                m2_expr.ExprId('branch_dst_irdst'),
-                                                m2_expr.ExprId('branch_dst_irdst'),
+                                                m2_expr.ExprId('branch_dst_irdst', 32),
+                                                m2_expr.ExprId('branch_dst_irdst', 32),
                                                 self.id_to_c(m2_expr.ExprInt(lbl.offset, 32)))
               ).split('\n')
         return out
diff --git a/miasm2/arch/mips32/regs.py b/miasm2/arch/mips32/regs.py
index fbd55a46..afade869 100644
--- a/miasm2/arch/mips32/regs.py
+++ b/miasm2/arch/mips32/regs.py
@@ -12,8 +12,8 @@ gen_reg('R_HI', globals())
 
 exception_flags = ExprId('exception_flags', 32)
 
-PC_init = ExprId("PC_init")
-PC_FETCH_init = ExprId("PC_FETCH_init")
+PC_init = ExprId("PC_init", 32)
+PC_FETCH_init = ExprId("PC_FETCH_init", 32)
 
 regs32_str = ["ZERO", 'AT', 'V0', 'V1'] +\
     ['A%d'%i for i in xrange(4)] +\
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py
index 645f9a4f..855cb6c8 100644
--- a/miasm2/arch/mips32/sem.py
+++ b/miasm2/arch/mips32/sem.py
@@ -34,7 +34,7 @@ def jal(arg1):
     "Jumps to the calculated address @arg1 and stores the return address in $RA"
     PC = arg1
     ir.IRDst = arg1
-    RA = ExprId(ir.get_next_break_label(instr))
+    RA = ExprId(ir.get_next_break_label(instr), 32)
 
 @sbuild.parse
 def jalr(arg1, arg2):
@@ -42,13 +42,13 @@ def jalr(arg1, arg2):
     address in another register @arg2"""
     PC = arg1
     ir.IRDst = arg1
-    arg2 = ExprId(ir.get_next_break_label(instr))
+    arg2 = ExprId(ir.get_next_break_label(instr), 32)
 
 @sbuild.parse
 def bal(arg1):
     PC = arg1
     ir.IRDst = arg1
-    RA = ExprId(ir.get_next_break_label(instr))
+    RA = ExprId(ir.get_next_break_label(instr), 32)
 
 @sbuild.parse
 def l_b(arg1):
@@ -75,7 +75,7 @@ def lb(arg1, arg2):
 @sbuild.parse
 def beq(arg1, arg2, arg3):
     "Branches on @arg3 if the quantities of two registers @arg1, @arg2 are eq"
-    dst = ExprId(ir.get_next_break_label(instr)) if arg1 - arg2 else arg3
+    dst = ExprId(ir.get_next_break_label(instr), 32) if arg1 - arg2 else arg3
     PC = dst
     ir.IRDst = dst
 
@@ -83,7 +83,7 @@ def beq(arg1, arg2, arg3):
 def bgez(arg1, arg2):
     """Branches on @arg2 if the quantities of register @arg1 is greater than or
     equal to zero"""
-    dst = ExprId(ir.get_next_break_label(instr)) if arg1.msb() else arg2
+    dst = ExprId(ir.get_next_break_label(instr), 32) if arg1.msb() else arg2
     PC = dst
     ir.IRDst = dst
 
@@ -91,7 +91,7 @@ def bgez(arg1, arg2):
 def bne(arg1, arg2, arg3):
     """Branches on @arg3 if the quantities of two registers @arg1, @arg2 are NOT
     equal"""
-    dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr))
+    dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr), 32)
     PC = dst
     ir.IRDst = dst
 
@@ -229,7 +229,7 @@ def seh(arg1, arg2):
 @sbuild.parse
 def bltz(arg1, arg2):
     """Branches on @arg2 if the register @arg1 is less than zero"""
-    dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr))
+    dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr), 32)
     PC = dst_o
     ir.IRDst = dst_o
 
@@ -237,7 +237,7 @@ def bltz(arg1, arg2):
 def blez(arg1, arg2):
     """Branches on @arg2 if the register @arg1 is less than or equal to zero"""
     cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
-    dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr))
+    dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr), 32)
     PC = dst_o
     ir.IRDst = dst_o
 
@@ -245,7 +245,7 @@ def blez(arg1, arg2):
 def bgtz(arg1, arg2):
     """Branches on @arg2 if the register @arg1 is greater than zero"""
     cond = (i1(1) if arg1 else i1(0)) | arg1.msb()
-    dst_o = ExprId(ir.get_next_break_label(instr)) if cond else arg2
+    dst_o = ExprId(ir.get_next_break_label(instr), 32) if cond else arg2
     PC = dst_o
     ir.IRDst = dst_o
 
@@ -345,13 +345,13 @@ def c_le_d(arg1, arg2, arg3):
 
 @sbuild.parse
 def bc1t(arg1, arg2):
-    dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr))
+    dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr), 32)
     PC = dst_o
     ir.IRDst = dst_o
 
 @sbuild.parse
 def bc1f(arg1, arg2):
-    dst_o = ExprId(ir.get_next_break_label(instr)) if arg1 else arg2
+    dst_o = ExprId(ir.get_next_break_label(instr), 32) if arg1 else arg2
     PC = dst_o
     ir.IRDst = dst_o
 
diff --git a/miasm2/arch/sh4/arch.py b/miasm2/arch/sh4/arch.py
index eeafd5f5..d7ae4f12 100644
--- a/miasm2/arch/sh4/arch.py
+++ b/miasm2/arch/sh4/arch.py
@@ -7,9 +7,9 @@ from collections import defaultdict
 import miasm2.arch.sh4.regs as regs_module
 from miasm2.arch.sh4.regs import *
 
-jra = ExprId('jra')
-jrb = ExprId('jrb')
-jrc = ExprId('jrc')
+jra = ExprId('jra', 32)
+jrb = ExprId('jrb', 32)
+jrc = ExprId('jrc', 32)
 
 
 # parser helper ###########
diff --git a/miasm2/arch/x86/regs.py b/miasm2/arch/x86/regs.py
index cb7e0d7b..84590c75 100644
--- a/miasm2/arch/x86/regs.py
+++ b/miasm2/arch/x86/regs.py
@@ -251,23 +251,23 @@ reg_float_address = 'reg_float_address'
 reg_float_ds = 'reg_float_ds'
 
 
-dr0 = ExprId(reg_dr0)
-dr1 = ExprId(reg_dr1)
-dr2 = ExprId(reg_dr2)
-dr3 = ExprId(reg_dr3)
-dr4 = ExprId(reg_dr4)
-dr5 = ExprId(reg_dr5)
-dr6 = ExprId(reg_dr6)
-dr7 = ExprId(reg_dr7)
-
-cr0 = ExprId(reg_cr0)
-cr1 = ExprId(reg_cr1)
-cr2 = ExprId(reg_cr2)
-cr3 = ExprId(reg_cr3)
-cr4 = ExprId(reg_cr4)
-cr5 = ExprId(reg_cr5)
-cr6 = ExprId(reg_cr6)
-cr7 = ExprId(reg_cr7)
+dr0 = ExprId(reg_dr0, 32)
+dr1 = ExprId(reg_dr1, 32)
+dr2 = ExprId(reg_dr2, 32)
+dr3 = ExprId(reg_dr3, 32)
+dr4 = ExprId(reg_dr4, 32)
+dr5 = ExprId(reg_dr5, 32)
+dr6 = ExprId(reg_dr6, 32)
+dr7 = ExprId(reg_dr7, 32)
+
+cr0 = ExprId(reg_cr0, 32)
+cr1 = ExprId(reg_cr1, 32)
+cr2 = ExprId(reg_cr2, 32)
+cr3 = ExprId(reg_cr3, 32)
+cr4 = ExprId(reg_cr4, 32)
+cr5 = ExprId(reg_cr5, 32)
+cr6 = ExprId(reg_cr6, 32)
+cr7 = ExprId(reg_cr7, 32)
 
 mm0 = ExprId(reg_mm0, 64)
 mm1 = ExprId(reg_mm1, 64)
@@ -330,9 +330,9 @@ float_c2 = ExprId(reg_float_c2, size=1)
 float_c3 = ExprId(reg_float_c3, size=1)
 float_stack_ptr = ExprId(reg_float_stack_ptr, size=3)
 float_control = ExprId(reg_float_control, 16)
-float_eip = ExprId(reg_float_eip)
+float_eip = ExprId(reg_float_eip, 32)
 float_cs = ExprId(reg_float_cs, size=16)
-float_address = ExprId(reg_float_address)
+float_address = ExprId(reg_float_address, 32)
 float_ds = ExprId(reg_float_ds, size=16)
 
 float_st0 = ExprId("float_st0", 64)
@@ -352,14 +352,14 @@ float_replace = {fltregs32_expr[i]: float_list[i] for i in xrange(8)}
 float_replace[r_st_all.expr[0]] = float_st0
 
 
-EAX_init = ExprId('EAX_init')
-EBX_init = ExprId('EBX_init')
-ECX_init = ExprId('ECX_init')
-EDX_init = ExprId('EDX_init')
-ESI_init = ExprId('ESI_init')
-EDI_init = ExprId('EDI_init')
-ESP_init = ExprId('ESP_init')
-EBP_init = ExprId('EBP_init')
+EAX_init = ExprId('EAX_init', 32)
+EBX_init = ExprId('EBX_init', 32)
+ECX_init = ExprId('ECX_init', 32)
+EDX_init = ExprId('EDX_init', 32)
+ESI_init = ExprId('ESI_init', 32)
+EDI_init = ExprId('EDI_init', 32)
+ESP_init = ExprId('ESP_init', 32)
+EBP_init = ExprId('EBP_init', 32)
 
 
 RAX_init = ExprId('RAX_init', 64)
diff --git a/miasm2/expression/expression.py b/miasm2/expression/expression.py
index 6b189c4d..a72c1ec4 100644
--- a/miasm2/expression/expression.py
+++ b/miasm2/expression/expression.py
@@ -525,11 +525,14 @@ class ExprId(Expr):
 
     __slots__ = Expr.__slots__ + ["_name"]
 
-    def __init__(self, name, size=32):
+    def __init__(self, name, size=None):
         """Create an identifier
         @name: str, identifier's name
         @size: int, identifier's size
         """
+        if size is None:
+            warnings.warn('DEPRECATION WARNING: size is a mandatory argument: use ExprId(name, SIZE)')
+            size = 32
         super(ExprId, self).__init__(size)
         self._name = name
 
diff --git a/miasm2/expression/simplifications_cond.py b/miasm2/expression/simplifications_cond.py
index 3054d92b..6bdc810f 100644
--- a/miasm2/expression/simplifications_cond.py
+++ b/miasm2/expression/simplifications_cond.py
@@ -19,9 +19,9 @@ import miasm2.expression.expression as m2_expr
 
 # Jokers for expression matching
 
-jok1 = m2_expr.ExprId("jok1")
-jok2 = m2_expr.ExprId("jok2")
-jok3 = m2_expr.ExprId("jok3")
+jok1 = m2_expr.ExprId("jok1", 32)
+jok2 = m2_expr.ExprId("jok2", 32)
+jok3 = m2_expr.ExprId("jok3", 32)
 jok_small = m2_expr.ExprId("jok_small", 1)
 
 
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index f31db76b..64eb3463 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -765,7 +765,7 @@ class IntermediateRepresentation(object):
             for dst in self.dst_trackback(block):
                 if dst.is_int():
                     dst_lbl = self.symbol_pool.getby_offset_create(int(dst))
-                    dst = m2_expr.ExprId(dst_lbl)
+                    dst = m2_expr.ExprId(dst_lbl, self.pc.size)
                 if expr_is_label(dst):
                     self._graph.add_edge(lbl, dst.name)
 
diff --git a/miasm2/jitter/llvmconvert.py b/miasm2/jitter/llvmconvert.py
index 5fa749a5..65c6aa07 100644
--- a/miasm2/jitter/llvmconvert.py
+++ b/miasm2/jitter/llvmconvert.py
@@ -966,7 +966,7 @@ class LLVMFunction():
         if isinstance(offset, (int, long)):
             offset = self.add_ir(m2_expr.ExprInt(offset, PC.size))
         self.affect(offset, PC)
-        self.affect(self.add_ir(m2_expr.ExprInt(1, 8)), m2_expr.ExprId("status"))
+        self.affect(self.add_ir(m2_expr.ExprInt(1, 8)), m2_expr.ExprId("status", 32))
         self.set_ret(offset)
 
         builder.position_at_end(merge_block)
@@ -1013,7 +1013,7 @@ class LLVMFunction():
         if isinstance(offset, (int, long)):
             offset = self.add_ir(m2_expr.ExprInt(offset, PC.size))
         self.affect(offset, PC)
-        self.affect(self.add_ir(m2_expr.ExprInt(1, 8)), m2_expr.ExprId("status"))
+        self.affect(self.add_ir(m2_expr.ExprInt(1, 8)), m2_expr.ExprId("status", 32))
         self.set_ret(offset)
 
         builder.position_at_end(merge_block)
@@ -1121,7 +1121,7 @@ class LLVMFunction():
         self.gen_post_code(attrib)
         self.affect(dst, PC)
         self.gen_post_instr_checks(attrib, dst)
-        self.affect(self.add_ir(m2_expr.ExprInt(0, 8)), m2_expr.ExprId("status"))
+        self.affect(self.add_ir(m2_expr.ExprInt(0, 8)), m2_expr.ExprId("status", 32))
         self.set_ret(dst)
 
 
@@ -1215,7 +1215,7 @@ class LLVMFunction():
         m2_exception_flag = self.llvm_context.ir_arch.arch.regs.exception_flags
         t_size = LLVMType.IntType(m2_exception_flag.size)
         self.affect(self.add_ir(m2_expr.ExprInt(1, 8)),
-                    m2_expr.ExprId("status"))
+                    m2_expr.ExprId("status", 32))
         self.affect(t_size(m2_csts.EXCEPT_UNK_MNEMO),
                     m2_exception_flag)
         self.set_ret(LLVMType.IntType(64)(asmblock.label.offset))
@@ -1233,7 +1233,7 @@ class LLVMFunction():
 
             # Common code
             self.affect(self.add_ir(m2_expr.ExprInt(0, 8)),
-                        m2_expr.ExprId("status"))
+                        m2_expr.ExprId("status", 32))
 
             # Check if IRDst has been set
             zero_casted = LLVMType.IntType(codegen.delay_slot_set.size)(0)
@@ -1257,7 +1257,7 @@ class LLVMFunction():
             to_ret = self.add_ir(codegen.delay_slot_dst)
             self.affect(to_ret, PC)
             self.affect(self.add_ir(m2_expr.ExprInt(0, 8)),
-                        m2_expr.ExprId("status"))
+                        m2_expr.ExprId("status", 32))
             self.set_ret(to_ret)
 
             # Else Block
@@ -1272,16 +1272,16 @@ class LLVMFunction():
         Prototype : f(i8* jitcpu, i8* vmcpu, i8* vmmngr, i8* status)"""
 
         # Build function signature
-        self.my_args.append((m2_expr.ExprId("jitcpu"),
+        self.my_args.append((m2_expr.ExprId("jitcpu", 32),
                              llvm_ir.PointerType(LLVMType.IntType(8)),
                              "jitcpu"))
-        self.my_args.append((m2_expr.ExprId("vmcpu"),
+        self.my_args.append((m2_expr.ExprId("vmcpu", 32),
                              llvm_ir.PointerType(LLVMType.IntType(8)),
                              "vmcpu"))
-        self.my_args.append((m2_expr.ExprId("vmmngr"),
+        self.my_args.append((m2_expr.ExprId("vmmngr", 32),
                              llvm_ir.PointerType(LLVMType.IntType(8)),
                              "vmmngr"))
-        self.my_args.append((m2_expr.ExprId("status"),
+        self.my_args.append((m2_expr.ExprId("status", 32),
                              llvm_ir.PointerType(LLVMType.IntType(8)),
                              "status"))
         ret_size = 64
diff --git a/test/analysis/data_flow.py b/test/analysis/data_flow.py
index f2e30172..dff88470 100644
--- a/test/analysis/data_flow.py
+++ b/test/analysis/data_flow.py
@@ -5,20 +5,20 @@ from miasm2.analysis.data_flow import *
 from miasm2.ir.analysis import ira
 from miasm2.ir.ir import IRBlock, AssignBlock
 
-a = ExprId("a")
-b = ExprId("b")
-c = ExprId("c")
-d = ExprId("d")
-r = ExprId("r")
-
-a_init = ExprId("a_init")
-b_init = ExprId("b_init")
-c_init = ExprId("c_init")
-d_init = ExprId("d_init")
-r_init = ExprId("r_init") # Return register
-
-pc = ExprId("pc")
-sp = ExprId("sp")
+a = ExprId("a", 32)
+b = ExprId("b", 32)
+c = ExprId("c", 32)
+d = ExprId("d", 32)
+r = ExprId("r", 32)
+
+a_init = ExprId("a_init", 32)
+b_init = ExprId("b_init", 32)
+c_init = ExprId("c_init", 32)
+d_init = ExprId("d_init", 32)
+r_init = ExprId("r_init", 32) # Return register
+
+pc = ExprId("pc", 32)
+sp = ExprId("sp", 32)
 
 CST1 = ExprInt(0x11, 32)
 CST2 = ExprInt(0x12, 32)
diff --git a/test/analysis/depgraph.py b/test/analysis/depgraph.py
index 290547fe..9fb046d0 100644
--- a/test/analysis/depgraph.py
+++ b/test/analysis/depgraph.py
@@ -16,19 +16,19 @@ except ImportError:
     EMULATION = False
 
 STEP_COUNTER = count()
-A = ExprId("a")
-B = ExprId("b")
-C = ExprId("c")
-D = ExprId("d")
-R = ExprId("r")
+A = ExprId("a", 32)
+B = ExprId("b", 32)
+C = ExprId("c", 32)
+D = ExprId("d", 32)
+R = ExprId("r", 32)
 
-A_INIT = ExprId("a_init")
-B_INIT = ExprId("b_init")
-C_INIT = ExprId("c_init")
-D_INIT = ExprId("d_init")
+A_INIT = ExprId("a_init", 32)
+B_INIT = ExprId("b_init", 32)
+C_INIT = ExprId("c_init", 32)
+D_INIT = ExprId("d_init", 32)
 
-PC = ExprId("pc")
-SP = ExprId("sp")
+PC = ExprId("pc", 32)
+SP = ExprId("sp", 32)
 
 CST0 = ExprInt(0x0, 32)
 CST1 = ExprInt(0x1, 32)
@@ -277,8 +277,8 @@ G4_IRA = IRATest()
 G4_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]])
 G4_IRB1 = gen_irblock(LBL1, [[ExprAff(C, C + CST2)],
                              [ExprAff(G4_IRA.IRDst,
-                                      ExprCond(C, ExprId(LBL2),
-                                               ExprId(LBL1)))]])
+                                      ExprCond(C, ExprId(LBL2, 32),
+                                               ExprId(LBL1, 32)))]])
 
 G4_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]])
 
@@ -296,8 +296,8 @@ G5_IRA = IRATest()
 G5_IRB0 = gen_irblock(LBL0, [[ExprAff(B, CST1)]])
 G5_IRB1 = gen_irblock(LBL1, [[ExprAff(B, B + CST2)],
                              [ExprAff(G5_IRA.IRDst,
-                                      ExprCond(B, ExprId(LBL2),
-                                               ExprId(LBL1)))]])
+                                      ExprCond(B, ExprId(LBL2, 32),
+                                               ExprId(LBL1, 32)))]])
 
 G5_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]])
 
@@ -400,16 +400,16 @@ G13_IRA = IRATest()
 G13_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)],
                               #[ExprAff(B, A)],
                               [ExprAff(G13_IRA.IRDst,
-                                       ExprId(LBL1))]])
+                                       ExprId(LBL1, 32))]])
 G13_IRB1 = gen_irblock(LBL1, [[ExprAff(C, A)],
                               #[ExprAff(A, A + CST1)],
                               [ExprAff(G13_IRA.IRDst,
-                                       ExprCond(R, ExprId(LBL2),
-                                                ExprId(LBL1)))]])
+                                       ExprCond(R, ExprId(LBL2, 32),
+                                                ExprId(LBL1, 32)))]])
 
 G13_IRB2 = gen_irblock(LBL2, [[ExprAff(B, A + CST3)], [ExprAff(A, B + CST3)],
                               [ExprAff(G13_IRA.IRDst,
-                                       ExprId(LBL1))]])
+                                       ExprId(LBL1, 32))]])
 
 G13_IRB3 = gen_irblock(LBL3, [[ExprAff(R, C)]])
 
@@ -427,18 +427,18 @@ G14_IRA = IRATest()
 
 G14_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)],
                               [ExprAff(G14_IRA.IRDst,
-                                       ExprId(LBL1))]
+                                       ExprId(LBL1, 32))]
                              ])
 G14_IRB1 = gen_irblock(LBL1, [[ExprAff(B, A)],
                               [ExprAff(G14_IRA.IRDst,
-                                       ExprCond(C, ExprId(LBL2),
-                                                ExprId(LBL3)))]
+                                       ExprCond(C, ExprId(LBL2, 32),
+                                                ExprId(LBL3, 32)))]
                              ])
 
 G14_IRB2 = gen_irblock(LBL2, [[ExprAff(D, A)],
                               [ExprAff(A, D + CST1)],
                               [ExprAff(G14_IRA.IRDst,
-                                       ExprId(LBL1))]
+                                       ExprId(LBL1, 32))]
                              ])
 
 G14_IRB3 = gen_irblock(LBL3, [[ExprAff(R, D + B)]])
diff --git a/test/core/sembuilder.py b/test/core/sembuilder.py
index 70d6d5ec..ebf9f385 100644
--- a/test/core/sembuilder.py
+++ b/test/core/sembuilder.py
@@ -8,7 +8,7 @@ from miasm2.core.asmblock import AsmLabel
 # Test classes
 class IR(object):
 
-    IRDst = m2_expr.ExprId("IRDst")
+    IRDst = m2_expr.ExprId("IRDst", 32)
 
     def get_next_instr(self, _):
         return AsmLabel("NEXT")
@@ -41,9 +41,9 @@ def test(Arg1, Arg2, Arg3):
     else:
         alias = {i16(4), i8(5)}
 
-a = m2_expr.ExprId('A')
-b = m2_expr.ExprId('B')
-c = m2_expr.ExprId('C')
+a = m2_expr.ExprId('A', 32)
+b = m2_expr.ExprId('B', 32)
+c = m2_expr.ExprId('C', 32)
 ir = IR()
 instr = Instr()
 res = test(ir, instr, a, b, c)
diff --git a/test/expression/expression.py b/test/expression/expression.py
index ac145a04..6bb6d94c 100644
--- a/test/expression/expression.py
+++ b/test/expression/expression.py
@@ -15,7 +15,7 @@ assert big_cst.size == 0x1000
 
 # Possible values
 #- Common constants
-A = ExprId("A")
+A = ExprId("A", 32)
 cond1 = ExprId("cond1", 1)
 cond2 = ExprId("cond2", 16)
 cst1 = ExprInt(1, 32)
diff --git a/test/expression/expression_helper.py b/test/expression/expression_helper.py
index a4c221e9..35873ca4 100755
--- a/test/expression/expression_helper.py
+++ b/test/expression/expression_helper.py
@@ -12,8 +12,8 @@ class TestExpressionExpressionHelper(unittest.TestCase):
 
         # Build a complex expression
         cst = m2_expr.ExprInt(0x100, 16)
-        eax = m2_expr.ExprId("EAX")
-        ebx = m2_expr.ExprId("EBX")
+        eax = m2_expr.ExprId("EAX", 32)
+        ebx = m2_expr.ExprId("EBX", 32)
         ax = eax[0:16]
         expr = eax + ebx
         expr = m2_expr.ExprCompose(ax, expr[16:32])
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index ad420621..1e8e73ba 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -8,11 +8,11 @@ from miasm2.expression.simplifications import expr_simp, ExpressionSimplifier
 from miasm2.expression.simplifications_cond import ExprOp_inf_signed, ExprOp_inf_unsigned, ExprOp_equal
 
 # Define example objects
-a = ExprId('a')
-b = ExprId('b')
-c = ExprId('c')
-d = ExprId('d')
-e = ExprId('e')
+a = ExprId('a', 32)
+b = ExprId('b', 32)
+c = ExprId('c', 32)
+d = ExprId('d', 32)
+e = ExprId('e', 32)
 f = ExprId('f', size=64)
 
 m = ExprMem(a)
@@ -378,17 +378,17 @@ for e, e_check in to_test[:]:
 
 
 
-x = ExprId('x')
-y = ExprId('y')
-z = ExprId('z')
-a = ExprId('a')
-b = ExprId('b')
-c = ExprId('c')
+x = ExprId('x', 32)
+y = ExprId('y', 32)
+z = ExprId('z', 32)
+a = ExprId('a', 32)
+b = ExprId('b', 32)
+c = ExprId('c', 32)
 
 
-jra = ExprId('jra')
-jrb = ExprId('jrb')
-jrint1 = ExprId('jrint1')
+jra = ExprId('jra', 32)
+jrb = ExprId('jrb', 32)
+jrint1 = ExprId('jrint1', 32)
 
 
 e1 = ExprMem((a & ExprInt(0xFFFFFFFC, 32)) + ExprInt(0x10, 32), 32)
diff --git a/test/ir/ir.py b/test/ir/ir.py
index 05936d75..3774e4e9 100644
--- a/test/ir/ir.py
+++ b/test/ir/ir.py
@@ -2,8 +2,8 @@ from miasm2.expression.expression import *
 from miasm2.ir.ir import AssignBlock
 from miasm2.expression.simplifications import expr_simp
 
-id_a = ExprId("a")
-id_b = ExprId("b")
+id_a = ExprId("a", 32)
+id_b = ExprId("b", 32)
 int0 = ExprInt(0, id_a.size)
 
 # Test AssignBlock
diff --git a/test/ir/symbexec.py b/test/ir/symbexec.py
index f8d8c7bf..492dcfec 100755
--- a/test/ir/symbexec.py
+++ b/test/ir/symbexec.py
@@ -30,10 +30,10 @@ class TestSymbExec(unittest.TestCase):
         mem40w = ExprMem(addr40, 16)
         mem50v = ExprMem(addr50,  8)
         mem50w = ExprMem(addr50, 16)
-        id_x = ExprId('x')
+        id_x = ExprId('x', 32)
         id_y = ExprId('y', 8)
-        id_a = ExprId('a')
-        id_eax = ExprId('eax_init')
+        id_a = ExprId('a', 32)
+        id_eax = ExprId('eax_init', 32)
 
         e = SymbolicExecutionEngine(ir_x86_32(),
                                     {mem0: id_x, mem1: id_y, mem9: id_x,