GCC Middle and Back End API Reference
bit_field_mode_iterator Class Reference

#include <machmode.h>

Public Member Functions

 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 Attributes

enum machine_mode m_mode
HOST_WIDE_INT m_bitsize
HOST_WIDE_INT m_bitpos
HOST_WIDE_INT m_bitregion_start
HOST_WIDE_INT m_bitregion_end
unsigned int m_align
bool m_volatilep
int m_count

Detailed Description

A class for iterating through possible bitfield modes.


Constructor & Destructor Documentation

bit_field_mode_iterator::bit_field_mode_iterator ( HOST_WIDE_INT  bitsize,
HOST_WIDE_INT  bitpos,
HOST_WIDE_INT  bitregion_start,
HOST_WIDE_INT  bitregion_end,
unsigned int  align,
bool  volatilep 
)

Construct an iterator for a bitfield that spans BITSIZE bits, starting at BITPOS.

BITREGION_START is the bit position of the first bit in this sequence of bit fields. BITREGION_END is the last bit in this sequence. If these two fields are non-zero, we should restrict the memory access to that range. Otherwise, we are allowed to touch any adjacent non bit-fields.

ALIGN is the alignment of the underlying object in bits. VOLATILEP says whether the bitfield is volatile.

We can assume that any aligned chunk of ALIGN bits that overlaps the bitfield is mapped and won't trap, provided that ALIGN isn't too large. The cap is the biggest required alignment for data, or at least the word size. And force one such chunk at least.


Member Function Documentation

bool bit_field_mode_iterator::next_mode ( enum machine_mode *  out_mode)

Calls to this function return successively larger modes that can be used to represent the bitfield. Return true if another bitfield mode is available, storing it in *OUT_MODE if so.

     Skip modes that don't have full precision.   
     Stop if the mode is too wide to handle efficiently.   
     Don't deliver more than one multiword mode; the smallest one
     should be used.   
     Skip modes that are too small.   
     Stop if the mode goes outside the bitregion.   
     Stop if the mode requires too much alignment.   

Referenced by set_min_and_max_values_for_integral_type().

bool bit_field_mode_iterator::prefer_smaller_modes ( )

Return true if smaller modes are generally preferred for this kind of bitfield.

Referenced by fixup_signed_type().


Field Documentation

unsigned int bit_field_mode_iterator::m_align
private
HOST_WIDE_INT bit_field_mode_iterator::m_bitpos
private
HOST_WIDE_INT bit_field_mode_iterator::m_bitregion_end
private
HOST_WIDE_INT bit_field_mode_iterator::m_bitregion_start
private
HOST_WIDE_INT bit_field_mode_iterator::m_bitsize
private

We use signed values here because the bit position can be negative for invalid input such as gcc.dg/pr48335-8.c.

int bit_field_mode_iterator::m_count
private
enum machine_mode bit_field_mode_iterator::m_mode
private
bool bit_field_mode_iterator::m_volatilep
private

The documentation for this class was generated from the following files: