> > On Sun, 21 Sep 2014, Jan Hubicka wrote:
> > 
> > > > 
> > > > Please omit static from inline functions.
> > > 
> > > Yep, I suppose we want to drop static in all inlines? I can make patch 
> > > for that.
> > > > 
> > > > Also one notable difference with your patches is that the fits hwi is 
> > > > now not tested on the result but on the result input which, multiplied 
> > > > by 8, might not fit a hwi now.  So please use wide-ints here (the 
> > > > to_offset flavor).
> > > 
> > > The function must always suceed (so user promise it will fit in HWI) and 
> > > for
> > > performance reasons I would rather not go into wide int by defualt, but I 
> > > can
> > > do that with checking enabled.
> > 
> > wide-int should be fast enough, please use it.
> 
> Like this?
> 
> Index: tree.h
> ===================================================================
> --- tree.h    (revision 215421)
> +++ tree.h    (working copy)
> @@ -3877,10 +3877,20 @@ extern tree size_in_bytes (const_tree);
>  extern HOST_WIDE_INT int_size_in_bytes (const_tree);
>  extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);
>  extern tree bit_position (const_tree);
> -extern HOST_WIDE_INT int_bit_position (const_tree);
>  extern tree byte_position (const_tree);
>  extern HOST_WIDE_INT int_byte_position (const_tree);
>  
> +/* Like bit_position, but return as an integer.  It must be representable in
> +   that way (since it could be a signed value, we don't have the
> +   option of returning -1 like int_size_in_byte can.  */
> +
> +static inline HOST_WIDE_INT int_bit_position (const_tree field)
> +{ 
> +  return ((wide_int)DECL_FIELD_OFFSET (field) * BITS_PER_UNIT
> +       + (wide_int)DECL_FIELD_BIT_OFFSET (field)).to_shwi ();

Hmm, this gets me:
/aux/hubicka/trunk-6/gcc/testsuite/gcc.c-torture/compile/20000224-1.c:39:7: 
internal compiler error: in decompose, at wide-int.h:911
0x656ed6 wi::int_traits<generic_wide_int<wide_int_storage> >::decompose(long*, 
unsigned int, generic_wide_int<wide_int_storage> const&)
        ../../gcc/wide-int.h:911
0x6ec9f4 
wide_int_ref_storage<true>::wide_int_ref_storage<generic_wide_int<wide_int_storage>
 >(generic_wide_int<wide_int_storage> const&, unsigned int)
        ../../gcc/wide-int.h:959
0x6ec75a generic_wide_int<wide_int_ref_storage<true> 
>::generic_wide_int<generic_wide_int<wide_int_storage> 
>(generic_wide_int<wide_int_storage> const&, unsigned int)
        ../../gcc/wide-int.h:735
0x7d52ec wi::binary_traits<generic_wide_int<wide_int_storage>, 
generic_wide_int<wide_int_storage>, 
wi::int_traits<generic_wide_int<wide_int_storage> >::precision_type, 
wi::int_traits<generic_wide_int<wide_int_storage> 
>::precision_type>::result_type wi::add<generic_wide_int<wide_int_storage>, 
generic_wide_int<wide_int_storage> >(generic_wide_int<wide_int_storage> const&, 
generic_wide_int<wide_int_storage> const&)
        ../../gcc/wide-int.h:2287
0x7d4fcc wi::binary_traits<generic_wide_int<wide_int_storage>, 
generic_wide_int<wide_int_storage>, (wi::precision_type)1, 
wi::int_traits<generic_wide_int<wide_int_storage> 
>::precision_type>::result_type 
generic_wide_int<wide_int_storage>::operator+<generic_wide_int<wide_int_storage>
 >(generic_wide_int<wide_int_storage> const&) const
        ../../gcc/wide-int.h:696
0xf282ab int_bit_position
        ../../gcc/tree.h:3890

on precision mismatch. What is correct way to compute this?
I tried offset_int but I do not seem smart enough to get past copmile errors 
with that one.
> +}
> +
> +
>  #define sizetype sizetype_tab[(int) stk_sizetype]
>  #define bitsizetype sizetype_tab[(int) stk_bitsizetype]
>  #define ssizetype sizetype_tab[(int) stk_ssizetype]

Reply via email to