OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr44699.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2" } */
3
typedef long unsigned int size_t;
4
typedef long int intmax_t;
5
typedef long unsigned int uintmax_t;
6
extern void *xmalloc (size_t) __attribute__ ((__malloc__));
7
extern const char *trim_filename (const char *);
8
 
9
static __inline void *
10
__inline_memcpy_chk (void *__dest, const void *__src, size_t __len)
11
{
12
  return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
13
}
14
 
15
typedef unsigned int hashval_t;
16
typedef hashval_t (*htab_hash) (const void *);
17
typedef int (*htab_eq) (const void *, const void *);
18
typedef void (*htab_del) (void *);
19
typedef int (*htab_trav) (void **, void *);
20
typedef void *(*htab_alloc) (size_t, size_t);
21
typedef void (*htab_free) (void *);
22
 
23
typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
24
typedef void (*htab_free_with_arg) (void *, void *);
25
struct htab {
26
  htab_hash hash_f;
27
  htab_eq eq_f;
28
  htab_del del_f;
29
  void ** entries;
30
  size_t size;
31
  size_t n_elements;
32
  size_t n_deleted;
33
  unsigned int searches;
34
  unsigned int collisions;
35
  htab_alloc alloc_f;
36
  htab_free free_f;
37
  void * alloc_arg;
38
  htab_alloc_with_arg alloc_with_arg_f;
39
  htab_free_with_arg free_with_arg_f;
40
  unsigned int size_prime_index;
41
};
42
 
43
typedef struct htab *htab_t;
44
enum insert_option {NO_INSERT, INSERT};
45
extern void * htab_find (htab_t, const void *);
46
extern void ** htab_find_slot (htab_t, const void *, enum insert_option);
47
 
48
enum mode_class { MODE_RANDOM, MODE_CC, MODE_INT, MODE_PARTIAL_INT, MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_FLOAT, MODE_DECIMAL_FLOAT, MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM, MODE_VECTOR_FLOAT, MAX_MODE_CLASS };
49
 
50
static const char *const mode_class_names[MAX_MODE_CLASS] =
51
{
52
  "MODE_RANDOM", "MODE_CC", "MODE_INT", "MODE_PARTIAL_INT", "MODE_FRACT", "MODE_UFRACT", "MODE_ACCUM", "MODE_UACCUM", "MODE_FLOAT", "MODE_DECIMAL_FLOAT", "MODE_COMPLEX_INT", "MODE_COMPLEX_FLOAT", "MODE_VECTOR_INT", "MODE_VECTOR_FRACT", "MODE_VECTOR_UFRACT", "MODE_VECTOR_ACCUM", "MODE_VECTOR_UACCUM", "MODE_VECTOR_FLOAT"
53
};
54
struct mode_data
55
{
56
  struct mode_data *next;
57
 
58
  const char *name;
59
  enum mode_class cl;
60
  unsigned int precision;
61
  unsigned int bytesize;
62
  unsigned int ncomponents;
63
  unsigned int alignment;
64
  const char *format;
65
 
66
  struct mode_data *component;
67
  struct mode_data *wider;
68
  struct mode_data *wider_2x;
69
 
70
  struct mode_data *contained;
71
 
72
  struct mode_data *next_cont;
73
 
74
  const char *file;
75
  unsigned int line;
76
  unsigned int counter;
77
  unsigned int ibit;
78
  unsigned int fbit;
79
};
80
 
81
static struct mode_data *modes[MAX_MODE_CLASS];
82
static unsigned int n_modes[MAX_MODE_CLASS];
83
static struct mode_data *void_mode;
84
 
85
static const struct mode_data blank_mode = {
86
  0, "<unknown>", MAX_MODE_CLASS,
87
  -1U, -1U, -1U, -1U,
88
  0, 0, 0, 0, 0, 0,
89
  "<unknown>", 0, 0, 0, 0
90
};
91
 
92
static htab_t modes_by_name;
93
 
94
static __inline__ struct mode_data *
95
find_mode (const char *name)
96
{
97
  struct mode_data key;
98
 
99
  key.name = name;
100
  return (struct mode_data *) htab_find (modes_by_name, &key);
101
}
102
 
103
static struct mode_data *
104
new_mode (enum mode_class cl, const char *name,
105
   const char *file, unsigned int line)
106
{
107
  struct mode_data *m;
108
  static unsigned int count = 0;
109
 
110
  m = find_mode (name);
111
  if (m)
112
    {
113
      error ("%s:%d: duplicate definition of mode \"%s\"",
114
      trim_filename (file), line, name);
115
      error ("%s:%d: previous definition here", m->file, m->line);
116
      return m;
117
    }
118
 
119
  m = ((struct mode_data *) xmalloc (sizeof (struct mode_data)));
120
  ((__builtin_object_size (m, 0) != (size_t) -1) ? __builtin___memcpy_chk (m, &blank_mode, sizeof (struct mode_data), __builtin_object_size (m, 0)) : __inline_memcpy_chk (m, &blank_mode, sizeof (struct mode_data)));
121
  m->cl = cl;
122
  m->name = name;
123
  if (file)
124
    m->file = trim_filename (file);
125
  m->line = line;
126
  m->counter = count++;
127
 
128
  m->next = modes[cl];
129
  modes[cl] = m;
130
  n_modes[cl]++;
131
 
132
  *htab_find_slot (modes_by_name, m, INSERT) = m;
133
 
134
  return m;
135
}
136
 
137
static void
138
make_int_mode (const char *name,
139
        unsigned int precision, unsigned int bytesize,
140
        const char *file, unsigned int line)
141
{
142
  struct mode_data *m = new_mode (MODE_INT, name, file, line);
143
  m->bytesize = bytesize;
144
  m->precision = precision;
145
}
146
 
147
static void
148
create_modes (void)
149
{
150
make_int_mode ("HI", -1U, 2, "../../work/gcc/machmode.def", 182);
151
}
152
 
153
int
154
main (int argc, char **argv)
155
{
156
  create_modes ();
157
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.