GCC Middle and Back End API Reference
genmodes.c File Reference

Data Structures

struct  mode_data
struct  mode_adjust

Enumerations

enum  mode_class { MODE_CLASSES, MAX_MODE_CLASS, MODE_CLASSES, MAX_MODE_CLASS }
enum  requirement { SET, UNSET, OPTIONAL }

Functions

static enum mode_class complex_class ()
static enum mode_class vector_class ()
static struct mode_datafind_mode ()
static struct mode_datanew_mode (enum mode_class cl, const char *name, const char *file, unsigned int line)
static hashval_t hash_mode ()
static int eq_mode ()
static void new_adjust (const char *name, struct mode_adjust **category, const char *catname, const char *adjustment, enum mode_class required_class_from, enum mode_class required_class_to, const char *file, unsigned int line)
static void validate_mode (struct mode_data *m, enum requirement r_precision, enum requirement r_bytesize, enum requirement r_component, enum requirement r_ncomponents, enum requirement r_format)
static void complete_mode ()
static void complete_all_modes ()
static void make_complex_modes (enum mode_class cl, const char *file, unsigned int line)
static void make_vector_modes (enum mode_class cl, unsigned int width, const char *file, unsigned int line)
static void make_special_mode (enum mode_class cl, const char *name, const char *file, unsigned int line)
static void make_pointer_bounds_mode (const char *name, unsigned int bytesize, const char *file, unsigned int line)
static void make_int_mode (const char *name, unsigned int precision, unsigned int bytesize, const char *file, unsigned int line)
static void make_fixed_point_mode (enum mode_class cl, const char *name, unsigned int bytesize, unsigned int ibit, unsigned int fbit, const char *file, unsigned int line)
static void make_float_mode (const char *name, unsigned int precision, unsigned int bytesize, const char *format, const char *file, unsigned int line)
static void make_decimal_float_mode (const char *name, unsigned int precision, unsigned int bytesize, const char *format, const char *file, unsigned int line)
static void reset_float_format (const char *name, const char *format, const char *file, unsigned int line)
static void make_partial_integer_mode (const char *base, const char *name, unsigned int precision, const char *file, unsigned int line)
static void make_vector_mode (enum mode_class bclass, const char *base, unsigned int ncomponents, const char *file, unsigned int line)
static void create_modes ()
static int cmp_modes ()
static void calc_wider_mode ()
static void emit_max_int ()
static void emit_insn_modes_h ()
static void emit_insn_modes_c_header ()
static void emit_min_insn_modes_c_header ()
static void emit_mode_name ()
static void emit_mode_class ()
static void emit_mode_precision ()
static void emit_mode_size ()
static void emit_mode_nunits ()
static void emit_mode_wider ()
static void emit_mode_mask ()
static void emit_mode_inner ()
static void emit_mode_base_align ()
static void emit_class_narrowest_mode ()
static void emit_real_format_for_mode ()
static void emit_mode_adjustments ()
static void emit_mode_ibit ()
static void emit_mode_fbit ()
static void emit_insn_modes_c ()
static void emit_min_insn_modes_c ()
int main ()

Variables

static const char *const mode_class_names [MAX_MODE_CLASS]
static struct mode_datamodes [MAX_MODE_CLASS]
static unsigned int n_modes [MAX_MODE_CLASS]
static struct mode_datavoid_mode
static struct mode_data blank_mode
static htab_t modes_by_name
static struct mode_adjustadj_bytesize
static struct mode_adjustadj_alignment
static struct mode_adjustadj_format
static struct mode_adjustadj_ibit
static struct mode_adjustadj_fbit

Enumeration Type Documentation

enum mode_class
Enumerator:
MODE_CLASSES 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 
   Diagnose failure to meet expectations in a partially filled out
   mode structure.  
Enumerator:
SET 
UNSET 
OPTIONAL 

Function Documentation

static void calc_wider_mode ( )
static
     Allocate max_n_modes + 1 entries to leave room for the extra null
     pointer assigned after the qsort call below.  
         "wider" is not meaningful for MODE_RANDOM and MODE_CC.
         However, we want these in textual order, and we have
         precisely the reverse.  
                 this is nreverse 
