diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2012-11-18 17:33:01 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2012-11-18 17:33:01 +0000 |
commit | 073a544dd99d1526bbf8906e8ac13d42a752d200 (patch) | |
tree | 0b688b615d5b6c61e00dcdc137907a0f3f33d947 /gcc/machmode.h | |
parent | 26f8b976309c42177332866ae3c6bf5a257c61fc (diff) | |
download | gcc-073a544dd99d1526bbf8906e8ac13d42a752d200.tar.gz |
machmode.h (bit_field_mode_iterator): New class.
gcc/
* machmode.h (bit_field_mode_iterator): New class.
(get_best_mode): Change final parameter to bool.
* stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator)
(bit_field_mode_iterator::next_mode): New functions, split out from...
(get_best_mode): ...here. Change final parameter to bool.
Use bit_field_mode_iterator.
From-SVN: r193603
Diffstat (limited to 'gcc/machmode.h')
-rw-r--r-- | gcc/machmode.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/machmode.h b/gcc/machmode.h index b95d05b096e..f1c89cc8a63 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -259,13 +259,36 @@ extern enum machine_mode int_mode_for_mode (enum machine_mode); extern enum machine_mode mode_for_vector (enum machine_mode, unsigned); +/* A class for iterating through possible bitfield modes. */ +class bit_field_mode_iterator +{ +public: + bit_field_mode_iterator (HOST_WIDE_INT, HOST_WIDE_INT, + HOST_WIDE_INT, HOST_WIDE_INT, + unsigned int, bool); + bool next_mode (enum machine_mode *); + bool prefer_smaller_modes (); + +private: + enum machine_mode mode_; + /* We use signed values here because the bit position can be negative + for invalid input such as gcc.dg/pr48335-8.c. */ + HOST_WIDE_INT bitsize_; + HOST_WIDE_INT bitpos_; + HOST_WIDE_INT bitregion_start_; + HOST_WIDE_INT bitregion_end_; + unsigned int align_; + bool volatilep_; + int count_; +}; + /* Find the best mode to use to access a bit field. */ extern enum machine_mode get_best_mode (int, int, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int, - enum machine_mode, int); + enum machine_mode, bool); /* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */ |