All of lore.kernel.org
 help / color / mirror / Atom feed
From: Taylor Simpson <tsimpson@quicinc.com>
To: Alessandro Di Federico <ale.qemu@rev.ng>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "babush@rev.ng" <babush@rev.ng>, Brian Cain <bcain@quicinc.com>,
	"richard.henderson@linaro.org" <richard.henderson@linaro.org>,
	"nizzo@rev.ng" <nizzo@rev.ng>,
	Alessandro Di Federico <ale@rev.ng>
Subject: RE: [PATCH v6 07/12] target/hexagon: prepare input for the idef-parser
Date: Tue, 7 Sep 2021 18:09:01 +0000	[thread overview]
Message-ID: <BYAPR02MB48869CA040DC32F2244A1952DED39@BYAPR02MB4886.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20210720123031.1101682-8-ale.qemu@rev.ng>



> -----Original Message-----
> From: Alessandro Di Federico <ale.qemu@rev.ng>
> Sent: Tuesday, July 20, 2021 7:30 AM
> To: qemu-devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>; babush@rev.ng; nizzo@rev.ng;
> richard.henderson@linaro.org; Alessandro Di Federico <ale@rev.ng>
> Subject: [PATCH v6 07/12] target/hexagon: prepare input for the idef-parser
> 
> From: Alessandro Di Federico <ale@rev.ng>
> 
> Introduce infrastructure necessary to produce a file suitable for being parsed
> by the idef-parser.
> 
> Signed-off-by: Alessandro Di Federico <ale@rev.ng>


> diff --git a/target/hexagon/gen_idef_parser_funcs.py
> b/target/hexagon/gen_idef_parser_funcs.py
> new file mode 100644
> index 0000000000..7b8e0f6981
> --- /dev/null
> +++ b/target/hexagon/gen_idef_parser_funcs.py
> +def main():
> +    hex_common.read_semantics_file(sys.argv[1])
> +    hex_common.read_attribs_file(sys.argv[2])
> +    hex_common.read_overrides_file(sys.argv[3])

Do you really need the overrides file?


> diff --git a/target/hexagon/idef-parser/macros.inc b/target/hexagon/idef-
> parser/macros.inc
> new file mode 100644
> index 0000000000..20535691e8
> --- /dev/null
> +++ b/target/hexagon/idef-parser/macros.inc


> +/* Ease parsing */

> +#define fADDSAT64(DST, A, B)                                            \
> +    __a = fCAST8u(A);                                                   \
> +    __b = fCAST8u(B);                                                   \
> +    __sum = __a + __b;                                                  \
> +    __xor = __a ^ __b;                                                  \
> +    __mask = fCAST8s(0x8000000000000000ULL);                            \
> +    if (((__a ^ __b) | ~(__a ^ __sum)) & __mask) {                      \
> +        DST = __sum;                                                    \
> +    } else {                                                            \
> +        DST = ((__sum & __mask) >> 63) + __mask;                        \
> +        fSET_OVERFLOW();                                                \
> +    }

There are a bunch of these with pretty complex semantics.  Wouldn't it be easier to recognize them in the parser and call a hand-written helper?

> +/* Assignments */
> +#define fPCALIGN(IMM) (IMM = IMM & ~3)
> +#define fWRITE_LR(A) (LR = A)
> +#define fWRITE_FP(A) (FP = A)
> +#define fWRITE_SP(A) (SP = A)
> +#define fBRANCH(LOC, TYPE) (PC = LOC)
> +#define fJUMPR(REGNO, TARGET, TYPE) (PC = TARGET)

This should invoke write_new_pc because there may be more than one in the same packet.

> +fWRITE_NPC(VAL) (PC = VAL)

Ditto

> +/* Binary operators */
> +#define fADD128(A, B) (A + B)
> +#define fSUB128(A, B) (A - B)
> +#define fSHIFTR128(A, B) (size8s_t) (A >> B)
> +#define fSHIFTL128(A, B) (A << B)
> +#define fAND128(A, B) (A & B)

Will these operate on 128 bit numbers?



  reply	other threads:[~2021-09-07 18:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 12:30 [PATCH v6 00/12] target/hexagon: introduce idef-parser Alessandro Di Federico via
2021-07-20 12:30 ` [PATCH v6 01/12] target/hexagon: update MAINTAINERS for idef-parser Alessandro Di Federico via
2021-09-07 18:09   ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 02/12] target/hexagon: import README " Alessandro Di Federico via
2021-09-07 18:09   ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 03/12] target/hexagon: make slot number an unsigned Alessandro Di Federico via
2021-09-07 18:09   ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 04/12] target/hexagon: make helper functions non-static Alessandro Di Federico via
2021-07-20 12:30 ` [PATCH v6 05/12] target/hexagon: introduce new helper functions Alessandro Di Federico via
2021-09-07 18:09   ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 06/12] target/hexagon: expose next PC in DisasContext Alessandro Di Federico via
2021-07-20 12:30 ` [PATCH v6 07/12] target/hexagon: prepare input for the idef-parser Alessandro Di Federico via
2021-09-07 18:09   ` Taylor Simpson [this message]
2021-10-18 11:23     ` Anton Johansson via
2021-10-28 15:44       ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 08/12] target/hexagon: import lexer for idef-parser Alessandro Di Federico via
2021-09-07 18:08   ` Taylor Simpson
2021-10-18 11:37     ` Anton Johansson via
2021-10-28 15:49       ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 09/12] target/hexagon: import parser " Alessandro Di Federico via
2021-09-07 18:08   ` Taylor Simpson
2021-09-08  6:35     ` Richard Henderson
2021-10-18 11:42     ` Anton Johansson via
2021-10-28 15:56       ` Taylor Simpson
2021-07-20 12:30 ` [PATCH v6 10/12] target/hexagon: call idef-parser functions Alessandro Di Federico via
2021-07-20 12:30 ` [PATCH v6 11/12] target/hexagon: import additional tests Alessandro Di Federico via
2021-07-20 12:30 ` [PATCH v6 12/12] gitlab-ci: do not use qemu-project Docker registry Alessandro Di Federico via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR02MB48869CA040DC32F2244A1952DED39@BYAPR02MB4886.namprd02.prod.outlook.com \
    --to=tsimpson@quicinc.com \
    --cc=ale.qemu@rev.ng \
    --cc=ale@rev.ng \
    --cc=babush@rev.ng \
    --cc=bcain@quicinc.com \
    --cc=nizzo@rev.ng \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.