diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-10-09 07:40:52 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-10-09 08:17:50 +0200 |
| commit | e5c439d3b4ee7120fae3d15ae7106cce8d0dcbde (patch) | |
| tree | 4cd9776c937960779dd213f20a002a8a8880b92a /miasm2/expression/simplifications_cond.py | |
| parent | a11964b49954c7bba71264b5b27e31cec01e8481 (diff) | |
| download | miasm-e5c439d3b4ee7120fae3d15ae7106cce8d0dcbde.tar.gz miasm-e5c439d3b4ee7120fae3d15ae7106cce8d0dcbde.zip | |
Simplifications: simplify by default high level op
Simplifify by default high level operators (<u, ...) with pure cst as arguments
Diffstat (limited to '')
| -rw-r--r-- | miasm2/expression/simplifications_cond.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/miasm2/expression/simplifications_cond.py b/miasm2/expression/simplifications_cond.py index 6bdc810f..f6b1ea8b 100644 --- a/miasm2/expression/simplifications_cond.py +++ b/miasm2/expression/simplifications_cond.py @@ -176,57 +176,3 @@ def expr_simp_equal(expr_simp, e): return e return ExprOp_equal(r[jok1], expr_simp(-r[jok2])) - -# Compute conditions - -def exec_inf_unsigned(expr_simp, e): - "Compute x <u y" - if e.op != m2_expr.TOK_INF_UNSIGNED: - return e - - arg1, arg2 = e.args - - if isinstance(arg1, m2_expr.ExprInt) and isinstance(arg2, m2_expr.ExprInt): - return m2_expr.ExprInt(1, 1) if (arg1.arg < arg2.arg) else m2_expr.ExprInt(0, 1) - else: - return e - - -def __comp_signed(arg1, arg2): - """Return ExprInt(1, 1) if arg1 <s arg2 else ExprInt(0, 1) - @arg1, @arg2: ExprInt""" - - val1 = int(arg1) - if val1 >> (arg1.size - 1) == 1: - val1 = - ((int(arg1.mask) ^ val1) + 1) - - val2 = int(arg2) - if val2 >> (arg2.size - 1) == 1: - val2 = - ((int(arg2.mask) ^ val2) + 1) - - return m2_expr.ExprInt(1, 1) if (val1 < val2) else m2_expr.ExprInt(0, 1) - -def exec_inf_signed(expr_simp, e): - "Compute x <s y" - - if e.op != m2_expr.TOK_INF_SIGNED: - return e - - arg1, arg2 = e.args - - if isinstance(arg1, m2_expr.ExprInt) and isinstance(arg2, m2_expr.ExprInt): - return __comp_signed(arg1, arg2) - else: - return e - -def exec_equal(expr_simp, e): - "Compute x == y" - - if e.op != m2_expr.TOK_EQUAL: - return e - - arg1, arg2 = e.args - if isinstance(arg1, m2_expr.ExprInt) and isinstance(arg2, m2_expr.ExprInt): - return m2_expr.ExprInt(1, 1) if (arg1.arg == arg2.arg) else m2_expr.ExprInt(0, 1) - else: - return e |