Re: [4/8] Add bit_field_mode_iterator

2012-11-18 Thread Richard Sandiford
Eric Botcazou writes: >> get_best_mode has various checks to decide what counts as an acceptable >> bitfield mode. It actually has two copies of them, with slightly different >> alignment checks: >> >> MIN (unit, BIGGEST_ALIGNMENT) > align >> >> vs. >> >> unit <= MIN (align, BIGGEST_ALIGNM

Re: [4/8] Add bit_field_mode_iterator

2012-11-18 Thread Richard Sandiford
Richard Henderson writes: > On 11/15/2012 04:10 AM, Richard Sandiford wrote: >> "next" was supposed to be "find and return another mode" rather than "++". >> Did you think it was confusing because "next" sounded too much like >> the latter? > > I wasn't keen on "next" being find-and-return, though

Re: [4/8] Add bit_field_mode_iterator

2012-11-15 Thread Richard Henderson
On 11/15/2012 04:10 AM, Richard Sandiford wrote: > "next" was supposed to be "find and return another mode" rather than "++". > Did you think it was confusing because "next" sounded too much like the > latter? I wasn't keen on "next" being find-and-return, though I didn't actually find it confusi

Re: [4/8] Add bit_field_mode_iterator

2012-11-15 Thread Richard Sandiford
Eric Botcazou writes: >> Now that we're in C++, I think we should be using iterators that are much >> more in the style of libstdc++. I agree that the .next interface used here >> is a bit confusing. >> >> I'd expect to see something like >> >> for (bit_field_mode_iterator i(x,y,z); i ; ++i)

Re: [4/8] Add bit_field_mode_iterator

2012-11-13 Thread Eric Botcazou
> Now that we're in C++, I think we should be using iterators that are much > more in the style of libstdc++. I agree that the .next interface used here > is a bit confusing. > > I'd expect to see something like > > for (bit_field_mode_iterator i(x,y,z); i ; ++i) > { > enum machine_m

Re: [4/8] Add bit_field_mode_iterator

2012-11-13 Thread Richard Henderson
On 11/13/2012 04:41 AM, Eric Botcazou wrote: > I find the interface a bit awkward though. Can't we model it on the existing > iterators in basic-block.h or tree-flow.h? get_best_mode would be written: > > FOR_EACH_BITFIELD_MODE (mode, iter, bitsize, bitpos, > bitregion

Re: [4/8] Add bit_field_mode_iterator

2012-11-13 Thread Eric Botcazou
> get_best_mode has various checks to decide what counts as an acceptable > bitfield mode. It actually has two copies of them, with slightly different > alignment checks: > > MIN (unit, BIGGEST_ALIGNMENT) > align > > vs. > > unit <= MIN (align, BIGGEST_ALIGNMENT) > > The second looks more

[4/8] Add bit_field_mode_iterator

2012-11-03 Thread Richard Sandiford
get_best_mode has various checks to decide what counts as an acceptable bitfield mode. It actually has two copies of them, with slightly different alignment checks: MIN (unit, BIGGEST_ALIGNMENT) > align vs. unit <= MIN (align, BIGGEST_ALIGNMENT) The second looks more correct, since we can'