about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--example/disasm/full.py3
-rw-r--r--miasm2/analysis/data_flow.py6
-rw-r--r--miasm2/analysis/gdbserver.py4
-rw-r--r--miasm2/arch/aarch64/arch.py11
-rw-r--r--miasm2/arch/aarch64/regs.py3
-rw-r--r--miasm2/arch/aarch64/sem.py8
-rw-r--r--miasm2/arch/arm/arch.py1
-rw-r--r--miasm2/arch/arm/sem.py6
-rw-r--r--miasm2/arch/mep/arch.py3
-rw-r--r--miasm2/arch/mep/regs.py2
-rw-r--r--miasm2/arch/mep/sem.py20
-rw-r--r--miasm2/arch/mips32/arch.py2
-rw-r--r--miasm2/arch/ppc/sem.py4
-rw-r--r--miasm2/arch/x86/sem.py4
-rw-r--r--miasm2/core/asmblock.py3
-rw-r--r--miasm2/core/cpu.py2
-rw-r--r--miasm2/core/ctypesmngr.py24
-rw-r--r--miasm2/core/objc.py3
-rw-r--r--miasm2/core/parse_asm.py3
-rw-r--r--miasm2/core/types.py24
-rw-r--r--miasm2/expression/expression_helper.py1
-rw-r--r--miasm2/expression/simplifications_common.py3
-rw-r--r--miasm2/expression/simplifications_explicit.py3
-rw-r--r--miasm2/ir/ir.py4
-rw-r--r--miasm2/ir/symbexec_types.py3
-rw-r--r--miasm2/ir/translators/C.py26
-rw-r--r--miasm2/ir/translators/smt2.py1
-rw-r--r--miasm2/ir/translators/z3_ir.py1
-rw-r--r--miasm2/jitter/codegen.py9
-rw-r--r--miasm2/jitter/jitcore_python.py3
-rw-r--r--miasm2/jitter/jitload.py4
-rw-r--r--miasm2/os_dep/win_api_x86_32.py4
32 files changed, 101 insertions, 97 deletions
diff --git a/example/disasm/full.py b/example/disasm/full.py
index 1e59174c..ac8bf522 100644
--- a/example/disasm/full.py
+++ b/example/disasm/full.py
@@ -4,12 +4,11 @@ from pdb import pm
 
 from miasm2.analysis.binary import Container
 from miasm2.core.asmblock import log_asmblock, AsmCFG
-from miasm2.expression.expression import ExprId, ExprInt
 from miasm2.core.interval import interval
 from miasm2.analysis.machine import Machine
 from miasm2.analysis.data_flow import dead_simp, DiGraphDefUse, \
     ReachingDefinitions, merge_blocks, remove_empty_assignblks, \
-    PropagateExpr, SSADefUse, replace_stack_vars, load_from_int
+    PropagateExpr, replace_stack_vars, load_from_int
 from miasm2.expression.simplifications import expr_simp
 from miasm2.analysis.ssa import SSAPath, SSADiGraph, remove_phi
 from miasm2.ir.ir import AssignBlock, IRBlock
diff --git a/miasm2/analysis/data_flow.py b/miasm2/analysis/data_flow.py
index a0ff867b..f3881df9 100644
--- a/miasm2/analysis/data_flow.py
+++ b/miasm2/analysis/data_flow.py
@@ -722,8 +722,6 @@ class PropagateExpr(object):
 
         modified = False
         for node, reg in node_to_reg.iteritems():
-            src = to_replace[reg]
-
             for successor in defuse.successors(node):
                 if not self.propagation_allowed(ssa, to_replace, node, successor):
                     continue
@@ -874,7 +872,6 @@ def retrieve_stack_accesses(ir_arch_a, ssa):
         tmp += mem
 
     base_to_info = {}
-    base_to_name = {}
     for addr, vars in base_to_var.iteritems():
         name = "var_%d" % (len(base_to_info))
         size = max([var.size for var in vars])
