m68k: add a system controller
[qemu/ar7.git] / target / hexagon / iclass.c
blob378d8a6a75233ad445903a5f814c6f63af3d25de
1 /*
2 * Copyright(c) 2019-2021 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 #include "qemu/osdep.h"
19 #include "iclass.h"
21 static const SlotMask iclass_info[] = {
23 #define DEF_PP_ICLASS32(TYPE, SLOTS, UNITS) \
24 [ICLASS_FROM_TYPE(TYPE)] = SLOTS_##SLOTS,
25 #define DEF_EE_ICLASS32(TYPE, SLOTS, UNITS) \
26 [ICLASS_FROM_TYPE(TYPE)] = SLOTS_##SLOTS,
27 #include "imported/iclass.def"
28 #undef DEF_PP_ICLASS32
29 #undef DEF_EE_ICLASS32
32 SlotMask find_iclass_slots(Opcode opcode, int itype)
34 /* There are some exceptions to what the iclass dictates */
35 if (GET_ATTRIB(opcode, A_ICOP)) {
36 return SLOTS_2;
37 } else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT0ONLY)) {
38 return SLOTS_0;
39 } else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT1ONLY)) {
40 return SLOTS_1;
41 } else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT2ONLY)) {
42 return SLOTS_2;
43 } else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT3ONLY)) {
44 return SLOTS_3;
45 } else if (GET_ATTRIB(opcode, A_COF) &&
46 GET_ATTRIB(opcode, A_INDIRECT) &&
47 !GET_ATTRIB(opcode, A_MEMLIKE) &&
48 !GET_ATTRIB(opcode, A_MEMLIKE_PACKET_RULES)) {
49 return SLOTS_2;
50 } else if (GET_ATTRIB(opcode, A_RESTRICT_NOSLOT1)) {
51 return SLOTS_0;
52 } else if ((opcode == J2_trap0) ||
53 (opcode == Y2_isync) ||
54 (opcode == J2_pause) || (opcode == J4_hintjumpr)) {
55 return SLOTS_2;
56 } else if ((itype == ICLASS_V2LDST) && (GET_ATTRIB(opcode, A_STORE))) {
57 return SLOTS_01;
58 } else if ((itype == ICLASS_V2LDST) && (!GET_ATTRIB(opcode, A_STORE))) {
59 return SLOTS_01;
60 } else if (GET_ATTRIB(opcode, A_CRSLOT23)) {
61 return SLOTS_23;
62 } else if (GET_ATTRIB(opcode, A_RESTRICT_PREFERSLOT0)) {
63 return SLOTS_0;
64 } else if (GET_ATTRIB(opcode, A_SUBINSN)) {
65 return SLOTS_01;
66 } else if (GET_ATTRIB(opcode, A_CALL)) {
67 return SLOTS_23;
68 } else if ((opcode == J4_jumpseti) || (opcode == J4_jumpsetr)) {
69 return SLOTS_23;
70 } else {
71 return iclass_info[itype];