RE: [PATCH v2 02/48] tcg/optimize: Split out OptContext

2021-10-20 Thread Luis Fernando Fujita Pires
From: Richard Henderson 
> Provide what will become a larger context for splitting the very large
> tcg_optimize function.
> 
> Signed-off-by: Richard Henderson 
> ---
>  tcg/optimize.c | 77 ++
>  1 file changed, 40 insertions(+), 37 deletions(-)

Reviewed-by: Luis Pires 

--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer 



Re: [PATCH v2 02/48] tcg/optimize: Split out OptContext

2021-10-19 Thread Richard Henderson

On 10/19/21 8:25 AM, Alex Bennée wrote:

-TCGTempSet temps_used;
+OptContext ctx = {};
  
  /* Array VALS has an element for each temp.

 If this temp holds a constant then its value is kept in VALS' element.
@@ -615,7 +619,6 @@ void tcg_optimize(TCGContext *s)
  nb_temps = s->nb_temps;
  nb_globals = s->nb_globals;
  
-memset(_used, 0, sizeof(temps_used));


Did you mean to drop this memset entirely given I see it being done
later on?


It went to the struct initialization above.


r~



Re: [PATCH v2 02/48] tcg/optimize: Split out OptContext

2021-10-19 Thread Alex Bennée


Richard Henderson  writes:

> Provide what will become a larger context for splitting
> the very large tcg_optimize function.
>
> Signed-off-by: Richard Henderson 
> ---
>  tcg/optimize.c | 77 ++
>  1 file changed, 40 insertions(+), 37 deletions(-)
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 148e360fc6..b76991215e 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -44,6 +44,10 @@ typedef struct TempOptInfo {
>  uint64_t z_mask;  /* mask bit is 0 if and only if value bit is 0 */
>  } TempOptInfo;
>  
> +typedef struct OptContext {
> +TCGTempSet temps_used;
> +} OptContext;
> +
>  static inline TempOptInfo *ts_info(TCGTemp *ts)
>  {
>  return ts->state_ptr;
> @@ -90,15 +94,15 @@ static void reset_temp(TCGArg arg)
>  }
>  

> @@ -605,7 +609,7 @@ void tcg_optimize(TCGContext *s)
>  {
>  int nb_temps, nb_globals, i;
>  TCGOp *op, *op_next, *prev_mb = NULL;
> -TCGTempSet temps_used;
> +OptContext ctx = {};
>  
>  /* Array VALS has an element for each temp.
> If this temp holds a constant then its value is kept in VALS' element.
> @@ -615,7 +619,6 @@ void tcg_optimize(TCGContext *s)
>  nb_temps = s->nb_temps;
>  nb_globals = s->nb_globals;
>  
> -memset(_used, 0, sizeof(temps_used));

Did you mean to drop this memset entirely given I see it being done
later on?


> @@ -1302,7 +1305,7 @@ void tcg_optimize(TCGContext *s)
> op->args[1], op->args[2]);
>  if (tmp != 2) {
>  if (tmp) {
> -memset(_used, 0, sizeof(temps_used));
> +memset(_used, 0, sizeof(ctx.temps_used));
>  op->opc = INDEX_op_br;
>  op->args[0] = op->args[3];
>  } else {

Otherwise:

Reviewed-by: Alex Bennée 

-- 
Alex Bennée