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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [alpha/] [driver-alpha.c] - Blame information for rev 749

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

Line No. Rev Author Line
1 709 jeremybenn
/* Subroutines for the gcc driver.
2
   Copyright (C) 2009, 2011 Free Software Foundation, Inc.
3
   Contributed by Arthur Loiret <aloiret@debian.org>
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
 
12
GCC is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public 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 "tm.h"
25
 
26
/* Chip family type IDs, returned by implver instruction.  */
27
#define IMPLVER_EV4_FAMILY      0                /* LCA/EV4/EV45 */
28
#define IMPLVER_EV5_FAMILY      1               /* EV5/EV56/PCA56 */
29
#define IMPLVER_EV6_FAMILY      2               /* EV6 */
30
#define IMPLVER_EV7_FAMILY      3               /* EV7 */
31
 
32
/* Bit defines for amask instruction.  */
33
#define AMASK_BWX          0x1          /* byte/word extension.  */
34
#define AMASK_FIX          0x2          /* sqrt and f <-> i conversions 
35
                                           extension.  */
36
#define AMASK_CIX          0x4          /* count extension.  */
37
#define AMASK_MVI          0x100        /* multimedia extension.  */
38
#define AMASK_PRECISE      0x200        /* Precise arithmetic traps.  */
39
#define AMASK_LOCKPFTCHOK  0x1000       /* Safe to prefetch lock cache
40
                                           block.  */
41
 
42
/* This will be called by the spec parser in gcc.c when it sees
43
   a %:local_cpu_detect(args) construct.  Currently it will be called
44
   with either "cpu" or "tune" as argument depending on if -mcpu=native
45
   or -mtune=native is to be substituted.
46
 
47
   It returns a string containing new command line parameters to be
48
   put at the place of the above two options, depending on what CPU
49
   this is executed.  E.g. "-mcpu=ev6" on an Alpha 21264 for
50
   -mcpu=native.  If the routine can't detect a known processor,
51
   the -mcpu or -mtune option is discarded.
52
 
53
   ARGC and ARGV are set depending on the actual arguments given
54
   in the spec.  */
55
const char *
56
host_detect_local_cpu (int argc, const char **argv)
57
{
58
  static const struct cpu_types {
59
    long implver;
60
    long amask;
61
    const char *const cpu;
62
  } cpu_types[] = {
63
    { IMPLVER_EV7_FAMILY, AMASK_BWX|AMASK_MVI|AMASK_FIX|AMASK_CIX, "ev67" },
64
    { IMPLVER_EV6_FAMILY, AMASK_BWX|AMASK_MVI|AMASK_FIX|AMASK_CIX, "ev67" },
65
    { IMPLVER_EV6_FAMILY, AMASK_BWX|AMASK_MVI|AMASK_FIX, "ev6" },
66
    { IMPLVER_EV5_FAMILY, AMASK_BWX|AMASK_MVI, "pca56" },
67
    { IMPLVER_EV5_FAMILY, AMASK_BWX, "ev56" },
68
    { IMPLVER_EV5_FAMILY, 0, "ev5" },
69
    { IMPLVER_EV4_FAMILY, 0, "ev4" },
70
    { 0, 0, NULL }
71
  };
72
  long implver;
73
  long amask;
74
  const char *cpu;
75
  int i;
76
 
77
  if (argc < 1)
78
    return NULL;
79
 
80
  if (strcmp (argv[0], "cpu") && strcmp (argv[0], "tune"))
81
    return NULL;
82
 
83
  implver = __builtin_alpha_implver ();
84
  amask = __builtin_alpha_amask (~0L);
85
  cpu = NULL;
86
 
87
  for (i = 0; cpu_types[i].cpu != NULL; i++)
88
    if (implver == cpu_types[i].implver
89
        && (~amask & cpu_types[i].amask) == cpu_types[i].amask)
90
      {
91
        cpu = cpu_types[i].cpu;
92
        break;
93
      }
94
 
95
  if (cpu == NULL)
96
    return NULL;
97
 
98
  return concat ("-m", argv[0], "=", cpu, NULL);
99
}

powered by: WebSVN 2.1.0

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