diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-20 15:18:53 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-16 20:37:00 +0100 |
| commit | 6e71cf2020fff606a8b57d095d34ffc5bea70d47 (patch) | |
| tree | 61a001587fa1b52a087ce2b33c4d3af1952674a7 /opcode.c | |
| parent | 4750ad6f4d4cb6c44aa86aacfc3a44a7429605fc (diff) | |
| download | sparse-dev-6e71cf2020fff606a8b57d095d34ffc5bea70d47.tar.gz | |
canonicalize compare instructions
Currently only commutative instructions are canonicalized
(the "simpler" operands, often a constant, is forced, if present
to be in the second operand). This improve CSE (more cases are
considered as equivalent) and help to reduce the number of "pattern"
to be handled at simplification.
Do this also for compare instructions since in thsi case we can
swap the order of the operands if at the same time we also swap
the 'direction' on the comparison.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -23,14 +23,14 @@ #include "linearize.h" const struct opcode_table opcode_table[OP_LAST] = { - [OP_SET_EQ] = { .negate = OP_SET_NE, }, - [OP_SET_NE] = { .negate = OP_SET_EQ, }, - [OP_SET_LT] = { .negate = OP_SET_GE, }, - [OP_SET_LE] = { .negate = OP_SET_GT, }, - [OP_SET_GE] = { .negate = OP_SET_LT, }, - [OP_SET_GT] = { .negate = OP_SET_LE, }, - [OP_SET_B ] = { .negate = OP_SET_AE, }, - [OP_SET_BE] = { .negate = OP_SET_A , }, - [OP_SET_AE] = { .negate = OP_SET_B , }, - [OP_SET_A ] = { .negate = OP_SET_BE, }, + [OP_SET_EQ] = { .negate = OP_SET_NE, .swap = OP_SET_EQ, }, + [OP_SET_NE] = { .negate = OP_SET_EQ, .swap = OP_SET_NE, }, + [OP_SET_LT] = { .negate = OP_SET_GE, .swap = OP_SET_GT, }, + [OP_SET_LE] = { .negate = OP_SET_GT, .swap = OP_SET_GE, }, + [OP_SET_GE] = { .negate = OP_SET_LT, .swap = OP_SET_LE, }, + [OP_SET_GT] = { .negate = OP_SET_LE, .swap = OP_SET_LT, }, + [OP_SET_B ] = { .negate = OP_SET_AE, .swap = OP_SET_A , }, + [OP_SET_BE] = { .negate = OP_SET_A , .swap = OP_SET_AE, }, + [OP_SET_AE] = { .negate = OP_SET_B , .swap = OP_SET_BE, }, + [OP_SET_A ] = { .negate = OP_SET_BE, .swap = OP_SET_B , }, }; |
