On Fri, Jan 16, 2026 at 12:38 PM Jim MacArthur <[email protected]> wrote:
>
> On 1/15/26 13:54, Paolo Bonzini wrote:
>
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index fbf09f5c826..79ca49154a2 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -3509,11 +3509,8 @@ static void process_constraint_sets(void)
>      }
>  }
>
> -static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)
> +static const TCGArgConstraint *op_args_ct(TCGOpcode opc, TCGType type, 
> unsigned flags)
>  {
> -    TCGOpcode opc = op->opc;
> -    TCGType type = TCGOP_TYPE(op);
> -    unsigned flags = TCGOP_FLAGS(op);
>      const TCGOpDef *def = &tcg_op_defs[opc];
>      const TCGOutOp *outop = all_outop[opc];
>      TCGConstraintSetIndex con_set;
> @@ -3540,6 +3537,24 @@ static const TCGArgConstraint *opcode_args_ct(const 
> TCGOp *op)
>      return all_cts[con_set];
>  }
>
> +static const TCGArgConstraint *opcode_args_ct(const TCGOp *op)
> +{
> +    return op_args_ct(op->opc, TCGOP_TYPE(op), TCGOP_FLAGS(op));
> +}
> +
> +/* Return true if the backend can efficiently handle IMM as an immediate
> +   for OP.  */
> +bool tcg_op_imm_match(TCGOpcode opc, TCGType type, tcg_target_ulong imm)
> +{
> +    const TCGOpDef * const def = &tcg_op_defs[opc];
> +    const TCGArgConstraint *args_ct = op_args_ct(opc, type, 0);
> +
> +    tcg_debug_assert(def->nb_iargs == 2);
> +    return tcg_target_const_match(
> +        imm, args_ct[def->nb_oargs + 2].ct,
> +        type, 0, 0);
> +}
> +
>  static void remove_label_use(TCGOp *op, int idx)
>  {
>      TCGLabel *label = arg_label(op->args[idx]);
>
> Functionally this looks good, but there are a couple of coding standards 
> issues raised by scripts/checkpatch.pl: The definition of op_args_ct is over 
> 80 characters, and your block comment for tcg_op_imm_match should use /* and 
> */ on separate lines. If those are fixed I'm happy to approve it.

tcg/tcg.c has several comments with that style, especially at the head
of functions (see temp_sync, temp_free_or_dead).  I'll fix the 80
characters.

Paolo


Reply via email to