static int cmp_modes ( )
static
   Processing.  
   Sort a list of modes into the order needed for the WIDER field:
   major sort by precision, minor sort by component precision.

   For instance:
     QI < HI < SI < DI < TI
     V4QI < V2HI < V8QI < V4HI < V2SI.

   If the precision is not set, sort by the bytesize.  A mode with
   precision set gets sorted before a mode without precision set, if
   they have the same bytesize; this is the right thing because
   the precision must always be smaller than the bytesize * BITS_PER_UNIT.
   We don't have to do anything special to get this done -- an unset
   precision shows up as (unsigned int)-1, i.e. UINT_MAX.  
static void complete_all_modes ( )
static
static void complete_mode ( )
static
   Given a partially-filled-out mode structure, figure out what we can
   and fill the rest of it in; die if it isn't enough.  
         Nothing more need be said.  
         Again, nothing more need be said.  For historical reasons,
         the size of a CC mode is four units.  
         A scalar mode must have a byte size, may have a bit size,
         and must not have components.   A float mode must have a
         format.  
         A partial integer mode uses ->component to say what the
         corresponding full-size integer mode is, and may also
         specify a bit size.  
         Complex modes should have a component indicated, but no more.  
         Vector modes should have a component and a number of components.  
     If not already specified, the mode alignment defaults to the largest
     power of two that divides the size of the object.  Complex types are
     not more aligned than their contents.  
     If this mode has components, make the component mode point back
     to this mode, for the sake of adjustments.  

References error(), mode_data::file, mode_data::line, and mode_data::name.

static enum mode_class complex_class ( )
static
   Mode class operations.  
static void create_modes ( )
static

References mode_data::counter.

static void emit_class_narrowest_mode ( )
static
       Bleah, all this to get the comment right for MIN_MODE_INT.  
static void emit_insn_modes_c ( )
static
static void emit_insn_modes_c_header ( )
static
static void emit_insn_modes_h ( )
static
         Don't use BImode for MIN_MODE_INT, since otherwise the middle
         end will try to use it for bitfields in structures and the
         like, which we do not want.  Only the target md file should
         generate BImode widgets.  
     I can't think of a better idea, can you?  
static void emit_max_int ( )
static
   Compute the max bitsize of some of the classes of integers.  It may
   be that there are needs for the other integer classes, and this
   code is easy to extend.  
static void emit_min_insn_modes_c ( )
static
static void emit_min_insn_modes_c_header ( )
static
static void emit_mode_adjustments ( )
static
     Size adjustments must be propagated to all containing modes.
     A size adjustment forces us to recalculate the alignment too.  
                 NOTREACHED 
     Alignment adjustments propagate too.
     ??? This may not be the right thing for vector modes.  
                 NOTREACHED 
     Ibit adjustments don't have to propagate.  
     Fbit adjustments don't have to propagate.  
     Real mode formats don't have to propagate anywhere.  
static void emit_mode_base_align ( )
static
static void emit_mode_class ( )
static
static void emit_mode_fbit ( )
static
   Emit fbit for all modes.  

References error(), and progname.

static void emit_mode_ibit ( )
static
   Emit ibit for all modes.  
static void emit_mode_inner ( )
static
static void emit_mode_mask ( )
static
static void emit_mode_name ( )
static
static void emit_mode_nunits ( )
static

References mode_data::precision.

static void emit_mode_precision ( )
static
static void emit_mode_size ( )
static
static void emit_mode_wider ( )
static
             For vectors we want twice the number of components,
             with the same element type.  

References mode_data::component, and mode_data::ncomponents.

static void emit_real_format_for_mode ( )
static
     The entities pointed to by this table are constant, whether
     or not the table itself is constant.

     For backward compatibility this table is always writable
     (several targets modify it in TARGET_OPTION_OVERRIDE).   FIXME:
     convert all said targets to use ADJUST_FORMAT instead.  
     The beginning of the table is entries for float modes.  
     The end of the table is entries for decimal float modes.  

