diff mbox series

[RFC,v3,10/34] Hexagon (target/hexagon) instruction and packet types

Message ID 1597765847-16637-11-git-send-email-tsimpson@quicinc.com (mailing list archive)
State New, archived
Headers show
Series [RFC,v3,01/34] Hexagon Update MAINTAINERS file | expand

Commit Message

Taylor Simpson Aug. 18, 2020, 3:50 p.m. UTC
The insn_t and packet_t are the interface between instruction decoding and
TCG code generation

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
 target/hexagon/insn.h | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 target/hexagon/insn.h

Comments

Richard Henderson Aug. 26, 2020, 2:22 p.m. UTC | #1
On 8/18/20 8:50 AM, Taylor Simpson wrote:
> +struct Instruction {
> +    semantic_insn_t generate;            /* pointer to genptr routine */
> +    size1u_t regno[REG_OPERANDS_MAX];    /* reg operands including predicates */
> +    size2u_t opcode;
> +
> +    size4u_t iclass:6;
> +    size4u_t slot:3;
> +    size4u_t part1:1;        /*
> +                              * cmp-jumps are split into two insns.
> +                              * set for the compare and clear for the jump
> +                              */
> +    size4u_t extension_valid:1;   /* Has a constant extender attached */
> +    size4u_t which_extended:1;    /* If has an extender, which immediate */
> +    size4u_t is_endloop:1;   /* This is an end of loop */
> +    size4u_t new_value_producer_slot:4;
> +    size4s_t immed[IMMEDS_MAX];    /* immediate field */
> +};

Is this an imported file or not?

If it is not imported, I'd very much prefer that we stick to the stdint.h type
names.


r~
Taylor Simpson Aug. 26, 2020, 11:52 p.m. UTC | #2
> -----Original Message-----
> From: Richard Henderson <richard.henderson@linaro.org>
> Sent: Wednesday, August 26, 2020 8:22 AM
> To: Taylor Simpson <tsimpson@quicinc.com>; qemu-devel@nongnu.org
> Cc: ale@rev.ng; riku.voipio@iki.fi; laurent@vivier.eu; philmd@redhat.com;
> aleksandar.m.mail@gmail.com
> Subject: Re: [RFC PATCH v3 10/34] Hexagon (target/hexagon) instruction and
> packet types
>
> On 8/18/20 8:50 AM, Taylor Simpson wrote:
> > +struct Instruction {
> > +    semantic_insn_t generate;            /* pointer to genptr routine */
> > +    size1u_t regno[REG_OPERANDS_MAX];    /* reg operands including
> predicates */
> > +    size2u_t opcode;
> > +
> > +    size4u_t iclass:6;
> > +    size4u_t slot:3;
> > +    size4u_t part1:1;        /*
> > +                              * cmp-jumps are split into two insns.
> > +                              * set for the compare and clear for the jump
> > +                              */
> > +    size4u_t extension_valid:1;   /* Has a constant extender attached */
> > +    size4u_t which_extended:1;    /* If has an extender, which immediate
> */
> > +    size4u_t is_endloop:1;   /* This is an end of loop */
> > +    size4u_t new_value_producer_slot:4;
> > +    size4s_t immed[IMMEDS_MAX];    /* immediate field */
> > +};
>
> Is this an imported file or not?
>
> If it is not imported, I'd very much prefer that we stick to the stdint.h type
> names.

Agreed.  My goal is to stick with stdint.h types outside the imported directory.  I'll change this.
diff mbox series

Patch

diff --git a/target/hexagon/insn.h b/target/hexagon/insn.h
new file mode 100644
index 0000000..aa2d1dd
--- /dev/null
+++ b/target/hexagon/insn.h
@@ -0,0 +1,75 @@ 
+/*
+ *  Copyright(c) 2019-2020 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef HEXAGON_INSN_H
+#define HEXAGON_INSN_H
+
+#include "cpu.h"
+#include "hex_arch_types.h"
+
+#define INSTRUCTIONS_MAX 7    /* 2 pairs + loopend */
+#define REG_OPERANDS_MAX 5
+#define IMMEDS_MAX 2
+
+struct Instruction;
+struct Packet;
+struct DisasContext;
+
+typedef void (*semantic_insn_t)(CPUHexagonState *env,
+                                struct DisasContext *ctx,
+                                struct Instruction *insn,
+                                struct Packet *pkt);
+
+struct Instruction {
+    semantic_insn_t generate;            /* pointer to genptr routine */
+    size1u_t regno[REG_OPERANDS_MAX];    /* reg operands including predicates */
+    size2u_t opcode;
+
+    size4u_t iclass:6;
+    size4u_t slot:3;
+    size4u_t part1:1;        /*
+                              * cmp-jumps are split into two insns.
+                              * set for the compare and clear for the jump
+                              */
+    size4u_t extension_valid:1;   /* Has a constant extender attached */
+    size4u_t which_extended:1;    /* If has an extender, which immediate */
+    size4u_t is_endloop:1;   /* This is an end of loop */
+    size4u_t new_value_producer_slot:4;
+    size4s_t immed[IMMEDS_MAX];    /* immediate field */
+};
+
+typedef struct Instruction insn_t;
+
+struct Packet {
+    size2u_t num_insns;
+    size2u_t encod_pkt_size_in_bytes;
+
+    /* Pre-decodes about COF */
+    size8u_t pkt_has_cof:1;          /* Has any change-of-flow */
+    size8u_t pkt_has_endloop:1;
+
+    size8u_t pkt_has_dczeroa:1;
+
+    size8u_t pkt_has_store_s0:1;
+    size8u_t pkt_has_store_s1:1;
+
+    insn_t insn[INSTRUCTIONS_MAX];
+};
+
+typedef struct Packet packet_t;
+
+#endif