GCC Middle and Back End API Reference
machmode.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  bit_field_mode_iterator

Enumerations

enum  mode_class { MODE_CLASSES, MAX_MODE_CLASS, MODE_CLASSES, MAX_MODE_CLASS }

Functions

enum machine_mode mode_for_size (unsigned int, enum mode_class, int)
enum machine_mode smallest_mode_for_size (unsigned int, enum mode_class)
enum machine_mode int_mode_for_mode (enum machine_mode)
enum machine_mode mode_for_vector (enum machine_mode, unsigned)
enum machine_mode get_best_mode (int, int, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int, enum machine_mode, bool)
unsigned get_mode_alignment (enum machine_mode)
unsigned int element_precision (enum machine_mode)
void init_adjust_machine_modes (void)

Variables

const char *const mode_name [NUM_MACHINE_MODES]
const unsigned char mode_class [NUM_MACHINE_MODES]
CONST_MODE_SIZE unsigned char mode_size [NUM_MACHINE_MODES]
const unsigned short mode_precision [NUM_MACHINE_MODES]
CONST_MODE_IBIT unsigned char mode_ibit [NUM_MACHINE_MODES]
CONST_MODE_FBIT unsigned char mode_fbit [NUM_MACHINE_MODES]
const unsigned HOST_WIDE_INT mode_mask_array [NUM_MACHINE_MODES]
const unsigned char mode_inner [NUM_MACHINE_MODES]
const unsigned char mode_nunits [NUM_MACHINE_MODES]
const unsigned char mode_wider [NUM_MACHINE_MODES]
const unsigned char mode_2xwider [NUM_MACHINE_MODES]
CONST_MODE_BASE_ALIGN unsigned char mode_base_align [NUM_MACHINE_MODES]
const unsigned char class_narrowest_mode [MAX_MODE_CLASS]
enum machine_mode byte_mode
enum machine_mode word_mode
enum machine_mode ptr_mode

Enumeration Type Documentation

enum mode_class
Enumerator:
MODE_CLASSES 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 

Function Documentation

unsigned int element_precision ( enum  machine_mode)
   Get the precision of the mode or its inner mode if it has one.  
enum machine_mode get_best_mode ( int  bitsize,
int  bitpos,
unsigned HOST_WIDE_INT  bitregion_start,
unsigned HOST_WIDE_INT  bitregion_end,
unsigned int  align,
enum machine_mode  largest_mode,
bool  volatilep 
)
   Find the best mode to use to access a bit field.  
   Find the best machine mode to use when referencing a bit field of length
   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.

   The underlying object is known to be aligned to a boundary of ALIGN bits.
   If LARGEST_MODE is not VOIDmode, it means that we should not use a mode
   larger than LARGEST_MODE (usually SImode).

   If no mode meets all these conditions, we return VOIDmode.

   If VOLATILEP is false and SLOW_BYTE_ACCESS is false, we return the
   smallest mode meeting these conditions.

   If VOLATILEP is false and SLOW_BYTE_ACCESS is true, we return the
   largest mode (but a mode no wider than UNITS_PER_WORD) that meets
   all the conditions.

   If VOLATILEP is true the narrow_volatile_bitfields target hook is used to
   decide which of the above modes should be used.  
            ??? For historical reasons, reject modes that would normally
            receive greater alignment, even if unaligned accesses are
            acceptable.  This has both advantages and disadvantages.
            Removing this check means that something like:

               struct s { unsigned int x; unsigned int y; };
               int f (struct s *s) { return s->x == 0 && s->y == 0; }

            can be implemented using a single load and compare on
            64-bit machines that have no alignment restrictions.
            For example, on powerpc64-linux-gnu, we would generate:

                    ld 3,0(3)
                    cntlzd 3,3
                    srdi 3,3,6
                    blr

            rather than:

                    lwz 9,0(3)
                    cmpwi 7,9,0
                    bne 7,.L3
                    lwz 3,4(3)
                    cntlzw 3,3
                    srwi 3,3,5
                    extsw 3,3
                    blr
                    .p2align 4,,15
            .L3:
                    li 3,0
                    blr

            However, accessing more than one field can make life harder
            for the gimple optimizers.  For example, gcc.dg/vect/bb-slp-5.c
            has a series of unsigned short copies followed by a series of
            unsigned short comparisons.  With this check, both the copies
            and comparisons remain 16-bit accesses and FRE is able
            to eliminate the latter.  Without the check, the comparisons
            can be done using 2 64-bit operations, which FRE isn't able
            to handle in the same way.

            Either way, it would probably be worth disabling this check
            during expand.  One particular example where removing the
            check would help is the get_best_mode call in store_bit_field.
            If we are given a memory bitregion of 128 bits that is aligned
            to a 64-bit boundary, and the bitfield we want to modify is
            in the second half of the bitregion, this check causes
            store_bitfield to turn the memory into a 64-bit reference
            to the _first_ half of the region.  We later use
            adjust_bitfield_address to get a reference to the correct half,
            but doing so looks to adjust_bitfield_address as though we are
            moving past the end of the original object, so it drops the
            associated MEM_EXPR and MEM_OFFSET.  Removing the check
            causes store_bit_field to keep a 128-bit memory reference,
            so that the final bitfield reference still has a MEM_EXPR
            and MEM_OFFSET.  

