aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-27 14:30:01 -0800
committerRichard Henderson <richard.henderson@linaro.org>2025-01-16 20:57:16 -0800
commitda43e5e6ba64fbe50d6437719470d57874939542 (patch)
tree18c01a7e2de427bf9068400f944aa5f8fe7a8cf3 /tcg/tcg.c
parent12f06532c86467c2efac13f6cd630fa5c6f7bda8 (diff)
downloadqemu-da43e5e6ba64fbe50d6437719470d57874939542.zip
qemu-da43e5e6ba64fbe50d6437719470d57874939542.tar.gz
qemu-da43e5e6ba64fbe50d6437719470d57874939542.tar.bz2
tcg: Use C_NotImplemented in tcg_target_op_def
Return C_NotImplemented instead of asserting for opcodes not implemented by the backend. For now, the assertion moves to process_op_defs. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 3576299..05bb464 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -862,6 +862,7 @@ static int tcg_out_pool_finalize(TCGContext *s)
#define C_N1_O1_I4(O1, O2, I1, I2, I3, I4) C_PFX6(c_n1_o1_i4_, O1, O2, I1, I2, I3, I4),
typedef enum {
+ C_NotImplemented = -1,
#include "tcg-target-con-set.h"
} TCGConstraintSetIndex;
@@ -3176,6 +3177,7 @@ static void process_op_defs(TCGContext *s)
const TCGTargetOpDef *tdefs;
bool saw_alias_pair = false;
int i, o, i2, o2, nb_args;
+ TCGConstraintSetIndex con_set;
if (def->flags & TCG_OPF_NOT_PRESENT) {
continue;
@@ -3188,11 +3190,11 @@ static void process_op_defs(TCGContext *s)
/*
* Macro magic should make it impossible, but double-check that
- * the array index is in range. Since the signness of an enum
- * is implementation defined, force the result to unsigned.
+ * the array index is in range. At the same time, double-check
+ * that the opcode is implemented, i.e. not C_NotImplemented.
*/
- unsigned con_set = tcg_target_op_def(op);
- tcg_debug_assert(con_set < ARRAY_SIZE(constraint_sets));
+ con_set = tcg_target_op_def(op);
+ tcg_debug_assert(con_set >= 0 && con_set < ARRAY_SIZE(constraint_sets));
tdefs = &constraint_sets[con_set];
for (i = 0; i < nb_args; i++) {