def __init__(self, ir_arch, bs=None): super(JitCore_Python, self).__init__(ir_arch, bs) self.ir_arch = ir_arch # CPU & VM (None for now) will be set later expr_simp = ExpressionSimplifier() expr_simp.enable_passes(ExpressionSimplifier.PASS_COMMONS) self.symbexec = self.SymbExecClass(None, None, self.ir_arch, {}, sb_expr_simp=expr_simp) self.symbexec.enable_emulated_simplifications()
(ExprOp_inf_unsigned(a, b) ^ (a ^ b).msb(), ExprOp_inf_signed(a, b)), (ExprOp_inf_signed(a, b) ^ (a ^ b).msb(), ExprOp_inf_unsigned(a, b)), (ExprOp_equal(ExprInt(12, 32), ExprInt(10, 32)), ExprInt(0, 1)), (ExprOp_equal(ExprInt(12, 32), ExprInt(12, 32)), ExprInt(1, 1)), (ExprOp_equal(ExprInt(12, 32), ExprInt(-12, 32)), ExprInt(0, 1)), (ExprCond(a - b, ExprInt(0, 1), ExprInt(1, 1)), ExprOp_equal(a, b)), (ExprCond(a + b, ExprInt(0, 1), ExprInt(1, 1)), ExprOp_equal(a, -b)), (ExprOp_inf_signed(ExprInt(-2, 32), ExprInt(3, 32)), ExprInt(1, 1)), (ExprOp_inf_signed(ExprInt(3, 32), ExprInt(-3, 32)), ExprInt(0, 1)), (ExprOp_inf_signed(ExprInt(2, 32), ExprInt(3, 32)), ExprInt(1, 1)), (ExprOp_inf_signed(ExprInt(-3, 32), ExprInt(-2, 32)), ExprInt(1, 1)), (ExprOp_inf_signed(ExprInt(0, 32), ExprInt(2, 32)), ExprInt(1, 1)), (ExprOp_inf_signed(ExprInt(-3, 32), ExprInt(0, 32)), ExprInt(1, 1)), ] expr_simp_cond = ExpressionSimplifier() expr_simp.enable_passes(ExpressionSimplifier.PASS_COND) for e, e_check in to_test[:]: # print "#" * 80 e_check = expr_simp(e_check) # print str(e), str(e_check) e_new = expr_simp(e) print "original: ", str(e), "new: ", str(e_new) rez = e_new == e_check if not rez: raise ValueError( 'bug in expr_simp simp(%s) is %s and should be %s' % (e, e_new, e_check))