osprey-gcc/gcc/genmodes.c File Reference

#include "bconfig.h"
#include "system.h"
#include "errors.h"
#include "hashtab.h"
#include "mode-classes.def"
#include "machmode.def"

Include dependency graph for genmodes.c:

Go to the source code of this file.

Data Types

type  mode_data
type  mode_adjust

Defines

#define DEF_MODE_CLASS(M)   M
#define DEF_MODE_CLASS(M)   #M
#define HAVE_EXTRA_MODES   0
#define EXTRA_MODES_FILE   ""
#define for_all_modes(C, M)
#define validate_field_(mname, fname, req, val, unset, file, line)
#define validate_field(M, F)   validate_field_(M->name, #F, r_##F, M->F, blank_mode.F, M->file, M->line)
#define COMPLEX_MODES(C)   make_complex_modes(MODE_##C, __FILE__, __LINE__)
#define VECTOR_MODES(C, W)   make_vector_modes(MODE_##C, W, __FILE__, __LINE__)
#define _SPECIAL_MODE(C, N)   make_special_mode(MODE_##C, #N, __FILE__, __LINE__)
#define RANDOM_MODE(N)   _SPECIAL_MODE (RANDOM, N)
#define CC_MODE(N)   _SPECIAL_MODE (CC, N)
#define INT_MODE(N, Y)   FRACTIONAL_INT_MODE (N, -1U, Y)
#define FRACTIONAL_INT_MODE(N, B, Y)   make_int_mode (#N, B, Y, __FILE__, __LINE__)
#define FLOAT_MODE(N, Y, F)   FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
#define FRACTIONAL_FLOAT_MODE(N, B, Y, F)   make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
#define RESET_FLOAT_FORMAT(N, F)   reset_float_format (#N, #F, __FILE__, __LINE__)
#define PARTIAL_INT_MODE(M)   make_partial_integer_mode (#M, "P" #M, -1U, __FILE__, __LINE__)
#define VECTOR_MODE(C, M, N)   make_vector_mode (MODE_##C, #M, N, __FILE__, __LINE__);
#define _ADD_ADJUST(A, M, X, C)   new_adjust (#M, &adj_##A, #A, #X, MODE_##C, __FILE__, __LINE__)
#define ADJUST_BYTESIZE(M, X)   _ADD_ADJUST(bytesize, M, X, RANDOM)
#define ADJUST_ALIGNMENT(M, X)   _ADD_ADJUST(alignment, M, X, RANDOM)
#define ADJUST_FLOAT_FORMAT(M, X)   _ADD_ADJUST(format, M, X, FLOAT)
#define tagged_printf(FMT, ARG, TAG)
#define print_decl(TYPE, NAME, ASIZE)   puts ("\nconst " TYPE " " NAME "[" ASIZE "] =\n{");
#define print_maybe_const_decl(TYPE, NAME, ASIZE, CATEGORY)
#define print_closer()   puts ("};")

Enumerations

enum  mode_class {
  MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT,
  MODE_CC, MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_VECTOR_INT,
  MODE_VECTOR_FLOAT, MAX_MODE_CLASS, MODE_RANDOM, MODE_INT,
  MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC, MODE_COMPLEX_INT,
  MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FLOAT, MAX_MODE_CLASS,
  MODE_CLASSES, MAX_MODE_CLASS, MODE_CLASSES, MAX_MODE_CLASS,
  MODE_CLASSES, MAX_MODE_CLASS, MODE_CLASSES, MAX_MODE_CLASS
}
enum  requirement {
  SET, UNSET, OPTIONAL, SET,
  UNSET, OPTIONAL
}

Functions/Subroutines