@@ -913,10 +910,8 @@ def replace_stack_vars(ir_arch_a, ssa):
     @ir_arch_a: ira instance
     @ssa: SSADiGraph instance
     """
-    defuse = SSADefUse.from_ssa(ssa)
 
     base_to_info = retrieve_stack_accesses(ir_arch_a, ssa)
-    stack_vars = {}
     modified = False
     for block in ssa.graph.blocks.itervalues():
         assignblks = []
@@ -996,7 +991,6 @@ def load_from_int(ir_arch, bs, is_addr_ro_variable):
                 if dst.is_mem():
                     ptr = dst.arg
                     mems = get_memlookup(ptr, bs, is_addr_ro_variable)
-                    ptr_new = ptr
                     if mems:
                         replace = {}
                         for mem in mems:
diff --git a/miasm2/analysis/gdbserver.py b/miasm2/analysis/gdbserver.py
index dbf1b3b6..6c630f88 100644
--- a/miasm2/analysis/gdbserver.py
+++ b/miasm2/analysis/gdbserver.py
@@ -395,7 +395,7 @@ class GdbServer_msp430(GdbServer):
                               "SP": 2,
                               "SR": 2,
                               "R3": 2,
-                              "R2": 2,
+                              "R4": 2,
                               "R5": 2,
                               "R6": 2,
                               "R7": 2,
@@ -405,7 +405,7 @@ class GdbServer_msp430(GdbServer):
                               "R11": 2,
                               "R12": 2,
                               "R13": 2,
-                              "R12": 2,
+                              "R14": 2,
                               "R15": 2}
 
     def read_register_by_name(self, reg_name):
diff --git a/miasm2/arch/aarch64/arch.py b/miasm2/arch/aarch64/arch.py
index 8cb681f6..15a7bd77 100644
--- a/miasm2/arch/aarch64/arch.py
+++ b/miasm2/arch/aarch64/arch.py
@@ -1,7 +1,6 @@
 #-*- coding:utf-8 -*-
 
 import logging
-import math
 from pyparsing import *
 from miasm2.expression import expression as m2_expr
 from miasm2.core.cpu import *
@@ -277,15 +276,15 @@ class aarch64_arg(m_arg):
                 fixed_size.add(value.name.size)
                 return value.name
             loc_key = loc_db.get_or_create_name_location(value.name)
-            return ExprLoc(loc_key, size_hint)
+            return m2_expr.ExprLoc(loc_key, size_hint)
         if isinstance(value, AstInt):
             assert size_hint is not None
-            return ExprInt(value.value, size_hint)
+            return m2_expr.ExprInt(value.value, size_hint)
         if isinstance(value, AstOp):
             if value.op == "segm":
                 segm = self.asm_ast_to_expr(value.args[0], loc_db)
                 ptr = self.asm_ast_to_expr(value.args[1], loc_db, None, fixed_size)
-                return ExprOp('segm', segm, ptr)
+                return m2_expr.ExprOp('segm', segm, ptr)
 
             args = [self.asm_ast_to_expr(arg, loc_db, None, fixed_size) for arg in value.args]
             if len(fixed_size) == 0:
@@ -298,7 +297,7 @@ class aarch64_arg(m_arg):
             else:
                 raise ValueError("Size conflict")
 
-            return ExprOp(value.op, *args)
+            return m2_expr.ExprOp(value.op, *args)
         return None
 
 
@@ -1420,7 +1419,7 @@ class aarch64_offs_pc(imm_noarg, aarch64_arg):
         v = v & self.lmask
         v = (v << 2)
         v = sign_ext(v, (self.l + 2), 64)
-        self.expr = ExprOp("preinc", PC, m2_expr.ExprInt(v, 64))
+        self.expr = m2_expr.ExprOp("preinc", PC, m2_expr.ExprInt(v, 64))
         return True
 
     def encode(self):
diff --git a/miasm2/arch/aarch64/regs.py b/miasm2/arch/aarch64/regs.py
index 85c8425a..1c693b4c 100644
--- a/miasm2/arch/aarch64/regs.py
+++ b/miasm2/arch/aarch64/regs.py
@@ -1,7 +1,6 @@
 #-*- coding:utf-8 -*-
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprLoc, ExprMem, \
-    ExprSlice, ExprCond, ExprCompose, ExprOp
+from miasm2.expression.expression import ExprId
 from miasm2.core.cpu import gen_reg, gen_regs
 
 exception_flags = ExprId('exception_flags', 32)
diff --git a/miasm2/arch/aarch64/sem.py b/miasm2/arch/aarch64/sem.py
index c8077ebf..4247a47f 100644
--- a/miasm2/arch/aarch64/sem.py
+++ b/miasm2/arch/aarch64/sem.py
@@ -1,5 +1,5 @@
 from miasm2.expression.expression import ExprId, ExprInt, ExprLoc, ExprMem, \
-    ExprSlice, ExprCond, ExprCompose, ExprOp, ExprAff
+    ExprCond, ExprCompose, ExprOp, ExprAff
 from miasm2.ir.ir import IntermediateRepresentation, IRBlock, AssignBlock
 from miasm2.arch.aarch64.arch import mn_aarch64, conds_expr, replace_regs
 from miasm2.arch.aarch64.regs import *
@@ -343,8 +343,6 @@ def cmp(ir, instr, arg1, arg2):
 def cmn(ir, instr, arg1, arg2):
     e = []
     arg2 = extend_arg(arg1, arg2)
-    res = arg1 + arg2
-
 
     e += update_flag_arith_add_zn(arg1, arg2)
     e += update_flag_arith_add_co(arg1, arg2)
@@ -443,8 +441,8 @@ def ccmp(ir, instr, arg1, arg2, arg3, arg4):
     res = arg1 - arg2
     new_nf = nf
     new_zf = update_flag_zf(res)[0].src
-    new_cf = update_flag_sub_cf(arg1, arg2, res).src
-    new_of = update_flag_sub_of(arg1, arg2, res).src
+    new_cf = update_flag_sub_cf(arg1, arg2).src
+    new_of = update_flag_sub_of(arg1, arg2).src
 
     e.append(ExprAff(nf, ExprCond(cond_expr,
                                                     new_nf,
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py
index e25e4911..67d73592 100644
--- a/miasm2/arch/arm/arch.py
+++ b/miasm2/arch/arm/arch.py
@@ -1915,7 +1915,6 @@ class arm_offspc(arm_offs):
         if v > (1 << (self.l - 1)) - 1:
             return False
         return v >> 1
-        return False
 
 
 class arm_off8sppc(arm_imm):
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 4e99e720..7dca6242 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -801,7 +801,6 @@ def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False)
             raise ValueError('unhandled case')
     elif size == 32:
         m = ExprMem(ad, size=size)
-        pass
     elif size == 64:
         assert a2 is not None
         m = ExprMem(ad, size=32)
@@ -1176,11 +1175,6 @@ def bfc(ir, instr, a, b, c):
         e.append(ExprAff(ir.IRDst, r))
     return e, []
 
-def rev(ir, instr, a, b):
-    e = []
-    c = ExprCompose(b[24:32], b[16:24], b[8:16], b[:8])
-    e.append(ExprAff(a, c))
-    return e, []
 
 def pld(ir, instr, a):
     e = []
diff --git a/miasm2/arch/mep/arch.py b/miasm2/arch/mep/arch.py
index a4c7182a..cf4fa96d 100644
--- a/miasm2/arch/mep/arch.py
+++ b/miasm2/arch/mep/arch.py
@@ -3,7 +3,8 @@
 
 from miasm2.core.cpu import *
 from miasm2.core.utils import Disasm_Exception
-from miasm2.expression.expression import *
+from miasm2.expression.expression import Expr, ExprId, ExprInt, ExprLoc, \
+    ExprMem, ExprOp
 from miasm2.core.asm_ast import AstId, AstMem
 
 from miasm2.arch.mep.regs import *
diff --git a/miasm2/arch/mep/regs.py b/miasm2/arch/mep/regs.py
index 9564d026..a515e76a 100644
--- a/miasm2/arch/mep/regs.py
+++ b/miasm2/arch/mep/regs.py
@@ -1,7 +1,7 @@
 # Toshiba MeP-c4 - miasm registers definition
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.expression.expression import *
+from miasm2.expression.expression import ExprId
 from miasm2.core.cpu import reg_info, gen_reg, gen_regs
 
 # Used by internal miasm exceptions
diff --git a/miasm2/arch/mep/sem.py b/miasm2/arch/mep/sem.py
index 3558de70..e1d4c5fa 100644
--- a/miasm2/arch/mep/sem.py
+++ b/miasm2/arch/mep/sem.py
@@ -505,8 +505,8 @@ def bnez(reg_test, disp8):
     """BNEZ - Branch if the register does not store zero."""
 
     # if(Rn!=0) PC <- PC + SignExt((disp8)7..1||0)
-    dst = disp8 if "-"(reg_test, i32(0)) else ExprLoc(ir.get_next_break_loc_key(instr), 32)
-    take_jmp = ExprInt(1, 32) if "-"(reg_test, i32(0)) else ExprInt(0, 32)
+    dst = disp8 if reg_test else ExprLoc(ir.get_next_break_loc_key(instr), 32)
+    take_jmp = ExprInt(1, 32) if reg_test else ExprInt(0, 32)
     PC = dst
     ir.IRDst = dst
 
@@ -516,8 +516,8 @@ def beqi(reg_test, imm4, disp16):
     """BEQI - Branch if the register stores imm4."""
 
     # if(Rn==ZeroExt(imm4)) PC <- PC +SignExt((disp17)16..1||0)
-    dst = ExprLoc(ir.get_next_break_loc_key(instr), 32) if "-"(reg_test, imm4) else disp16
-    take_jmp = ExprInt(0, 32) if "-"(reg_test, imm4) else ExprInt(1, 32)
+    dst = ExprLoc(ir.get_next_break_loc_key(instr), 32) if (reg_test - imm4) else disp16
+    take_jmp = ExprInt(0, 32) if (reg_test - imm4) else ExprInt(1, 32)
     PC = dst
     ir.IRDst = dst
 
@@ -527,8 +527,8 @@ def bnei(reg_test, imm4, disp16):
     """BNEI - Branch if the register does not store imm4."""
 
     # if(Rn!=ZeroExt(imm4)) PC <- PC+SignExt((disp17)16..1||0)
-    dst = disp16 if "-"(reg_test, imm4) else ExprLoc(ir.get_next_break_loc_key(instr), 32)
-    take_jmp = ExprInt(1, 32) if "-"(reg_test, imm4) else ExprInt(0, 32)
+    dst = disp16 if (reg_test - imm4) else ExprLoc(ir.get_next_break_loc_key(instr), 32)
+    take_jmp = ExprInt(1, 32) if (reg_test - imm4) else ExprInt(0, 32)
     PC = dst
     ir.IRDst = dst
 
@@ -560,8 +560,8 @@ def beq(rn, rm, disp16):
     """BEQ - Branch if the two registers are equal."""
 
     # if(Rn==Rm) PC <- PC +SignExt((disp17)16..1||0)
-    dst = ExprLoc(ir.get_next_break_loc_key(instr), 32) if "-"(rn, rm) else disp16
-    take_jmp = ExprInt(0, 32) if "-"(rn, rm) else ExprInt(1, 32)
+    dst = ExprLoc(ir.get_next_break_loc_key(instr), 32) if (rn - rm) else disp16
+    take_jmp = ExprInt(0, 32) if (rn - rm) else ExprInt(1, 32)
     PC = dst
     ir.IRDst = dst
 
@@ -571,8 +571,8 @@ def bne(rn, rm, disp16):
     """BNE - Branch if the two registers are not equal."""
 
     # if(Rn!=Rm) PC <- PC +SignExt((disp17)16..1||0)
-    dst = disp16 if "-"(rn, rm) else ExprLoc(ir.get_next_break_loc_key(instr), 32)
-    take_jmp = ExprInt(1, 32) if "-"(rn, rm) else ExprInt(0, 32)
+    dst = disp16 if (rn - rm) else ExprLoc(ir.get_next_break_loc_key(instr), 32)
+    take_jmp = ExprInt(1, 32) if (rn - rm) else ExprInt(0, 32)
     PC = dst
     ir.IRDst = dst
 
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index 974644dc..f963737e 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -3,7 +3,7 @@
 import logging
 from collections import defaultdict
 
-from pyparsing import Literal, Group, Optional
+from pyparsing import Literal, Optional
 
 from miasm2.expression.expression import ExprMem, ExprInt, ExprId, ExprOp, ExprLoc
 from miasm2.core.bin_stream import bin_stream
diff --git a/miasm2/arch/ppc/sem.py b/miasm2/arch/ppc/sem.py
index 7f165e96..3c885d12 100644
--- a/miasm2/arch/ppc/sem.py
+++ b/miasm2/arch/ppc/sem.py
@@ -184,7 +184,7 @@ def mn_do_div(ir, instr, rd, ra, rb):
         flags_update += mn_compute_flags(rvalue, over_expr)
 
     return ([ ExprAff(rd, rvalue) ] + flags_update), []
-    
+
 
 def mn_do_eqv(ir, instr, ra, rs, rb):
     rvalue = ~(rs ^ rb)
@@ -225,7 +225,6 @@ def mn_do_load(ir, instr, arg1, arg2, arg3=None):
         return mn_do_lmw(ir, instr, arg1, arg2)
     elif instr.name[1] == 'S':
         raise RuntimeError("LSWI, and LSWX need implementing")
-        pass # XXX
 
     size = {'B': 8, 'H': 16, 'W': 32}[instr.name[1]]
 
@@ -565,7 +564,6 @@ def mn_do_store(ir, instr, arg1, arg2, arg3=None):
 
     if instr.name[2] == 'S':
         raise RuntimeError("STSWI, and STSWX need implementing")
-        pass # XXX
 
     size = {'B': 8, 'H': 16, 'W': 32}[instr.name[2]]
 
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 8c140d7b..a00b6f7c 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -4995,7 +4995,6 @@ mnemo_func = {'mov': mov,
               'jns': jns,
               'jo': jo,
               'jno': jno,
-              'jecxz': jecxz,
               'loop': loop,
               'loopne': loopne,
               'loope': loope,
@@ -5041,8 +5040,6 @@ mnemo_func = {'mov': mov,
               'fucompp': fucompp,
               'comiss': comiss,
               'comisd': comisd,
-              'fcomi': fcomi,
-              'fcomip': fcomip,
               'nop': nop,
               'ud2': ud2,
               'prefetch0': prefetch0,
@@ -5146,7 +5143,6 @@ mnemo_func = {'mov': mov,
               'xlat': xlat,
               'bt': bt,
               'cpuid': cpuid,
-              'jo': jo,
               'fcom': fcom,
               'ftst': ftst,
               'fxam': fxam,
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py
index c00b4c5c..2f336617 100644
--- a/miasm2/core/asmblock.py
+++ b/miasm2/core/asmblock.py
@@ -4,8 +4,7 @@ import logging
 import warnings
 from collections import namedtuple
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprLoc, \
-    get_expr_locs
+from miasm2.expression.expression import ExprId, ExprInt, get_expr_locs
 from miasm2.expression.expression import LocKey
 from miasm2.expression.simplifications import expr_simp
 from miasm2.expression.modint import moduint, modint
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py
index 8491c5c8..4605a033 100644
--- a/miasm2/core/cpu.py
+++ b/miasm2/core/cpu.py
@@ -135,7 +135,6 @@ class reg_info_dct(object):
 
 def gen_reg(reg_name, sz=32):
     """Gen reg expr and parser"""
-    reg_name_lower = reg_name.lower()
     reg = m2_expr.ExprId(reg_name, sz)
     reginfo = reg_info([reg_name], [reg])
     return reg, reginfo
@@ -149,7 +148,6 @@ def gen_reg_bs(reg_name, reg_info, base_cls):
 
         bs_reg_name = bs(l=0, cls=(bs_reg_name,))
     """
