[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v3 24/34] Hexagon (target/hexagon) opcode data structures
From: |
Richard Henderson |
Subject: |
Re: [RFC PATCH v3 24/34] Hexagon (target/hexagon) opcode data structures |
Date: |
Wed, 26 Aug 2020 08:25:35 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/18/20 8:50 AM, Taylor Simpson wrote:
> +extern const char *opcode_names[];
> +
> +extern const char *opcode_reginfo[];
> +extern const char *opcode_rregs[];
> +extern const char *opcode_wregs[];
const char * const
> +extern opcode_encoding_t opcode_encodings[XX_LAST_OPCODE];
const.
> +extern size4u_t
> + opcode_attribs[XX_LAST_OPCODE][(A_ZZ_LASTATTRIB / ATTRIB_WIDTH) + 1];
const.
And using qemu/bitops.h if possible, as discussed earlier vs attribs.h.
> +const char *opcode_short_semantics[] = {
> +#define OPCODE(X) NULL
> +#include "opcodes_def_generated.h"
> +#undef OPCODE
> + NULL
> +};
...
> +#define DEF_SHORTCODE(TAG, SHORTCODE) \
> + opcode_short_semantics[TAG] = #SHORTCODE;
> +#include "shortcode_generated.h"
> +#undef DEF_SHORTCODE
Just initialize opcode_short_semantics with shortcode_generated.h in the first
place. Then you don't need to create a table of NULL and overwrite at startup.
And you can also make the table constant.
> + if (p == NULL) {
> + g_assert_not_reached();
> + return 0;
> + }
I prefer assert(p != NULL) to if (test) { abort(); }, where possible. E.g.
this later one is fine:
> + if (islower(*p)) {
> + return 0;
> + } else if (isupper(*p)) {
> + return 1;
> + } else {
> + g_assert_not_reached();
> + }
r~
[RFC PATCH v3 18/34] Hexagon (target/hexagon/imported) arch import - instruction semantics, Taylor Simpson, 2020/08/18
[RFC PATCH v3 19/34] Hexagon (target/hexagon/imported) arch import - instruction encoding, Taylor Simpson, 2020/08/18
[RFC PATCH v3 25/34] Hexagon (target/hexagon) macros to interface with the generator, Taylor Simpson, 2020/08/18
[RFC PATCH v3 20/34] Hexagon (target/hexagon) generator phase 1 - C preprocessor for semantics, Taylor Simpson, 2020/08/18