[PATCH][RFC] bitpacking rewrite

Jan Hubicka hubicka@ucw.cz
Sat Jun 12 17:19:00 GMT 2010


> 
> The following preliminary patch rewrites bitpacking to happen
> word-by-word and on the stack (well, in the preliminary form
> only on the stack after inlining).
> 
> Comments?

I like the change. Probably instead of bp/bp_s game, I would go with
adding &bp to every caller, but I do not care.

> + static inline void
> + bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
> + {
> +   bitpack_word_t word = bp->word;
> +   int pos = bp->pos;
> +   /* If val does not fit into the current bitpack word switch to the
> +      next one.  */
> +   if (pos + nbits > BITS_PER_BITPACK_WORD)
> +     {
> +       lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream, word);

Hehe, I never got to idea that one can actually output the bitpack when it overflows
first word ;)
I guess you want to add some checking asserts that nbits does not exceed BITS_PER_BITPACK_WORD.

So next step would be to optimize ulebs/slebs, right? :)

Honza



More information about the Gcc-patches mailing list