static enum mode_class complex_class (enum mode_class c)
static enum mode_class vector_class (enum mode_class cl)
static struct mode_datafind_mode (const char *name)
static struct mode_datanew_mode (enum mode_class cl, const char *name, const char *file, unsigned int line)
static hashval_t hash_mode (const void *p)
static int eq_mode (const void *p, const void *q)
static void ATTRIBUTE_UNUSED new_adjust (const char *name, struct mode_adjust **category, const char *catname, const char *adjustment, enum mode_class required_class, 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 (struct mode_data *m)
static void complete_all_modes (void)
static void make_complex_modes (enum mode_class cl, const char *file, unsigned int line)
static void ATTRIBUTE_UNUSED 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_int_mode (const char *name, unsigned int precision, unsigned int bytesize, 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 ATTRIBUTE_UNUSED reset_float_format (const char *name, const char *format, const char *file, unsigned int line)
static void ATTRIBUTE_UNUSED make_partial_integer_mode (const char *base, const char *name, unsigned int precision, const char *file, unsigned int line)
static void ATTRIBUTE_UNUSED make_vector_mode (enum mode_class bclass, const char *base, unsigned int ncomponents, const char *file, unsigned int line)
static void create_modes (void)
static int cmp_modes (const void *a, const void *b)
static void calc_wider_mode (void)
static void emit_insn_modes_h (void)
static void emit_insn_modes_c_header (void)
static void emit_min_insn_modes_c_header (void)
static void emit_mode_name (void)
static void emit_mode_class (void)
static void emit_mode_precision (void)
static void emit_mode_size (void)
static void emit_mode_nunits (void)
static void emit_mode_wider (void)
static void emit_mode_mask (void)
static void emit_mode_inner (void)
static void emit_mode_base_align (void)
static void emit_class_narrowest_mode (void)
static void emit_real_format_for_mode (void)
static void emit_mode_adjustments (void)
static void emit_insn_modes_c (void)
static void emit_min_insn_modes_c (void)
int main (int argc, char **argv)

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


Define Documentation

#define _ADD_ADJUST ( A,
M,
X,
 )     new_adjust (#M, &adj_##A, #A, #X, MODE_##C, __FILE__, __LINE__)

Definition at line 632 of file genmodes.c.

#define _SPECIAL_MODE ( C,
 )     make_special_mode(MODE_##C, #N, __FILE__, __LINE__)

Definition at line 501 of file genmodes.c.

#define ADJUST_ALIGNMENT ( M,
X   )     _ADD_ADJUST(alignment, M, X, RANDOM)

Definition at line 636 of file genmodes.c.

#define ADJUST_BYTESIZE ( M,
X   )     _ADD_ADJUST(bytesize, M, X, RANDOM)

Definition at line 635 of file genmodes.c.

#define ADJUST_FLOAT_FORMAT ( M,
X   )     _ADD_ADJUST(format, M, X, FLOAT)

Definition at line 637 of file genmodes.c.

#define CC_MODE (  )     _SPECIAL_MODE (CC, N)

Definition at line 503 of file genmodes.c.

Referenced by sparc_init_modes().

#define COMPLEX_MODES (  )     make_complex_modes(MODE_##C, __FILE__, __LINE__)

Definition at line 400 of file genmodes.c.

#define DEF_MODE_CLASS (  )     #M

Definition at line 36 of file genmodes.c.

#define DEF_MODE_CLASS (  )     M

Definition at line 36 of file genmodes.c.

#define EXTRA_MODES_FILE   ""

Definition at line 48 of file genmodes.c.

#define FLOAT_MODE ( N,
Y,
F   )     FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)

Definition at line 526 of file genmodes.c.

#define for_all_modes ( C,
 ) 

#define FRACTIONAL_FLOAT_MODE ( N,
B,
Y,
F   )     make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)

Definition at line 527 of file genmodes.c.

#define FRACTIONAL_INT_MODE ( N,
B,
 )     make_int_mode (#N, B, Y, __FILE__, __LINE__)

Definition at line 513 of file genmodes.c.

#define HAVE_EXTRA_MODES   0

#define INT_MODE ( N,
 )     FRACTIONAL_INT_MODE (N, -1U, Y)

Definition at line 512 of file genmodes.c.

#define PARTIAL_INT_MODE (  )     make_partial_integer_mode (#M, "P" #M, -1U, __FILE__, __LINE__)

Definition at line 564 of file genmodes.c.

 
#define print_closer (  )     puts ("};")

#define print_decl ( TYPE,
NAME,
ASIZE   )     puts ("\nconst " TYPE " " NAME "[" ASIZE "] =\n{");

#define print_maybe_const_decl ( TYPE,
NAME,
ASIZE,
CATEGORY   ) 

Value:

printf ("\n" TYPE " " NAME "[" ASIZE "] = \n{\n",   \
    adj_##CATEGORY ? "" : "const ")

Definition at line 759 of file genmodes.c.

Referenced by emit_mode_base_align(), emit_mode_size(), and emit_real_format_for_mode().

#define RANDOM_MODE (  )     _SPECIAL_MODE (RANDOM, N)

Definition at line 502 of file genmodes.c.

#define RESET_FLOAT_FORMAT ( N,
F   )     reset_float_format (#N, #F, __FILE__, __LINE__)

Definition at line 542 of file genmodes.c.

#define tagged_printf ( FMT,
ARG,
TAG   ) 

Value:

do {    \
  int count_;           \
  printf ("  " FMT ",%n", ARG, &count_);    \
  printf ("%*s/* %s */\n", 27 - count_, "", TAG); \
} while (0)

Definition at line 750 of file genmodes.c.

Referenced by emit_class_narrowest_mode(), emit_mode_base_align(), emit_mode_class(), emit_mode_inner(), emit_mode_mask(), emit_mode_nunits(), emit_mode_precision(), emit_mode_size(), emit_mode_wider(), and emit_real_format_for_mode().

#define validate_field ( M,
F   )     validate_field_(M->name, #F, r_##F, M->F, blank_mode.F, M->file, M->line)

Definition at line 260 of file genmodes.c.

Referenced by validate_mode().

#define validate_field_ ( mname,
fname,
req,
val,
unset,
file,
line   ) 

Value:

do {  \
  switch (req)                \
    {                 \
    case SET:               \
      if (val == unset)             \
  error ("%s:%d: (%s) field %s must be set",      \
         file, line, mname, fname);       \
      break;                \
    case UNSET:               \
      if (val != unset)             \
  error ("%s:%d: (%s) field %s must not be set",      \
         file, line, mname, fname);       \
    case OPTIONAL:              \
      break;                \
    }                 \
} while (0)

Definition at line 243 of file genmodes.c.

#define VECTOR_MODE ( C,
M,
 )     make_vector_mode (MODE_##C, #M, N, __FILE__, __LINE__);

Definition at line 591 of file genmodes.c.

#define VECTOR_MODES ( C,
 )     make_vector_modes(MODE_##C, W, __FILE__, __LINE__)

Definition at line 453 of file genmodes.c.


Enumeration Type Documentation

enum mode_class

Enumerator:
MODE_RANDOM 
MODE_INT 
MODE_FLOAT 
MODE_PARTIAL_INT 
MODE_CC 
MODE_COMPLEX_INT 
MODE_COMPLEX_FLOAT 
MODE_VECTOR_INT 
MODE_VECTOR_FLOAT 
MAX_MODE_CLASS 
MODE_RANDOM 
MODE_INT 
MODE_FLOAT 
MODE_PARTIAL_INT 
MODE_CC 
MODE_COMPLEX_INT 
MODE_COMPLEX_FLOAT 
MODE_VECTOR_INT 
MODE_VECTOR_FLOAT 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 
MODE_CLASSES 
MAX_MODE_CLASS 

Definition at line 32 of file genmodes.c.

Enumerator:
SET 
UNSET 
OPTIONAL 
SET 
UNSET 
OPTIONAL 

Definition at line 241 of file genmodes.c.


Function Documentation

static void calc_wider_mode ( void   )  [static]

Definition at line 693 of file genmodes.c.

References alloca, c, cmp_modes(), i, MAX, MAX_MODE_CLASS, MODE_CC, MODE_RANDOM, n_modes, mode_data::next, next, prev, qsort(), and mode_data::wider.

Referenced by main().

static int cmp_modes ( const void a,
const void b 
) [static]

Definition at line 661 of file genmodes.c.

References mode_data::bytesize, mode_data::component, n, and mode_data::precision.

Referenced by calc_wider_mode().

static void complete_all_modes ( void   )  [static]

Definition at line 390 of file genmodes.c.

References cl(), complete_mode(), and for_all_modes.

Referenced by main().

static void complete_mode ( struct mode_data m  )  [static]

static enum mode_class complex_class ( enum mode_class  c  )  [static]

static void create_modes ( void   )  [static]

Definition at line 640 of file genmodes.c.

Referenced by main().

static void emit_class_narrowest_mode ( void   )  [static]

static void emit_insn_modes_c ( void   )  [static]

static void emit_insn_modes_c_header ( void   )  [static]

Definition at line 834 of file genmodes.c.

References EXTRA_MODES_FILE, HAVE_EXTRA_MODES, printf(), and puts().

Referenced by emit_insn_modes_c().

static void emit_insn_modes_h ( void   )  [static]

static void emit_min_insn_modes_c ( void   )  [static]

static void emit_min_insn_modes_c_header ( void   )  [static]

Definition at line 852 of file genmodes.c.

References EXTRA_MODES_FILE, HAVE_EXTRA_MODES, printf(), and puts().

Referenced by emit_min_insn_modes_c().

static void emit_mode_adjustments ( void   )  [static]

static void emit_mode_base_align ( void   )  [static]

static void emit_mode_class ( void   )  [static]

static void emit_mode_inner ( void   )  [static]

static void emit_mode_mask ( void   )  [static]

static void emit_mode_name ( void   )  [static]

Definition at line 867 of file genmodes.c.

References c, for_all_modes, mode_data::name, print_closer, print_decl, and printf().

Referenced by emit_insn_modes_c(), and emit_min_insn_modes_c().

static void emit_mode_nunits ( void   )  [static]

static void emit_mode_precision ( void   )  [static]

static void emit_mode_size ( void   )  [static]

static void emit_mode_wider ( void   )  [static]

static void emit_real_format_for_mode ( void   )  [static]

static int eq_mode ( const void p,
const void q 
) [static]

Definition at line 183 of file genmodes.c.

References a, b, mode_data::name, and strcmp().

Referenced by main().

static struct mode_data* find_mode ( const char *  name  )  [static, read]

static hashval_t hash_mode ( const void p  )  [static]

Definition at line 176 of file genmodes.c.

References htab_hash_string(), and mode_data::name.

Referenced by main().

int main ( int argc  ,
char **  argv 
)

static void make_complex_modes ( enum mode_class  cl,
const char *  file,
unsigned int  line 
) [static]

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]