-    reg_name_lower = reg_name.lower()
 
     bs_name = "bs_%s" % reg_name
     cls = type(bs_name, base_cls, {'reg': reg_info})
diff --git a/miasm2/core/ctypesmngr.py b/miasm2/core/ctypesmngr.py
index e99e3829..ef14451f 100644
--- a/miasm2/core/ctypesmngr.py
+++ b/miasm2/core/ctypesmngr.py
@@ -69,6 +69,9 @@ class CTypeId(CTypeBase):
         return (self.eq_base(other) and
                 self.names == other.names)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Id:%s>" % ', '.join(self.names)
 
@@ -92,6 +95,9 @@ class CTypeArray(CTypeBase):
                 self.target == other.target and
                 self.size == other.size)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Array[%s]:%s>" % (self.size, str(self.target))
 
@@ -113,6 +119,9 @@ class CTypePtr(CTypeBase):
         return (self.eq_base(other) and
                 self.target == other.target)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Ptr:%s>" % str(self.target)
 
@@ -139,6 +148,9 @@ class CTypeStruct(CTypeBase):
                 self.name == other.name and
                 self.fields == other.fields)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         out = []
         out.append("<Struct:%s>" % self.name)
@@ -191,6 +203,9 @@ class CTypeEnum(CTypeBase):
         return (self.eq_base(other) and
                 self.name == other.name)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Enum:%s>" % self.name
 
