Richard Henderson <richard.hender...@linaro.org> writes:

> Add infrastructure for more consolidated output of opcodes.
> The base structure allows for constraints to be either static
> or dynamic, and for the existence of those constraints to
> replace TCG_TARGET_HAS_* and the bulk of tcg_op_supported.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
>  tcg/tcg.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 68 insertions(+), 8 deletions(-)
>
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index e8950df2ad..96c29536b6 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -861,6 +861,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_Dynamic = -2,
>      C_NotImplemented = -1,
>  #include "tcg-target-con-set.h"
>  } TCGConstraintSetIndex;
> @@ -954,6 +955,29 @@ static const TCGConstraintSet constraint_sets[] = {
>  #define C_O2_I4(O1, O2, I1, I2, I3, I4) C_PFX6(c_o2_i4_, O1, O2, I1, I2, I3, 
> I4)
>  #define C_N1_O1_I4(O1, O2, I1, I2, I3, I4) C_PFX6(c_n1_o1_i4_, O1, O2, I1, 
> I2, I3, I4)
>  
> +/*
> + * TCGOutOp is the base class for a set of structures that describe how
> + * to generate code for a given TCGOpcode.
> + *
> + * @static_constraint:
> + *   C_NotImplemented: The TCGOpcode is not supported by the backend.
> + *   C_Dynamic:        Use @dynamic_constraint to select a constraint set
> + *                     based on any of @type, @flags, or host isa.
> + *   Otherwise:        The register allocation constrains for the TCGOpcode.
> + *
> + * Subclasses of TCGOutOp will define a set of output routines that may
> + * be used.  Such routines will often be selected by the set of registers
> + * and constants that come out of register allocation.  The set of
> + * routines that are provided will guide the set of constraints that are
> + * legal.  In particular, assume that tcg_optimize() has done its job in
> + * swapping commutative operands and folding operations for which all
> + * operands are constant.
> + */
> +typedef struct TCGOutOp {
> +    TCGConstraintSetIndex static_constraint;
> +    TCGConstraintSetIndex (*dynamic_constraint)(TCGType type, unsigned 
> flags);
> +} TCGOutOp;
> +

Nice ;-)

Reviewed-by: Alex Bennée <alex.ben...@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to