tcg: Constify tcg_op_defs
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 27 Dec 2024 20:53:22 +0000 (12:53 -0800)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 17 Jan 2025 04:57:16 +0000 (20:57 -0800)
Now that we're no longer assigning to TCGOpDef.args_ct,
we can make the array constant.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/tcg/tcg.h
tcg/tcg-common.c
tcg/tcg.c

index e28894c57bb3746496e75e090ff5b0d7b7c3efce..a4630e44bcd9a336c4a955172ce642c21f425342 100644 (file)
@@ -716,7 +716,7 @@ typedef struct TCGOpDef {
     uint8_t flags;
 } TCGOpDef;
 
-extern TCGOpDef tcg_op_defs[];
+extern const TCGOpDef tcg_op_defs[];
 extern const size_t tcg_op_defs_max;
 
 /*
index 0f30e5b3eccfb193cf01c0dba0f568fcc61bd2c4..e98b3e5fddf300f73ea60a7aeaf05fe8756f0f1d 100644 (file)
@@ -26,7 +26,7 @@
 #include "tcg/tcg.h"
 #include "tcg-has.h"
 
-TCGOpDef tcg_op_defs[] = {
+const TCGOpDef tcg_op_defs[] = {
 #define DEF(s, oargs, iargs, cargs, flags) \
          { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
 #include "tcg/tcg-opc.h"
index df7c4dab887a12845c57321bd8ec6bf977ec7b4d..32975fe2983133850a6f284c5931272803821ee5 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3364,7 +3364,7 @@ static void process_constraint_sets(void)
 
 static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)
 {
-    TCGOpDef *def = &tcg_op_defs[op->opc];
+    const TCGOpDef *def = &tcg_op_defs[op->opc];
     TCGConstraintSetIndex con_set;
 
     if (def->nb_iargs + def->nb_oargs == 0) {