Re: [PATCH v6 02/15] add table to "negate" some opcode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 28, 2017 at 1:33 AM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:

> +
> +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, },
> +};

The .negate member is only used by simplify_seteq_setne()
Also the .swap member is only used by canonicalize_compare()
in the later patch. Why not make it just two array local to those function
who use it? I am not sure this need to be a global data structure.
This is very minor, I can also accept it as it is.

Also I would like to point out, at the code that use it. In a later patch.
+       insn->opcode = opcode_table[insn->opcode].swap;

That is a different behavior than the V4 patch. In the V4 patch
if your input opcode is not in the compare group, the opcode
is not changed. Here .negate and .swap will get to zero as opcode.

You might want to check for that.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux