qemu-e2k/target/hexagon/iclass.c
Taylor Simpson 4c82c2b433 target/hexagon: remove unnecessary checks in find_iclass_slots
Reported-by: Richard Henderson <<richard.henderson@linaro.org>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1615784037-26129-1-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2021-05-01 08:31:42 -07:00

70 lines
2.5 KiB
C

/*
* Copyright(c) 2019-2021 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/>.
*/
#include "qemu/osdep.h"
#include "iclass.h"
static const SlotMask iclass_info[] = {
#define DEF_PP_ICLASS32(TYPE, SLOTS, UNITS) \
[ICLASS_FROM_TYPE(TYPE)] = SLOTS_##SLOTS,
#define DEF_EE_ICLASS32(TYPE, SLOTS, UNITS) \
[ICLASS_FROM_TYPE(TYPE)] = SLOTS_##SLOTS,
#include "imported/iclass.def"
#undef DEF_PP_ICLASS32
#undef DEF_EE_ICLASS32
};
SlotMask find_iclass_slots(Opcode opcode, int itype)
{
/* There are some exceptions to what the iclass dictates */
if (GET_ATTRIB(opcode, A_ICOP)) {
return SLOTS_2;
} else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT0ONLY)) {
return SLOTS_0;
} else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT1ONLY)) {
return SLOTS_1;
} else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT2ONLY)) {
return SLOTS_2;
} else if (GET_ATTRIB(opcode, A_RESTRICT_SLOT3ONLY)) {
return SLOTS_3;
} else if (GET_ATTRIB(opcode, A_COF) &&
GET_ATTRIB(opcode, A_INDIRECT) &&
!GET_ATTRIB(opcode, A_MEMLIKE) &&
!GET_ATTRIB(opcode, A_MEMLIKE_PACKET_RULES)) {
return SLOTS_2;
} else if (GET_ATTRIB(opcode, A_RESTRICT_NOSLOT1)) {
return SLOTS_0;
} else if ((opcode == J2_trap0) ||
(opcode == Y2_isync) ||
(opcode == J2_pause) || (opcode == J4_hintjumpr)) {
return SLOTS_2;
} else if (GET_ATTRIB(opcode, A_CRSLOT23)) {
return SLOTS_23;
} else if (GET_ATTRIB(opcode, A_RESTRICT_PREFERSLOT0)) {
return SLOTS_0;
} else if (GET_ATTRIB(opcode, A_SUBINSN)) {
return SLOTS_01;
} else if (GET_ATTRIB(opcode, A_CALL)) {
return SLOTS_23;
} else if ((opcode == J4_jumpseti) || (opcode == J4_jumpsetr)) {
return SLOTS_23;
} else {
return iclass_info[itype];
}
}