References mode_adjust::adjustment, mode_data::cl, mode_data::contained, mode_adjust::file, mode_adjust::line, mode_adjust::mode, mode_data::name, mode_data::ncomponents, mode_adjust::next, and mode_data::next_cont.

static int eq_mode ( )
static
static struct mode_data* find_mode ( )
staticread
   Utility routines.  

References count.

Referenced by make_partial_integer_mode().

static hashval_t hash_mode ( )
static

References mode_data::name.

int main ( )
   Master control.  
static void make_complex_modes ( enum mode_class  cl,
const char *  file,
unsigned int  line 
)
static
         Skip BImode.  FIXME: BImode probably shouldn't be MODE_INT.  
         The leading "1 +" is in case we prepend a "C" below.  
         Float complex modes are named SCmode, etc.
         Int complex modes are named CSImode, etc.
         This inconsistency should be eliminated.  
static void make_decimal_float_mode ( const char *  name,
unsigned int  precision,
unsigned int  bytesize,
const char *  format,
const char *  file,
unsigned int  line 
)
static
static void make_fixed_point_mode ( enum mode_class  cl,
const char *  name,
unsigned int  bytesize,
unsigned int  ibit,
unsigned int  fbit,
const char *  file,
unsigned int  line 
)
static
   Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
   FILE, and LINE.  
static void make_float_mode ( const char *  name,
unsigned int  precision,
unsigned int  bytesize,
const char *  format,
const char *  file,
unsigned int  line 
)
static
static void make_int_mode ( const char *  name,
unsigned int  precision,
unsigned int  bytesize,
const char *  file,
unsigned int  line 
)
static
static void make_partial_integer_mode ( const char *  base,
const char *  name,
unsigned int  precision,
const char *  file,
unsigned int  line 
)
static
static void make_pointer_bounds_mode ( const char *  name,
unsigned int  bytesize,
const char *  file,
unsigned int  line 
)
static
static void make_special_mode ( enum mode_class  cl,
const char *  name,
const char *  file,
unsigned int  line 
)
static
static void make_vector_mode ( enum mode_class  bclass,
const char *  base,
unsigned int  ncomponents,
const char *  file,
unsigned int  line 
)
static

References error().

static void make_vector_modes ( enum mode_class  cl,
unsigned int  width,
const char *  file,
unsigned int  line 
)
static
         Do not construct vector modes with only one element, or
         vector modes where the element size doesn't divide the full
         size evenly.  
         Skip QFmode and BImode.  FIXME: this special case should
         not be necessary.  

References error(), mode_data::file, mode_data::line, and mode_data::name.

static void new_adjust ( const char *  name,
struct mode_adjust **  category,
const char *  catname,
const char *  adjustment,
enum mode_class  required_class_from,
enum mode_class  required_class_to,
const char *  file,
unsigned int  line 
)
static
static struct mode_data* new_mode ( enum mode_class  cl,
const char *  name,
const char *  file,
unsigned int  line 
)
staticread
static void reset_float_format ( const char *  name,
const char *  format,
const char *  file,
unsigned int  line 
)
static
static void validate_mode ( struct mode_data m,
enum requirement  r_precision,
enum requirement  r_bytesize,
enum requirement  r_component,
enum requirement  r_ncomponents,
enum requirement  r_format 
)
static
static enum mode_class vector_class ( )
static

Variable Documentation

struct mode_adjust* adj_alignment
static
struct mode_adjust* adj_bytesize
static
struct mode_adjust* adj_fbit
static
struct mode_adjust* adj_format
static
struct mode_adjust* adj_ibit
static
struct mode_data blank_mode
static
Initial value:
{
0, "<unknown>", MAX_MODE_CLASS,
-1U, -1U, -1U, -1U,
0, 0, 0, 0, 0,
"<unknown>", 0, 0, 0, 0
}
const char* const mode_class_names[MAX_MODE_CLASS]
static
Initial value:

Referenced by make_partial_integer_mode().

struct mode_data* modes[MAX_MODE_CLASS]
static
htab_t modes_by_name
static
unsigned int n_modes[MAX_MODE_CLASS]
static
struct mode_data* void_mode
static