Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / target / hexagon / insn.h
blob24dcf7fe9f38562b795e2b03699d4759ccc38264
1 /*
2 * Copyright(c) 2019-2024 Qualcomm Innovation Center, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #ifndef HEXAGON_INSN_H
19 #define HEXAGON_INSN_H
21 #include "cpu.h"
23 #define INSTRUCTIONS_MAX 7 /* 2 pairs + loopend */
24 #define REG_OPERANDS_MAX 5
25 #define IMMEDS_MAX 2
27 struct Instruction;
28 struct Packet;
29 struct DisasContext;
31 typedef void (*SemanticInsn)(struct DisasContext *ctx);
33 struct Instruction {
34 SemanticInsn generate; /* pointer to genptr routine */
35 uint8_t regno[REG_OPERANDS_MAX]; /* reg operands including predicates */
36 uint16_t opcode;
38 uint32_t iclass:6;
39 uint32_t slot:3;
40 uint32_t which_extended:1; /* If has an extender, which immediate */
41 uint32_t new_value_producer_slot:4;
42 int32_t new_read_idx;
43 int32_t dest_idx;
44 bool has_pred_dest;
46 bool part1; /*
47 * cmp-jumps are split into two insns.
48 * set for the compare and clear for the jump
50 bool extension_valid; /* Has a constant extender attached */
51 bool is_endloop; /* This is an end of loop */
52 int32_t immed[IMMEDS_MAX]; /* immediate field */
55 typedef struct Instruction Insn;
57 struct Packet {
58 uint16_t num_insns;
59 uint16_t encod_pkt_size_in_bytes;
60 uint32_t pc;
62 /* Pre-decodes about COF */
63 bool pkt_has_cof; /* Has any change-of-flow */
64 bool pkt_has_multi_cof; /* Has more than one change-of-flow */
65 bool pkt_has_endloop;
67 bool pkt_has_dczeroa;
69 bool pkt_has_store_s0;
70 bool pkt_has_store_s1;
72 bool pkt_has_hvx;
73 Insn *vhist_insn;
75 Insn insn[INSTRUCTIONS_MAX];
78 typedef struct Packet Packet;
80 #endif