On 5/26/2026 8:22 AM, Robin Dapp wrote:
> From: Robin Dapp <[email protected]>
>
> This patch adds dependent-filter handling to recog.
> When verifying the constraints of an instruction, just after register
> filters are checked, it calls eval_dependent_filter for the operand and
> its referenced operand.
>
> gcc/ChangeLog:
>
>       * recog.cc (preprocess_constraints): Initialize dependent
>       filter.
>       (test_dependent_filter): New function wrapping
>       eval_dependent_filter.
>       (constrain_operands): Test dependent filter in strict mode.
>       * recog.h (struct operand_alternative): Declare
>       dependent_filters.
>       (alternative_dependent_filters): New function.
> ---
>   gcc/recog.cc | 33 ++++++++++++++++++++++++++++++++-
>   gcc/recog.h  | 16 ++++++++++++++++
>   2 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/recog.cc b/gcc/recog.cc
> index 4cae276f1f7..12874505518 100644
> --- a/gcc/recog.cc
> +++ b/gcc/recog.cc
> @@ -3138,6 +3142,30 @@ struct funny_match
>     int this_op, other;
>   };
>   
> +/* For a register constraint CN with a dependent filter (i.e. a
> +   dependent/dynamic filter), return true if the filter allows
> +   REGNO (OP) + offset given the current ref-operand contents in
> +   recog_data or false if it doesn't.
> +   If the filter cannot be evaluated, for example when no hard reg
> +   has been chosen yet, return true.  */
> +
> +static bool
> +test_dependent_filter (constraint_num cn, rtx op, int offset,
> +                    machine_mode mode)
> +{
> +  int id = get_dependent_filter_id (cn);
> +  if (id < 0 || !REG_P (op))
Presumably we've already handled SUBREGs before we get here and stripped 
them away, adjusting OFFSET appropriately?  Otherwise don't we also have 
to start worrying about endianness interactions with SUBREGs?  I'm keen 
to avoid those problems, so the only right answer is "yes, those are 
handled before we get here" ;-)



Jeff

Reply via email to