@@ -224,6 +239,9 @@ class CTypeFunc(CTypeBase):
                 self.type_ret == other.type_ret and
                 self.args == other.args)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Func:%s (%s) %s(%s)>" % (self.type_ret,
                                           self.abi,
@@ -240,6 +258,9 @@ class CTypeEllipsis(CTypeBase):
     def __eq__(self, other):
         return self.eq_base(other)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Ellipsis>"
 
@@ -258,6 +279,9 @@ class CTypeSizeof(CTypeBase):
         return (self.eq_base(other) and
                 self.target == other.target)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __str__(self):
         return "<Sizeof(%s)>" % self.target
 
diff --git a/miasm2/core/objc.py b/miasm2/core/objc.py
index 80f1e341..9649514d 100644
--- a/miasm2/core/objc.py
+++ b/miasm2/core/objc.py
@@ -464,6 +464,9 @@ class CGenInt(CGen):
         return (super(CGenInt, self).__eq__(other) and
                 self._integer == other.integer)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def to_c(self):
         """Generate corresponding C"""
 
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py
index aeb5d219..7ddf838c 100644
--- a/miasm2/core/parse_asm.py
+++ b/miasm2/core/parse_asm.py
@@ -1,8 +1,7 @@
 #-*- coding:utf-8 -*-
 import re
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprOp, ExprLoc, \
-    LocKey
+from miasm2.expression.expression import ExprId, ExprInt, ExprOp, LocKey
 import miasm2.core.asmblock as asmblock
 from miasm2.core.cpu import instruction, base_expr
 from miasm2.core.asm_ast import AstInt, AstId, AstOp
