summaryrefslogtreecommitdiff
path: root/gcc/machmode.h
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-18 17:33:01 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-18 17:33:01 +0000
commit0a1f57551d298bbda163fc7dc6959cbeec922f07 (patch)
tree0b688b615d5b6c61e00dcdc137907a0f3f33d947 /gcc/machmode.h
parent97b62a500a5823318b15cbe88913a1f4f4521126 (diff)
downloadgcc-0a1f57551d298bbda163fc7dc6959cbeec922f07.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193603 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/machmode.h')
-rw-r--r--gcc/machmode.h25
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. */