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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [common/] [config/] [bfin/] [bfin-common.c] - Blame information for rev 708

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 708 jeremybenn
/* Common hooks for Blackfin.
2
   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
3
   Free Software Foundation, Inc.
4
 
5
   This file is part of GCC.
6
 
7
   GCC is free software; you can redistribute it and/or modify it
8
   under the terms of the GNU General Public License as published
9
   by the Free Software Foundation; either version 3, or (at your
10
   option) any later version.
11
 
12
   GCC is distributed in the hope that it will be useful, but WITHOUT
13
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15
   License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with GCC; see the file COPYING3.  If not see
19
   <http://www.gnu.org/licenses/>.  */
20
 
21
#include "config.h"
22
#include "system.h"
23
#include "coretypes.h"
24
#include "diagnostic-core.h"
25
#include "tm.h"
26
#include "machmode.h"
27
#include "tm_p.h"
28
#include "common/common-target.h"
29
#include "common/common-target-def.h"
30
#include "opts.h"
31
#include "flags.h"
32
 
33
EXPORTED_CONST struct bfin_cpu bfin_cpus[] =
34
{
35
 
36
  {"bf512", BFIN_CPU_BF512, 0x0002,
37
   WA_SPECULATIVE_LOADS | WA_05000074},
38
  {"bf512", BFIN_CPU_BF512, 0x0001,
39
   WA_SPECULATIVE_LOADS | WA_05000074},
40
  {"bf512", BFIN_CPU_BF512, 0x0000,
41
   WA_SPECULATIVE_LOADS | WA_05000074},
42
 
43
  {"bf514", BFIN_CPU_BF514, 0x0002,
44
   WA_SPECULATIVE_LOADS | WA_05000074},
45
  {"bf514", BFIN_CPU_BF514, 0x0001,
46
   WA_SPECULATIVE_LOADS | WA_05000074},
47
  {"bf514", BFIN_CPU_BF514, 0x0000,
48
   WA_SPECULATIVE_LOADS | WA_05000074},
49
 
50
  {"bf516", BFIN_CPU_BF516, 0x0002,
51
   WA_SPECULATIVE_LOADS | WA_05000074},
52
  {"bf516", BFIN_CPU_BF516, 0x0001,
53
   WA_SPECULATIVE_LOADS | WA_05000074},
54
  {"bf516", BFIN_CPU_BF516, 0x0000,
55
   WA_SPECULATIVE_LOADS | WA_05000074},
56
 
57
  {"bf518", BFIN_CPU_BF518, 0x0002,
58
   WA_SPECULATIVE_LOADS | WA_05000074},
59
  {"bf518", BFIN_CPU_BF518, 0x0001,
60
   WA_SPECULATIVE_LOADS | WA_05000074},
61
  {"bf518", BFIN_CPU_BF518, 0x0000,
62
   WA_SPECULATIVE_LOADS | WA_05000074},
63
 
64
  {"bf522", BFIN_CPU_BF522, 0x0002,
65
   WA_SPECULATIVE_LOADS | WA_05000074},
66
  {"bf522", BFIN_CPU_BF522, 0x0001,
67
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
68
  {"bf522", BFIN_CPU_BF522, 0x0000,
69
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
70
 
71
  {"bf523", BFIN_CPU_BF523, 0x0002,
72
   WA_SPECULATIVE_LOADS | WA_05000074},
73
  {"bf523", BFIN_CPU_BF523, 0x0001,
74
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
75
  {"bf523", BFIN_CPU_BF523, 0x0000,
76
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
77
 
78
  {"bf524", BFIN_CPU_BF524, 0x0002,
79
   WA_SPECULATIVE_LOADS | WA_05000074},
80
  {"bf524", BFIN_CPU_BF524, 0x0001,
81
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
82
  {"bf524", BFIN_CPU_BF524, 0x0000,
83
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
84
 
85
  {"bf525", BFIN_CPU_BF525, 0x0002,
86
   WA_SPECULATIVE_LOADS | WA_05000074},
87
  {"bf525", BFIN_CPU_BF525, 0x0001,
88
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
89
  {"bf525", BFIN_CPU_BF525, 0x0000,
90
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
91
 
92
  {"bf526", BFIN_CPU_BF526, 0x0002,
93
   WA_SPECULATIVE_LOADS | WA_05000074},
94
  {"bf526", BFIN_CPU_BF526, 0x0001,
95
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
96
  {"bf526", BFIN_CPU_BF526, 0x0000,
97
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
98
 
99
  {"bf527", BFIN_CPU_BF527, 0x0002,
100
   WA_SPECULATIVE_LOADS | WA_05000074},
101
  {"bf527", BFIN_CPU_BF527, 0x0001,
102
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
103
  {"bf527", BFIN_CPU_BF527, 0x0000,
104
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000074},
105
 
106
  {"bf531", BFIN_CPU_BF531, 0x0006,
107
   WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS | WA_05000074},
108
  {"bf531", BFIN_CPU_BF531, 0x0005,
109
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315
110
   | WA_LOAD_LCREGS | WA_05000074},
111
  {"bf531", BFIN_CPU_BF531, 0x0004,
112
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
113
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
114
   | WA_05000074},
115
  {"bf531", BFIN_CPU_BF531, 0x0003,
116
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
117
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
118
   | WA_05000074},
119
 
120
  {"bf532", BFIN_CPU_BF532, 0x0006,
121
   WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS | WA_05000074},
122
  {"bf532", BFIN_CPU_BF532, 0x0005,
123
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315
124
   | WA_LOAD_LCREGS | WA_05000074},
125
  {"bf532", BFIN_CPU_BF532, 0x0004,
126
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
127
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
128
   | WA_05000074},
129
  {"bf532", BFIN_CPU_BF532, 0x0003,
130
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
131
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
132
   | WA_05000074},
133
 
134
  {"bf533", BFIN_CPU_BF533, 0x0006,
135
   WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS | WA_05000074},
136
  {"bf533", BFIN_CPU_BF533, 0x0005,
137
   WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315
138
   | WA_LOAD_LCREGS | WA_05000074},
139
  {"bf533", BFIN_CPU_BF533, 0x0004,
140
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
141
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
142
   | WA_05000074},
143
  {"bf533", BFIN_CPU_BF533, 0x0003,
144
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
145
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
146
   | WA_05000074},
147
 
148
  {"bf534", BFIN_CPU_BF534, 0x0003,
149
   WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS | WA_05000074},
150
  {"bf534", BFIN_CPU_BF534, 0x0002,
151
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
152
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
153
   | WA_05000074},
154
  {"bf534", BFIN_CPU_BF534, 0x0001,
155
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
156
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
157
   | WA_05000074},
158
 
159
  {"bf536", BFIN_CPU_BF536, 0x0003,
160
   WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS | WA_05000074},
161
  {"bf536", BFIN_CPU_BF536, 0x0002,
162
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
163
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
164
   | WA_05000074},
165
  {"bf536", BFIN_CPU_BF536, 0x0001,
166
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
167
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
168
   | WA_05000074},
169
 
170
  {"bf537", BFIN_CPU_BF537, 0x0003,
171
   WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS | WA_05000074},
172
  {"bf537", BFIN_CPU_BF537, 0x0002,
173
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
174
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
175
   | WA_05000074},
176
  {"bf537", BFIN_CPU_BF537, 0x0001,
177
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
178
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
179
   | WA_05000074},
180
 
181
  {"bf538", BFIN_CPU_BF538, 0x0005,
182
   WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS | WA_05000074},
183
  {"bf538", BFIN_CPU_BF538, 0x0004,
184
   WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS | WA_05000074},
185
  {"bf538", BFIN_CPU_BF538, 0x0003,
186
   WA_SPECULATIVE_LOADS | WA_RETS
187
   | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS | WA_05000074},
188
  {"bf538", BFIN_CPU_BF538, 0x0002,
189
   WA_SPECULATIVE_LOADS | WA_RETS
190
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
191
   | WA_05000074},
192
 
193
  {"bf539", BFIN_CPU_BF539, 0x0005,
194
   WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS | WA_05000074},
195
  {"bf539", BFIN_CPU_BF539, 0x0004,
196
   WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS | WA_05000074},
197
  {"bf539", BFIN_CPU_BF539, 0x0003,
198
   WA_SPECULATIVE_LOADS | WA_RETS
199
   | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS | WA_05000074},
200
  {"bf539", BFIN_CPU_BF539, 0x0002,
201
   WA_SPECULATIVE_LOADS | WA_RETS
202
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
203
   | WA_05000074},
204
 
205
  {"bf542m", BFIN_CPU_BF542M, 0x0003,
206
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
207
 
208
  {"bf542", BFIN_CPU_BF542, 0x0004,
209
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
210
  {"bf542", BFIN_CPU_BF542, 0x0002,
211
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
212
  {"bf542", BFIN_CPU_BF542, 0x0001,
213
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_05000074},
214
  {"bf542", BFIN_CPU_BF542, 0x0000,
215
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS
216
   | WA_05000074},
217
 
218
  {"bf544m", BFIN_CPU_BF544M, 0x0003,
219
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
220
 
221
  {"bf544", BFIN_CPU_BF544, 0x0004,
222
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
223
  {"bf544", BFIN_CPU_BF544, 0x0002,
224
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
225
  {"bf544", BFIN_CPU_BF544, 0x0001,
226
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_05000074},
227
  {"bf544", BFIN_CPU_BF544, 0x0000,
228
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS
229
   | WA_05000074},
230
 
231
  {"bf547m", BFIN_CPU_BF547M, 0x0003,
232
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
233
 
234
  {"bf547", BFIN_CPU_BF547, 0x0004,
235
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
236
  {"bf547", BFIN_CPU_BF547, 0x0002,
237
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
238
  {"bf547", BFIN_CPU_BF547, 0x0001,
239
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_05000074},
240
  {"bf547", BFIN_CPU_BF547, 0x0000,
241
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS
242
   | WA_05000074},
243
 
244
  {"bf548m", BFIN_CPU_BF548M, 0x0003,
245
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
246
 
247
  {"bf548", BFIN_CPU_BF548, 0x0004,
248
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
249
  {"bf548", BFIN_CPU_BF548, 0x0002,
250
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
251
  {"bf548", BFIN_CPU_BF548, 0x0001,
252
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_05000074},
253
  {"bf548", BFIN_CPU_BF548, 0x0000,
254
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS
255
   | WA_05000074},
256
 
257
  {"bf549m", BFIN_CPU_BF549M, 0x0003,
258
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
259
 
260
  {"bf549", BFIN_CPU_BF549, 0x0004,
261
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
262
  {"bf549", BFIN_CPU_BF549, 0x0002,
263
   WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS | WA_05000074},
264
  {"bf549", BFIN_CPU_BF549, 0x0001,
265
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_05000074},
266
  {"bf549", BFIN_CPU_BF549, 0x0000,
267
   WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS
268
   | WA_05000074},
269
 
270
  {"bf561", BFIN_CPU_BF561, 0x0005, WA_RETS
271
   | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS | WA_05000074},
272
  {"bf561", BFIN_CPU_BF561, 0x0003,
273
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
274
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
275
   | WA_05000074},
276
  {"bf561", BFIN_CPU_BF561, 0x0002,
277
   WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
278
   | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS
279
   | WA_05000074},
280
 
281
  {"bf592", BFIN_CPU_BF592, 0x0001,
282
   WA_SPECULATIVE_LOADS | WA_05000074},
283
  {"bf592", BFIN_CPU_BF592, 0x0000,
284
   WA_SPECULATIVE_LOADS | WA_05000074},
285
 
286
  {NULL, BFIN_CPU_UNKNOWN, 0, 0}
287
};
288
 
289
/* Implement TARGET_HANDLE_OPTION.  */
290
 
291
static bool
292
bfin_handle_option (struct gcc_options *opts,
293
                    struct gcc_options *opts_set ATTRIBUTE_UNUSED,
294
                    const struct cl_decoded_option *decoded,
295
                    location_t loc)
296
{
297
  size_t code = decoded->opt_index;
298
  const char *arg = decoded->arg;
299
  int value = decoded->value;
300
 
301
  switch (code)
302
    {
303
    case OPT_mshared_library_id_:
304
      if (value > MAX_LIBRARY_ID)
305
        error_at (loc, "-mshared-library-id=%s is not between 0 and %d",
306
                  arg, MAX_LIBRARY_ID);
307
      return true;
308
 
309
    case OPT_mcpu_:
310
      {
311
        const char *p, *q;
312
        int i;
313
 
314
        i = 0;
315
        while ((p = bfin_cpus[i].name) != NULL)
316
          {
317
            if (strncmp (arg, p, strlen (p)) == 0)
318
              break;
319
            i++;
320
          }
321
 
322
        if (p == NULL)
323
          {
324
            error_at (loc, "-mcpu=%s is not valid", arg);
325
            return false;
326
          }
327
 
328
        opts->x_bfin_cpu_type = bfin_cpus[i].type;
329
 
330
        q = arg + strlen (p);
331
 
332
        if (*q == '\0')
333
          {
334
            opts->x_bfin_si_revision = bfin_cpus[i].si_revision;
335
            opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
336
          }
337
        else if (strcmp (q, "-none") == 0)
338
          opts->x_bfin_si_revision = -1;
339
        else if (strcmp (q, "-any") == 0)
340
          {
341
            opts->x_bfin_si_revision = 0xffff;
342
            while (bfin_cpus[i].type == opts->x_bfin_cpu_type)
343
              {
344
                opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
345
                i++;
346
              }
347
          }
348
        else
349
          {
350
            unsigned int si_major, si_minor;
351
            int rev_len, n;
352
 
353
            rev_len = strlen (q);
354
 
355
            if (sscanf (q, "-%u.%u%n", &si_major, &si_minor, &n) != 2
356
                || n != rev_len
357
                || si_major > 0xff || si_minor > 0xff)
358
              {
359
              invalid_silicon_revision:
360
                error_at (loc, "-mcpu=%s has invalid silicon revision", arg);
361
                return false;
362
              }
363
 
364
            opts->x_bfin_si_revision = (si_major << 8) | si_minor;
365
 
366
            while (bfin_cpus[i].type == opts->x_bfin_cpu_type
367
                   && bfin_cpus[i].si_revision != opts->x_bfin_si_revision)
368
              i++;
369
 
370
            if (bfin_cpus[i].type != opts->x_bfin_cpu_type)
371
              goto invalid_silicon_revision;
372
 
373
            opts->x_bfin_workarounds |= bfin_cpus[i].workarounds;
374
          }
375
 
376
        return true;
377
      }
378
 
379
    default:
380
      return true;
381
    }
382
}
383
 
384
#undef TARGET_HANDLE_OPTION
385
#define TARGET_HANDLE_OPTION bfin_handle_option
386
 
387
#undef TARGET_DEFAULT_TARGET_FLAGS
388
#define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT
389
 
390
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;

powered by: WebSVN 2.1.0

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