diff --git a/miasm2/core/types.py b/miasm2/core/types.py
index b0aca07e..e6ba1ccf 100644
--- a/miasm2/core/types.py
+++ b/miasm2/core/types.py
@@ -369,6 +369,9 @@ class RawStruct(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__ and self._fmt == other._fmt
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._fmt))
 
@@ -503,6 +506,9 @@ class Ptr(Num):
                 self._type_args == other._type_args and \
                 self._type_kwargs == other._type_kwargs
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((super(Ptr, self).__hash__(), self.dst_type,
             self._type_args))
@@ -673,6 +679,9 @@ class Struct(Type):
                 self.fields == other.fields and \
                 self.name == other.name
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         # Only hash name, not fields, because if a field is a Ptr to this
         # Struct type, an infinite loop occurs
@@ -862,6 +871,9 @@ class Array(Type):
                 self.field_type == other.field_type and \
                 self.array_len == other.array_len
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self.field_type, self.array_len))
 
@@ -926,6 +938,9 @@ class Bits(Type):
                 self._num == other._num and self._bits == other._bits and \
                 self._bit_offset == other._bit_offset
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._num, self._bits, self._bit_offset))
 
@@ -983,6 +998,9 @@ class BitField(Union):
         return self.__class__ == other.__class__ and \
                 self._num == other._num and super(BitField, self).__eq__(other)
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((super(BitField, self).__hash__(), self._num))
 
