On 2015-07-27 10:25, Paolo Bonzini wrote:
> 
> 
> On 24/07/2015 18:30, Aurelien Jarno wrote:
> > Use two bools to track constants and copies instead of an enum.
> > 
> > Cc: Richard Henderson <r...@twiddle.net>
> > Signed-off-by: Aurelien Jarno <aurel...@aurel32.net>
> > ---
> >  tcg/optimize.c | 30 +++++++++++++++---------------
> >  1 file changed, 15 insertions(+), 15 deletions(-)
> > 
> > diff --git a/tcg/optimize.c b/tcg/optimize.c
> > index d2b63a4..f16eb1e 100644
> > --- a/tcg/optimize.c
> > +++ b/tcg/optimize.c
> > @@ -35,14 +35,9 @@
> >          glue(glue(case INDEX_op_, x), _i32):    \
> >          glue(glue(case INDEX_op_, x), _i64)
> >  
> > -typedef enum {
> > -    TCG_TEMP_UNDEF = 0,
> > -    TCG_TEMP_CONST,
> > -    TCG_TEMP_COPY,
> > -} tcg_temp_state;
> > -
> >  struct tcg_temp_info {
> > -    tcg_temp_state state;
> > +    bool is_const;
> > +    bool is_copy;
> 
> Could temps[arg].is_copy be replaced by temps[arg].next_copy != arg?
> 
> For example, this:
> 
>     if (temps[temp].prev_copy == temps[temp].next_copy) {
>         temps[temps[temp].next_copy].is_copy = false;
>     } else {
>         temps[temps[temp].next_copy].prev_copy = temps[temp].prev_copy;
>         temps[temps[temp].prev_copy].next_copy = temps[temp].next_copy;
>     }
> 
> would be replaced simply by
> 
>     temps[temps[temp].next_copy].prev_copy = temps[temp].prev_copy;
>     temps[temps[temp].prev_copy].next_copy = temps[temp].next_copy;
> 

That's an interesting idea, especially I have a patch series in
preparation that get rid of is_const. I will try to get something like
that for v2.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurel...@aurel32.net                 http://www.aurel32.net

Reply via email to