1  /* Definitions of types that are used to store ARC architecture and
       2     device information.
       3     Copyright (C) 2016-2023 Free Software Foundation, Inc.
       4     Contributed by Claudiu Zissulescu (claziss@synopsys.com)
       5  
       6  This file is part of GCC.
       7  
       8  GCC is free software; you can redistribute it and/or modify
       9  it under the terms of the GNU General Public License as published by
      10  the Free Software Foundation; either version 3, or (at your option)
      11  any later version.
      12  
      13  GCC is distributed in the hope that it will be useful,
      14  but WITHOUT ANY WARRANTY; without even the implied warranty of
      15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16  GNU General Public License for more details.
      17  
      18  You should have received a copy of the GNU General Public License
      19  along with GCC; see the file COPYING3.  If not see
      20  <http://www.gnu.org/licenses/>.  */
      21  
      22  #ifndef GCC_ARC_ARCH_H
      23  #define GCC_ARC_ARCH_H
      24  
      25  #ifndef IN_LIBGCC2
      26  /* Architecture selection types.  */
      27  
      28  enum cpu_flags
      29    {
      30  #define ARC_OPT(NAME, CODE, MASK, DOC)	    NAME = CODE,
      31  #define ARC_OPTX(NAME, CODE, VAR, VAL, DOC0, DOC1) NAME = CODE,
      32  #include "arc-options.def"
      33  #undef ARC_OPT
      34  #undef ARC_OPTX
      35      FL_END
      36    };
      37  
      38  
      39  /* ARC architecture variants.  */
      40  
      41  enum base_architecture
      42    {
      43      BASE_ARCH_NONE,
      44  #define ARC_ARCH(NAME, ARCH, FLAGS, DFLAGS)  BASE_ARCH_##ARCH,
      45  #include "arc-arches.def"
      46  #undef ARC_ARCH
      47      BASE_ARCH_END
      48    };
      49  
      50  /* Architecture specific propoerties.  */
      51  
      52  typedef struct
      53  {
      54    /* Architecture name.  */
      55    const char *const name;
      56  
      57    /* Architecture class.  */
      58    enum base_architecture arch_id;
      59  
      60    /* All allowed flags for this architecture.  */
      61    const unsigned long long flags;
      62  
      63    /* Default flags for this architecture.  It is a subset of
      64       FLAGS.  */
      65    const unsigned long long dflags;
      66  } arc_arch_t;
      67  
      68  /* Tune variants.  Needs to match the attr_tune enum.  */
      69  
      70  enum arc_tune_attr
      71    {
      72      ARC_TUNE_NONE,
      73      ARC_TUNE_ARC600,
      74      ARC_TUNE_ARC7XX,
      75      ARC_TUNE_ARC700_4_2_STD,
      76      ARC_TUNE_ARC700_4_2_XMAC,
      77      ARC_TUNE_CORE_3,
      78      ARC_TUNE_ARCHS4X,
      79      ARC_TUNE_ARCHS4XD,
      80      ARC_TUNE_ARCHS4XD_SLOW,
      81      ARC_TUNE_ARCHS4X_REL31A
      82    };
      83  
      84  /* Extra options for a processor template to hold any CPU specific
      85     information which is not cover in arc-arches.def.  Such example is
      86     the width of LP_COUNT register, or the number of register
      87     banks.  */
      88  
      89  enum arc_extras
      90  {
      91    HAS_NONE,
      92    HAS_LPCOUNT_16
      93  };
      94  
      95  /* CPU specific properties.  */
      96  
      97  typedef struct
      98  {
      99    /* CPU name.  */
     100    const char *const name;
     101  
     102    /* Architecture class.  */
     103    const arc_arch_t *arch_info;
     104  
     105    /* Specific processor type.  */
     106    enum processor_type processor;
     107  
     108    /* Specific flags.  */
     109    const unsigned long long flags;
     110  
     111    /* Extra value.  */
     112    enum arc_extras extra;
     113  
     114    /* Tune value.  */
     115    enum arc_tune_attr tune;
     116  
     117  } arc_cpu_t;
     118  
     119  const arc_arch_t arc_arch_types[] =
     120    {
     121      {"none", BASE_ARCH_NONE, 0, 0},
     122  #define ARC_ARCH(NAME, ARCH, FLAGS, DFLAGS)	\
     123      {NAME, BASE_ARCH_##ARCH, FLAGS, DFLAGS},
     124  #include "arc-arches.def"
     125  #undef ARC_ARCH
     126      {NULL, BASE_ARCH_END, 0, 0}
     127    };
     128  
     129  const arc_cpu_t arc_cpu_types[] =
     130    {
     131      {"none", NULL, PROCESSOR_NONE, 0, HAS_NONE, ARC_TUNE_NONE},
     132  #define ARC_CPU(NAME, ARCH, FLAGS, EXTRA, TUNE)				\
     133      {#NAME, &arc_arch_types [BASE_ARCH_##ARCH], PROCESSOR_##NAME, FLAGS, HAS_##EXTRA, ARC_TUNE_##TUNE },
     134  #include "arc-cpus.def"
     135  #undef ARC_CPU
     136      {NULL, NULL, PROCESSOR_NONE, 0, HAS_NONE, ARC_TUNE_NONE}
     137    };
     138  
     139  /* Currently selected cpu type.  */
     140  extern const arc_cpu_t *arc_selected_cpu;
     141  
     142  #endif
     143  #endif /* GCC_ARC_ARCH_H */