@@ -1095,6 +1113,9 @@ class Str(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__ and self._enc == other._enc
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash((self.__class__, self._enc))
 
@@ -1111,6 +1132,9 @@ class Void(Type):
     def __eq__(self, other):
         return self.__class__ == other.__class__
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __hash__(self):
         return hash(self.__class__)
 
diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py
index 2fe5e26d..bb0d5adf 100644
--- a/miasm2/expression/expression_helper.py
+++ b/miasm2/expression/expression_helper.py
@@ -572,7 +572,6 @@ def possible_values(expr):
         consvals.update(possible_values(expr.src))
     # Special case: constraint insertion
     elif isinstance(expr, m2_expr.ExprCond):
-        to_ret = set()
         src1cond = CondConstraintNotZero(expr.cond)
         src2cond = CondConstraintZero(expr.cond)
         consvals.update(ConstrainedValue(consval.constraints.union([src1cond]),
diff --git a/miasm2/expression/simplifications_common.py b/miasm2/expression/simplifications_common.py
index c786a6a5..b01b1d1d 100644
--- a/miasm2/expression/simplifications_common.py
+++ b/miasm2/expression/simplifications_common.py
@@ -322,7 +322,6 @@ def simp_cst_propagation(e_s, expr):
                 continue
             if stop > final_size:
                 tmp = tmp[:tmp.size  - (stop - final_size)]
-                stop = final_size
             filter_args.append(tmp)
             min_index = min(start, min_index)
         # create entry 0
@@ -347,7 +346,6 @@ def simp_cst_propagation(e_s, expr):
                 continue
             if start < 0:
                 tmp = tmp[-start:]
-                start = 0
             filter_args.append(tmp)
             max_index = max(stop, max_index)
         # create entry 0
@@ -363,7 +361,6 @@ def simp_cst_propagation(e_s, expr):
             bound = tuple([tmp.size for tmp in arg.args])
             bounds.add(bound)
         if len(bounds) == 1:
-            bound = list(bounds)[0]
             new_args = [[tmp] for tmp in args[0].args]
             for sub_arg in args[1:]:
                 for i, tmp in enumerate(sub_arg.args):
diff --git a/miasm2/expression/simplifications_explicit.py b/miasm2/expression/simplifications_explicit.py
index 047b0e88..54e9efc2 100644
--- a/miasm2/expression/simplifications_explicit.py
+++ b/miasm2/expression/simplifications_explicit.py
@@ -1,6 +1,5 @@
 from miasm2.expression.modint import size2mask
-from miasm2.expression.expression import ExprInt, ExprCond, ExprOp, \
-    ExprCompose
+from miasm2.expression.expression import ExprInt, ExprCond, ExprCompose
 
 
 def simp_ext(_, expr):
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 06eaae0a..db47d4ef 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -697,9 +697,9 @@ class DiGraphIR(IRCFG):
     Use IRCFG instead of DiGraphIR
     """
 
-    def __init__(self, irdst, loc_db, blocks=None, *args, **kwargs):
+    def __init__(self, *args, **kwargs):
         warnings.warn('DEPRECATION WARNING: use "IRCFG" instead of "DiGraphIR"')
-        super(IRCFG, self).__init__(irdst, loc_db, blocks=None, *args, **kwargs)
+        raise NotImplementedError("Depreceated")
 
 
 class IntermediateRepresentation(object):
diff --git a/miasm2/ir/symbexec_types.py b/miasm2/ir/symbexec_types.py
index 349d55a6..2b7643ca 100644
--- a/miasm2/ir/symbexec_types.py
+++ b/miasm2/ir/symbexec_types.py
@@ -28,6 +28,9 @@ class SymbolicStateCTypes(StateEngine):
             return False
         return self.symbols == other.symbols
 
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
     def __iter__(self):
         for dst, src in self._symbols:
             yield dst, src
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py
index 33c21049..89a2ac84 100644
--- a/miasm2/ir/translators/C.py
+++ b/miasm2/ir/translators/C.py
@@ -1,11 +1,9 @@
 from miasm2.ir.translators.translator import Translator
-from miasm2.core import asmblock
 from miasm2.expression.modint import size2mask
 from miasm2.expression.expression import ExprInt, ExprCond, ExprCompose
 
 def int_size_to_bn(value, size):
     if size < 32:
-        size = 32
         int_str = "%.8x" % value
         size_nibble = 8
     else:
@@ -259,8 +257,8 @@ class TranslatorC(Translator):
                     out = 'SHIFT_%s(%d, %s, %s)' % (
                         self.dct_shift[expr.op].upper(),
                         expr.args[0].size,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1])
+                        arg0,
+                        arg1
                     )
                 else:
                     op = {
@@ -315,8 +313,8 @@ class TranslatorC(Translator):
                     out = '(%s(%s, %s, %s) &%s)' % (
                         self.dct_rot[expr.op],
                         expr.args[0].size,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1]),
+                        arg0,
+                        arg1,
                         self._size2mask(expr.args[0].size),
                     )
                 else:
@@ -358,14 +356,14 @@ class TranslatorC(Translator):
                     out = '%s%d(%s, %s)' % (
                         expr.op,
                         expr.args[0].size,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1])
+                        arg0,
+                        arg1
                     )
                 else:
                     out = "bignum_%s(%s, %s)" % (
                         expr.op,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1])
+                        arg0,
+                        arg1
                     )
                     out = "bignum_mask(%s, %d)"% (out, expr.size)
                 return out
@@ -380,14 +378,14 @@ class TranslatorC(Translator):
                     out = '%s%d(%s, %s)' % (
                         expr.op,
                         expr.args[0].size,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1])
+                        arg0,
+                        arg1
                     )
                 else:
                     out = "bignum_%s(%s, %s, %d)" % (
                         expr.op,
-                        self.from_expr(expr.args[0]),
-                        self.from_expr(expr.args[1]),
+                        arg0,
+                        arg1,
                         expr.size
                     )
                     out = "bignum_mask(%s, %d)"% (out, expr.size)
diff --git a/miasm2/ir/translators/smt2.py b/miasm2/ir/translators/smt2.py
index 1a513bfb..f285c92a 100644
--- a/miasm2/ir/translators/smt2.py
+++ b/miasm2/ir/translators/smt2.py
@@ -1,5 +1,4 @@
 import logging
-import operator
 
 from miasm2.ir.translators.translator import Translator
 from miasm2.expression.smt2_helper import *
diff --git a/miasm2/ir/translators/z3_ir.py b/miasm2/ir/translators/z3_ir.py
index 1b0578b7..a481acd7 100644
--- a/miasm2/ir/translators/z3_ir.py
+++ b/miasm2/ir/translators/z3_ir.py
@@ -1,6 +1,5 @@
 import imp
 import logging
-import operator
 
 # Raise an ImportError if z3 is not available WITHOUT actually importing it
 imp.find_module("z3")
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py
index 69e83de5..ff6c1485 100644
--- a/miasm2/jitter/codegen.py
+++ b/miasm2/jitter/codegen.py
@@ -336,26 +336,17 @@ class CGen(object):
             offset = int(expr)
             loc_key = self.ir_arch.loc_db.get_or_create_offset_location(offset)
             self.add_label_index(dst2index, loc_key)
-
-            value, int_size = int_size_to_bn(offset, 64)
             out = hex(offset)
-
             return ("%s" % dst2index[loc_key], out)
         if expr.is_loc():
             loc_key = expr.loc_key
             offset = self.ir_arch.loc_db.get_location_offset(expr.loc_key)
             if offset is not None:
                 self.add_label_index(dst2index, loc_key)
-
-                value, int_size = int_size_to_bn(offset, 64)
                 out = hex(offset)
-
                 return ("%s" % dst2index[loc_key], out)
             self.add_label_index(dst2index, loc_key)
-
-            value, int_size = int_size_to_bn(0, 64)
             out = hex(0)
-
             return ("%s" % dst2index[loc_key], out)
         dst2index[expr] = -1
         return ("-1", self.id_to_c(expr))
diff --git a/miasm2/jitter/jitcore_python.py b/miasm2/jitter/jitcore_python.py
index b97727cd..dd4c543e 100644
--- a/miasm2/jitter/jitcore_python.py
+++ b/miasm2/jitter/jitcore_python.py
@@ -1,7 +1,7 @@
 import miasm2.jitter.jitcore as jitcore
 import miasm2.expression.expression as m2_expr
 import miasm2.jitter.csts as csts
-from miasm2.expression.simplifications import ExpressionSimplifier, expr_simp_explicit
+from miasm2.expression.simplifications import expr_simp_explicit
 from miasm2.jitter.emulatedsymbexec import EmulatedSymbExec
 
 ################################################################################
@@ -59,7 +59,6 @@ class JitCore_Python(jitcore.JitCore):
             exec_engine = self.symbexec
             expr_simp = exec_engine.expr_simp
 
-            known_loc_keys = set(irb.loc_key for irb in irblocks)
             # For each irbloc inside irblocks
             while True:
                 # Get the current bloc
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py
index 39ca3d56..89f5bada 100644
--- a/miasm2/jitter/jitload.py
+++ b/miasm2/jitter/jitload.py
@@ -2,12 +2,11 @@
 import logging
 import warnings
 from functools import wraps
-from collections import Sequence, namedtuple, Iterator
+from collections import Sequence, namedtuple
 
 from miasm2.jitter.csts import *
 from miasm2.core.utils import *
 from miasm2.core.bin_stream import bin_stream_vm
-from miasm2.core.interval import interval
 from miasm2.jitter.emulatedsymbexec import EmulatedSymbExec
 from miasm2.jitter.codegen import CGen
 from miasm2.jitter.jitcore_cc_base import JitCore_Cc_Base
@@ -131,7 +130,6 @@ class CallbackHandlerBitflag(CallbackHandler):
         callbacks return True, continue with next callback.
         Iterator on other results"""
 
-        res = True
         for bitflag_expected in self.callbacks:
             if bitflag_expected & bitflag == bitflag_expected:
                 # If the flag matched
diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py
index 0101152a..19f8c994 100644
--- a/miasm2/os_dep/win_api_x86_32.py
+++ b/miasm2/os_dep/win_api_x86_32.py
@@ -944,9 +944,7 @@ def kernel32_LoadLibraryExW(jitter):
 def kernel32_GetProcAddress(jitter):
     ret_ad, args = jitter.func_args_stdcall(["libbase", "fname"])
     fname = args.fname
-    if fname < 0x10000:
-        fname = fname
-    else:
+    if fname >= 0x10000:
         fname = jitter.get_str_ansi(fname, 0x100)
         if not fname:
             fname = None