Referenced by store_bit_field().

unsigned get_mode_alignment ( enum  machine_mode)

Referenced by emit_move_change_mode().

void init_adjust_machine_modes ( void  )
   Target-dependent machine mode initialization - in insn-modes.c.  
enum machine_mode int_mode_for_mode ( enum  machine_mode)
   Return an integer mode of the exact same size as the input mode,
   or BLKmode on failure.  

Referenced by expand_abs(), find_shift_sequence(), and make_compound_operation().

enum machine_mode mode_for_size ( unsigned  int,
enum  mode_class,
int   
)
   Return the mode for data of a given size SIZE and mode class CLASS.
   If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
   The value is BLKmode if no other mode is found.  

Referenced by assign_mem_slot(), decompose_register(), distribute_and_simplify_rtx(), expand_builtin___clear_cache(), expand_builtin_compare_and_swap(), finish_bitfield_layout(), int_mode_for_mode(), and spill_failure().

enum machine_mode mode_for_vector ( enum  machine_mode,
unsigned   
)
   Return a mode that is suitable for representing a vector,
   or BLKmode on failure.  

Referenced by finish_bitfield_layout(), and init_optabs().

enum machine_mode smallest_mode_for_size ( unsigned  int,
enum  mode_class 
)
   Similar, but find the smallest mode for a given width.  

Referenced by finish_bitfield_layout().


Variable Documentation

enum machine_mode byte_mode
   Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
   and the mode whose class is Pmode and whose size is POINTER_SIZE.  
   Commonly used modes.  

Referenced by clear_storage_hints().

const unsigned char class_narrowest_mode[MAX_MODE_CLASS]
   For each class, get the narrowest mode in that class.  
const unsigned char mode_2xwider[NUM_MACHINE_MODES]
   For scalars, this is a mode with twice the precision.  For vectors,
   this is a mode with the same inner mode but with twice the elements.  
CONST_MODE_BASE_ALIGN unsigned char mode_base_align[NUM_MACHINE_MODES]
   Determine alignment, 1<=result<=BIGGEST_ALIGNMENT.  

Referenced by mode_for_vector().

const unsigned char mode_class[NUM_MACHINE_MODES]
   Get the general kind of object that mode MODE represents
   (integer, floating, complex, etc.)  
CONST_MODE_FBIT unsigned char mode_fbit[NUM_MACHINE_MODES]
   Get the number of fractional bits of an object of mode MODE.  
CONST_MODE_IBIT unsigned char mode_ibit[NUM_MACHINE_MODES]
   Get the number of integral bits of an object of mode MODE.  
const unsigned char mode_inner[NUM_MACHINE_MODES]
   Return the mode of the inner elements in a vector.  
const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES]
   Get a bitmask containing 1 for all bits in a word
   that fit within mode MODE.  
const char* const mode_name[NUM_MACHINE_MODES]
   Make an enum class that gives all the machine modes.  
   Get the name of mode MODE as a string.  
const unsigned char mode_nunits[NUM_MACHINE_MODES]
   Get the number of units in the object.  
const unsigned short mode_precision[NUM_MACHINE_MODES]
   Get the number of value bits of an object of mode MODE.  
CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES]
   Get the size in bytes and bits of an object of mode MODE.  
const unsigned char mode_wider[NUM_MACHINE_MODES]
   Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI).