]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/cris/cris.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / cris / cris.h
index 4aa12b8c2764f9f910abee07a0c7f79ad64b3767..028da93a216088b89ca8cb64eecbb390008a62a7 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for GCC.  Part of the machine description for CRIS.
-   Copyright (C) 1998-2020 Free Software Foundation, Inc.
+   Copyright (C) 1998-2024 Free Software Foundation, Inc.
    Contributed by Axis Communications.  Written by Hans-Peter Nilsson.
 
 This file is part of GCC.
@@ -39,7 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 /* We don't want to use gcc_assert for everything, as that can be
    compiled out.  */
 #define CRIS_ASSERT(x) \
- do { if (!(x)) internal_error ("CRIS-port assertion failed: " #x); } while (0)
+ do { if (!(x)) internal_error ("CRIS-port assertion failed: %s", #x); } while (0)
 
 /* Replacement for REG_P since it does not match SUBREGs.  Happens for
    testcase Axis-20000320 with gcc-2.9x.  */
@@ -153,7 +153,9 @@ extern int cris_cpu_version;
 
 #ifdef HAVE_AS_NO_MUL_BUG_ABORT_OPTION
 #define MAYBE_AS_NO_MUL_BUG_ABORT \
- "%{mno-mul-bug-workaround:-no-mul-bug-abort} "
+ "%{mno-mul-bug-workaround:-no-mul-bug-abort} " \
+ "%{mmul-bug-workaround:-mul-bug-abort} " \
+ "%{!mmul-bug-workaround:%{!mno-mul-bug-workaround:" MUL_BUG_ASM_DEFAULT "}} "
 #else
 #define MAYBE_AS_NO_MUL_BUG_ABORT
 #endif
@@ -255,15 +257,26 @@ extern int cris_cpu_version;
  (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \
   + MASK_CONST_ALIGN + MASK_DATA_ALIGN \
   + MASK_ALIGN_BY_32 \
-  + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG)
+  + MASK_PROLOGUE_EPILOGUE)
 # else  /* 0 */
 #  define TARGET_DEFAULT \
  (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \
   + MASK_CONST_ALIGN + MASK_DATA_ALIGN \
-  + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG)
+  + MASK_PROLOGUE_EPILOGUE)
 # endif
 #endif
 
+/* Don't depend on the assembler default setting for the errata machinery;
+   always pass the option to turn it on or off explicitly.  But, we have to
+   decide on which is the *GCC* default, and for that we should only need to
+   consider what's in TARGET_DEFAULT; no other changes should be necessary.  */
+
+#if (TARGET_DEFAULT & MASK_MUL_BUG)
+#define MUL_BUG_ASM_DEFAULT "-mul-bug-abort"
+#else
+#define MUL_BUG_ASM_DEFAULT "-no-mul-bug-abort"
+#endif
+
 /* Local, providing a default for cris_cpu_version.  */
 #define CRIS_DEFAULT_CPU_VERSION TARGET_CPU_DEFAULT
 
@@ -317,7 +330,7 @@ extern int cris_cpu_version;
     Note that to make this macro affect the alignment of stack
    locals, a fix was required, and special precautions when handling
    the stack pointer in various other macros (TARGET_ASM_FUNCTION_PROLOGUE
-   et al) were required.  See file "function.c".  If you would just define
+   et al) were required.  See file "function.cc".  If you would just define
    this macro, it would only affect the builtin alloca and variable
    local data (non-ANSI, non-K&R, Gnu C extension).  */
 #define STACK_BOUNDARY \
@@ -352,13 +365,6 @@ extern int cris_cpu_version;
    with other GNU/Linux ports (i.e. elfos.h users).  */
 #undef PCC_BITFIELD_TYPE_MATTERS
 
-/* This is only used for non-scalars.  Strange stuff happens to structs
-   (FIXME: What?) if we use anything larger than largest actually used
-   datum size, so lets make it 32.  The type "long long" will still work
-   as usual.  We can still have DImode insns, but they will only be used
-   for scalar data (i.e. long long).  */
-#define MAX_FIXED_MODE_SIZE 32
-
 
 /* Node: Type Layout */
 
@@ -380,8 +386,8 @@ extern int cris_cpu_version;
 /* Node: Register Basics */
 
 /*  We count all 16 non-special registers, SRP, a faked argument
-    pointer register, MOF and CCR/DCCR.  */
-#define FIRST_PSEUDO_REGISTER (16 + 1 + 1 + 1 + 1)
+    pointer register, MOF, CCR/DCCR, and the faked frame-pointer.  */
+#define FIRST_PSEUDO_REGISTER (16 + 1 + 1 + 1 + 1 + 1)
 
 /* For CRIS, these are r15 (pc) and r14 (sp). Register r8 is used as a
    frame-pointer, but is not fixed.  SRP is not included in general
@@ -389,12 +395,12 @@ extern int cris_cpu_version;
    registers are fixed at the moment.  The faked argument pointer register
    is fixed too.  */
 #define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1}
 
 /* Register r9 is used for structure-address, r10-r13 for parameters,
    r10- for return values.  */
 #define CALL_USED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}
 
 /* Node: Allocation Order */
 
@@ -417,7 +423,8 @@ extern int cris_cpu_version;
     Use struct-return address first, since very few functions use
    structure return values so it is likely to be available.  */
 #define REG_ALLOC_ORDER \
- {9, 13, 12, 11, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 17, 16, 18, 19}
+ {9, 13, 12, 11, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 17, 16, 18, 19,        \
+  20}
 
 
 /* Node: Leaf Functions */
@@ -429,19 +436,15 @@ extern int cris_cpu_version;
 
 /* Node: Register Classes */
 
-/* We need a separate register class to handle register allocation for
-   ACR, since it can't be used for post-increment.
-
-   It's not obvious, but having subunions of all movable-between
+/* It's not obvious, but having subunions of all movable-between
    register classes does really help register allocation (pre-IRA
    comment).  */
 enum reg_class
   {
     NO_REGS,
-    ACR_REGS, MOF_REGS, SRP_REGS, CC0_REGS,
+    MOF_REGS, SRP_REGS, CC0_REGS,
     MOF_SRP_REGS, SPECIAL_REGS,
-    SPEC_ACR_REGS, GENNONACR_REGS,
-    SPEC_GENNONACR_REGS, GENERAL_REGS,
+    GENERAL_REGS,
     ALL_REGS,
     LIM_REG_CLASSES
   };
@@ -450,58 +453,50 @@ enum reg_class
 
 #define REG_CLASS_NAMES                                                \
   {"NO_REGS",                                                  \
-   "ACR_REGS", "MOF_REGS", "SRP_REGS", "CC0_REGS",             \
+   "MOF_REGS", "SRP_REGS", "CC0_REGS",                         \
    "MOF_SRP_REGS", "SPECIAL_REGS",                             \
-   "SPEC_ACR_REGS", "GENNONACR_REGS", "SPEC_GENNONACR_REGS",   \
    "GENERAL_REGS", "ALL_REGS"}
 
 #define CRIS_SPECIAL_REGS_CONTENTS                                     \
  ((1 << CRIS_SRP_REGNUM) | (1 << CRIS_MOF_REGNUM) | (1 << CRIS_CC0_REGNUM))
 
+#define CRIS_FAKED_REGS_CONTENTS \
+ ((1 << CRIS_AP_REGNUM) | (1 << CRIS_FP_REGNUM))
+
 /* Count in the faked argument register in GENERAL_REGS.  Keep out SRP.  */
 #define REG_CLASS_CONTENTS                     \
   {                                            \
    {0},                                                \
-   {1 << CRIS_ACR_REGNUM},                     \
    {1 << CRIS_MOF_REGNUM},                     \
    {1 << CRIS_SRP_REGNUM},                     \
    {1 << CRIS_CC0_REGNUM},                     \
    {(1 << CRIS_MOF_REGNUM)                     \
     | (1 << CRIS_SRP_REGNUM)},                 \
    {CRIS_SPECIAL_REGS_CONTENTS},               \
-   {CRIS_SPECIAL_REGS_CONTENTS                 \
-    | (1 << CRIS_ACR_REGNUM)},                 \
-   {(0xffff | (1 << CRIS_AP_REGNUM))           \
-    & ~(1 << CRIS_ACR_REGNUM)},                        \
-   {(0xffff | (1 << CRIS_AP_REGNUM)            \
-    | CRIS_SPECIAL_REGS_CONTENTS)              \
-    & ~(1 << CRIS_ACR_REGNUM)},                        \
-   {0xffff | (1 << CRIS_AP_REGNUM)},           \
-   {0xffff | (1 << CRIS_AP_REGNUM)             \
+   {0xffff | CRIS_FAKED_REGS_CONTENTS},                \
+   {0xffff | CRIS_FAKED_REGS_CONTENTS          \
     | CRIS_SPECIAL_REGS_CONTENTS}              \
   }
 
 #define REGNO_REG_CLASS(REGNO)                 \
-  ((REGNO) == CRIS_ACR_REGNUM ? ACR_REGS :     \
-   (REGNO) == CRIS_MOF_REGNUM ? MOF_REGS :     \
+  ((REGNO) == CRIS_MOF_REGNUM ? MOF_REGS :     \
    (REGNO) == CRIS_SRP_REGNUM ? SRP_REGS :     \
    (REGNO) == CRIS_CC0_REGNUM ? CC0_REGS :     \
    GENERAL_REGS)
 
 #define BASE_REG_CLASS GENERAL_REGS
 
-#define MODE_CODE_BASE_REG_CLASS(MODE, AS, OCODE, ICODE)       \
-  ((OCODE) != POST_INC ? BASE_REG_CLASS : GENNONACR_REGS)
-
 #define INDEX_REG_CLASS GENERAL_REGS
 
 /* Since it uses reg_renumber, it is safe only once reg_renumber
-   has been allocated, which happens in reginfo.c during register
+   has been allocated, which happens in reginfo.cc during register
    allocation.  */
 #define REGNO_OK_FOR_BASE_P(REGNO)                                     \
  ((REGNO) <= CRIS_LAST_GENERAL_REGISTER                                        \
+  || (REGNO) == FRAME_POINTER_REGNUM                                   \
   || (REGNO) == ARG_POINTER_REGNUM                                     \
   || (unsigned) reg_renumber[REGNO] <= CRIS_LAST_GENERAL_REGISTER      \
+  || (unsigned) reg_renumber[REGNO] == FRAME_POINTER_REGNUM            \
   || (unsigned) reg_renumber[REGNO] == ARG_POINTER_REGNUM)
 
 /* See REGNO_OK_FOR_BASE_P.  */
@@ -556,8 +551,7 @@ enum reg_class
 #define CRIS_STACKADJ_REG CRIS_STRUCT_VALUE_REGNUM
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CRIS_STACKADJ_REG)
 
-#define EH_RETURN_HANDLER_RTX \
-  cris_return_addr_rtx (0, NULL)
+#define EH_RETURN_HANDLER_RTX cris_eh_return_handler_rtx ()
 
 #define INIT_EXPANDERS cris_init_expanders ()
 
@@ -573,9 +567,9 @@ enum reg_class
    number and dwarf frame register, we would either need to include all
    registers in the gcc description (with some marked fixed of course), or
    an inverse mapping from dwarf register to gcc register.  There is one
-   need in dwarf2out.c:expand_builtin_init_dwarf_reg_sizes.  Right now, I
+   need in dwarf2out.cc:expand_builtin_init_dwarf_reg_sizes.  Right now, I
    don't see that we need exact correspondence between DWARF *frame*
-   registers and DBX_REGISTER_NUMBER, so map them onto GCC registers.  */
+   registers and DEBUGGER_REGNO, so map them onto GCC registers.  */
 #define DWARF_FRAME_REGNUM(REG) (REG)
 
 /* Node: Stack Checking */
@@ -587,6 +581,9 @@ enum reg_class
 
 /* Register used for frame pointer.  This is also the last of the saved
    registers, when a frame pointer is not used.  */
+#define HARD_FRAME_POINTER_REGNUM CRIS_REAL_FP_REGNUM
+
+/* Faked register, is always eliminated to at least CRIS_REAL_FP_REGNUM.  */
 #define FRAME_POINTER_REGNUM CRIS_FP_REGNUM
 
 /* Faked register, is always eliminated.  We need it to eliminate
@@ -595,13 +592,17 @@ enum reg_class
 
 #define STATIC_CHAIN_REGNUM CRIS_STATIC_CHAIN_REGNUM
 
+/* No unwind context is needed for faked registers nor DCCR.  Currently not MOF
+   too, but let's keep that open.  */
+#define DWARF_FRAME_REGISTERS (CRIS_MOF_REGNUM + 1)
 
 /* Node: Elimination */
 
 #define ELIMINABLE_REGS                                \
  {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},  \
-  {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},  \
-  {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
+  {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
+  {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
+  {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
 
 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
  (OFFSET) = cris_initial_elimination_offset (FROM, TO)
@@ -651,13 +652,13 @@ struct cum_args {int regs;};
 
 /* Node: Function entry */
 
-/* See cris.c for TARGET_ASM_FUNCTION_PROLOGUE and
+/* See cris.cc for TARGET_ASM_FUNCTION_PROLOGUE and
    TARGET_ASM_FUNCTION_EPILOGUE.  */
 
 /* Node: Profiling */
 
 #define FUNCTION_PROFILER(FILE, LABELNO)  \
- error ("no FUNCTION_PROFILER for CRIS")
+ error ("no %<FUNCTION_PROFILER%> for CRIS")
 
 /* FIXME: Some of the undefined macros might be mandatory.  If so, fix
    documentation.  */
@@ -698,12 +699,14 @@ struct cum_args {int regs;};
 
 /* Node: Condition Code */
 
-#define NOTICE_UPDATE_CC(EXP, INSN) cris_notice_update_cc (EXP, INSN)
+/* FIXME: Maybe define TARGET_CANONICALIZE_COMPARISON later, when
+   playing with optimizations.  */
+
+#define SELECT_CC_MODE(op, x, y) cris_select_cc_mode(op, x, y)
 
-/* FIXME: Maybe define CANONICALIZE_COMPARISON later, when playing with
-   optimizations.  It is needed; currently we do this with instruction
-   patterns and NOTICE_UPDATE_CC.  */
+#define REVERSIBLE_CC_MODE(MODE) true
 
+/* No known need to define REVERSE_CONDITION, the default is good.  */
 
 /* Node: Costs */
 
@@ -820,7 +823,8 @@ struct cum_args {int regs;};
 
 #define REGISTER_NAMES                                 \
  {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",        \
-  "r9", "r10", "r11", "r12", "r13", "sp", "pc", "srp", "mof", "faked_ap", "dccr"}
+  "r9", "r10", "r11", "r12", "r13", "sp", "pc", "srp", \
+  "mof", "faked_ap", "dccr", "faked_fp"}
 
 #define ADDITIONAL_REGISTER_NAMES \
  {{"r14", 14}, {"r15", 15}}
@@ -883,7 +887,7 @@ struct cum_args {int regs;};
 
 /* Node: All Debuggers */
 
-#define DBX_REGISTER_NUMBER(REGNO)                             \
+#define DEBUGGER_REGNO(REGNO)                          \
  ((REGNO) == CRIS_SRP_REGNUM ? CRIS_CANONICAL_SRP_REGNUM :     \
   (REGNO) == CRIS_MOF_REGNUM ? CRIS_CANONICAL_MOF_REGNUM :     \
   (REGNO) == CRIS_CC0_REGNUM ? CRIS_CANONICAL_CC0_REGNUM :     \
@@ -892,24 +896,6 @@ struct cum_args {int regs;};
 /* FIXME: Investigate DEBUGGER_AUTO_OFFSET, DEBUGGER_ARG_OFFSET.  */
 
 
-/* Node: DBX Options */
-
-/* Is this correct? Check later.  */
-#define DBX_NO_XREFS
-
-#define DBX_CONTIN_LENGTH 0
-
-/* FIXME: Is this needed when we have 0 DBX_CONTIN_LENGTH?  */
-#define DBX_CONTIN_CHAR '?'
-
-
-/* Node: DBX Hooks */
-/* (no definitions) */
-
-/* Node: File names and DBX */
-/* (no definitions) */
-
-
 /* Node: DWARF */
 /* (no definitions) */