Definition at line 517 of file genmodes.c.

References mode_data::bytesize, MODE_INT, new_mode(), and mode_data::precision.

static void ATTRIBUTE_UNUSED make_partial_integer_mode ( const char *  base,
const char *  name,
unsigned int  precision,
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]

Definition at line 506 of file genmodes.c.

References new_mode().

static void ATTRIBUTE_UNUSED make_vector_mode ( enum mode_class  bclass,
const char *  base,
unsigned int  ncomponents,
const char *  file,
unsigned int  line 
) [static]

static void ATTRIBUTE_UNUSED make_vector_modes ( enum mode_class  cl,
unsigned int  width,
const char *  file,
unsigned int  line 
) [static]

static void ATTRIBUTE_UNUSED new_adjust ( const char *  name,
struct mode_adjust **  category,
const char *  catname,
const char *  adjustment,
enum mode_class  required_class,
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 
) [static, read]

static void ATTRIBUTE_UNUSED reset_float_format ( const char *  name,
const char *  format,
const char *  file,
unsigned int  line 
) [static]

Definition at line 545 of file genmodes.c.

References mode_data::cl, error(), find_mode(), mode_data::format, and MODE_FLOAT.

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]

Definition at line 264 of file genmodes.c.

References format, and validate_field.

Referenced by complete_mode().

static enum mode_class vector_class ( enum mode_class  cl  )  [static]


Variable Documentation

Definition at line 103 of file genmodes.c.

Definition at line 102 of file genmodes.c.

Definition at line 104 of file genmodes.c.

Initial value:

 {
  0, "<unknown>", MAX_MODE_CLASS,
  -1U, -1U, -1U, -1U,
  0, 0, 0, 0, 0,
  "<unknown>", 0
}

Definition at line 80 of file genmodes.c.

const char* const mode_class_names[MAX_MODE_CLASS] [static]

struct mode_data* modes[MAX_MODE_CLASS] [static]

Definition at line 87 of file genmodes.c.

Referenced by find_mode(), main(), and new_mode().

unsigned int n_modes[MAX_MODE_CLASS] [static]

Definition at line 77 of file genmodes.c.

Referenced by calc_wider_mode(), and new_mode().

Definition at line 78 of file genmodes.c.


Generated on Wed Apr 8 14:21:13 2009 for Open64 by  doxygen 1.5.6