[PULL 39/68] tcg: Validate op supported in opcode_args_ct

Richard Henderson posted 68 patches 3 months, 3 weeks ago
There is a newer version of this series
[PULL 39/68] tcg: Validate op supported in opcode_args_ct
Posted by Richard Henderson 3 months, 3 weeks ago
We should have checked that the op is supported before
emitting it.  The backend cannot be expected to have a
constraint set for unsupported ops.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/tcg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 32975fe298..b9119a1ec7 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3367,6 +3367,10 @@ static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)
     const TCGOpDef *def = &tcg_op_defs[op->opc];
     TCGConstraintSetIndex con_set;
 
+#ifdef CONFIG_DEBUG_TCG
+    assert(tcg_op_supported(op->opc, TCGOP_TYPE(op), TCGOP_FLAGS(op)));
+#endif
+
     if (def->nb_iargs + def->nb_oargs == 0) {
         return NULL;
     }
-- 
2.43.0