On 2016-06-23 20:48, Richard Henderson wrote: > This reduces both memory usage and per-insn cacheline usage > during code generation. > > Signed-off-by: Richard Henderson <r...@twiddle.net> > --- > tcg/tcg.c | 58 ++++++++++++++++++++++------------------------------------ > tcg/tcg.h | 16 ++++++++++------ > 2 files changed, 32 insertions(+), 42 deletions(-) > > diff --git a/tcg/tcg.c b/tcg/tcg.c > index 64060c6..400e69c 100644 > --- a/tcg/tcg.c > +++ b/tcg/tcg.c > @@ -1329,7 +1329,7 @@ static inline void tcg_la_bb_end(TCGContext *s, uint8_t > *dead_temps, > } > } > > -/* Liveness analysis : update the opc_dead_args array to tell if a > +/* Liveness analysis : update the opc_arg_life array to tell if a > given input arguments is dead. Instructions updating dead > temporaries are removed. */ > static void tcg_liveness_analysis(TCGContext *s) > @@ -1338,9 +1338,8 @@ static void tcg_liveness_analysis(TCGContext *s) > int oi, oi_prev, nb_ops; > > nb_ops = s->gen_next_op_idx; > - s->op_dead_args = tcg_malloc(nb_ops * sizeof(uint16_t)); > - s->op_sync_args = tcg_malloc(nb_ops * sizeof(uint8_t)); > - > + s->op_arg_life = tcg_malloc(nb_ops * sizeof(TCGLifeData)); > + > dead_temps = tcg_malloc(s->nb_temps); > mem_temps = tcg_malloc(s->nb_temps); > tcg_la_func_end(s, dead_temps, mem_temps); > @@ -1349,8 +1348,7 @@ static void tcg_liveness_analysis(TCGContext *s) > int i, nb_iargs, nb_oargs; > TCGOpcode opc_new, opc_new2; > bool have_opc_new2; > - uint16_t dead_args; > - uint8_t sync_args; > + TCGLifeData arg_life = 0;
A small improvement, probably for later: we can zero the s->op_arg_life structure, and then access it directly instead of using the arg_life temporary variable. Reviewed-by: Aurelien Jarno <aurel...@aurel32.net> -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://www.aurel32.net