MIPS/GAS: Don't convert RELA JALR relocations on R6
[deliverable/binutils-gdb.git] / sim / common / cgen-engine.h
index fbcf3e5fc1ae9924fc60bfe0fb071b246f7dfc09..d57769e42f785472fd75d00e5bebd57d70df22b6 100644 (file)
@@ -1,24 +1,27 @@
 /* Engine header for Cpu tools GENerated simulators.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998-2016 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* This file must be included after eng.h and before ${cpu}.h.  */
+/* This file is included by ${cpu}.h.
+   It needs CGEN_INSN_WORD which is defined by ${cpu}.h.
+   ??? A lot of this could be moved to genmloop.sh to be put in eng.h
+   and thus remove some conditional compilation.  We'd still need
+   CGEN_INSN_WORD though.  */
 
 /* Semantic functions come in six versions on two axes:
    fast/full-featured, and using one of the simple/scache/compilation engines.
@@ -48,41 +51,39 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 /* Instruction field support macros.  */
 
-#define EXTRACT_MSB0_INT(val, total, start, length) \
+#define EXTRACT_MSB0_SINT(val, total, start, length) \
 (((INT) (val) << ((sizeof (INT) * 8) - (total) + (start))) \
  >> ((sizeof (INT) * 8) - (length)))
 #define EXTRACT_MSB0_UINT(val, total, start, length) \
 (((UINT) (val) << ((sizeof (UINT) * 8) - (total) + (start))) \
  >> ((sizeof (UINT) * 8) - (length)))
 
-#define EXTRACT_LSB0_INT(val, total, start, length) \
+#define EXTRACT_LSB0_SINT(val, total, start, length) \
 (((INT) (val) << ((sizeof (INT) * 8) - (start) - 1)) \
  >> ((sizeof (INT) * 8) - (length)))
 #define EXTRACT_LSB0_UINT(val, total, start, length) \
 (((UINT) (val) << ((sizeof (UINT) * 8) - (start) - 1)) \
  >> ((sizeof (UINT) * 8) - (length)))
 
-#if CGEN_INSN_LSB0_P
-
-#define EXTRACT_INT(val, total, start, length) \
-  EXTRACT_LSB0_INT ((val), (total), (start), (length))
-#define EXTRACT_UINT(val, total, start, length) \
-  EXTRACT_LSB0_UINT ((val), (total), (start), (length))
-
-#else
-
-#define EXTRACT_INT(val, total, start, length) \
-  EXTRACT_MSB0_INT ((val), (total), (start), (length))
-#define EXTRACT_UINT(val, total, start, length) \
-  EXTRACT_MSB0_UINT ((val), (total), (start), (length))
-
-#endif
+#define EXTRACT_MSB0_LGSINT(val, total, start, length) \
+(((CGEN_INSN_LGSINT) (val) << ((sizeof (CGEN_INSN_LGSINT) * 8) - (total) + (start))) \
+ >> ((sizeof (CGEN_INSN_LGSINT) * 8) - (length)))
+#define EXTRACT_MSB0_LGUINT(val, total, start, length) \
+(((CGEN_INSN_UINT) (val) << ((sizeof (CGEN_INSN_LGUINT) * 8) - (total) + (start))) \
+ >> ((sizeof (CGEN_INSN_LGUINT) * 8) - (length)))
+
+#define EXTRACT_LSB0_LGSINT(val, total, start, length) \
+(((CGEN_INSN_LGSINT) (val) << ((sizeof (CGEN_INSN_LGSINT) * 8) - (start) - 1)) \
+ >> ((sizeof (CGEN_INSN_LGSINT) * 8) - (length)))
+#define EXTRACT_LSB0_LGUINT(val, total, start, length) \
+(((CGEN_INSN_LGUINT) (val) << ((sizeof (CGEN_INSN_LGUINT) * 8) - (start) - 1)) \
+ >> ((sizeof (CGEN_INSN_LGUINT) * 8) - (length)))
 \f
 /* Semantic routines.  */
 
 /* Type of the machine generated extraction fns.  */
 /* ??? No longer used.  */
-typedef void (EXTRACT_FN) (SIM_CPU *, IADDR, CGEN_INSN_INT, ARGBUF *);
+typedef void (EXTRACT_FN) (SIM_CPU *, IADDR, CGEN_INSN_WORD, ARGBUF *);
 
 /* Type of the machine generated semantic fns.  */
 
@@ -90,7 +91,7 @@ typedef void (EXTRACT_FN) (SIM_CPU *, IADDR, CGEN_INSN_INT, ARGBUF *);
 
 /* Instruction fields are extracted into ARGBUF before calling the
    semantic routine.  */
-#if HAVE_PARALLEL_INSNS
+#if HAVE_PARALLEL_INSNS && ! WITH_PARALLEL_GENWRITE
 typedef SEM_PC (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, PAREXEC *);
 #else
 typedef SEM_PC (SEMANTIC_FN) (SIM_CPU *, SEM_ARG);
@@ -103,10 +104,10 @@ typedef unsigned int SEM_STATUS;
 
 /* Instruction fields are extracted by the semantic routine.
    ??? TODO: multi word insns.  */
-#if HAVE_PARALLEL_INSNS
-typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, PAREXEC *, CGEN_INSN_INT);
+#if HAVE_PARALLEL_INSNS && ! WITH_PARALLEL_GENWRITE
+typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, PAREXEC *, CGEN_INSN_WORD);
 #else
-typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, CGEN_INSN_INT);
+typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, CGEN_INSN_WORD);
 #endif
 
 #endif
@@ -135,7 +136,7 @@ union sem {
 #ifdef __GNUC__
 #define SEM_SET_FULL_CODE(abuf, idesc) \
   do { (abuf)->semantic.sem_case = (idesc)->sem_full_lab; } while (0)
-#else 
+#else
 #define SEM_SET_FULL_CODE(abuf, idesc) \
   do { (abuf)->semantic.sem_case = (idesc)->num; } while (0)
 #endif
@@ -148,7 +149,7 @@ union sem {
 #ifdef __GNUC__
 #define SEM_SET_FAST_CODE(abuf, idesc) \
   do { (abuf)->semantic.sem_case = (idesc)->sem_fast_lab; } while (0)
-#else 
+#else
 #define SEM_SET_FAST_CODE(abuf, idesc) \
   do { (abuf)->semantic.sem_case = (idesc)->num; } while (0)
 #endif
@@ -183,22 +184,8 @@ do { \
 /* Return pointer to ARGBUF given ptr to SCACHE.  */
 #define SEM_ARGBUF(sem_arg) (& (sem_arg) -> argbuf)
 
-/* There are several styles of engines, all generally supported by the
-   same code:
-
-   WITH_SCACHE && WITH_SCACHE_PBB - pseudo-basic-block scaching
-   WITH_SCACHE && !WITH_SCACHE_PBB - scaching on an insn by insn basis
-   !WITH_SCACHE - simple engine: fetch an insn, execute an insn
-
-   ??? The !WITH_SCACHE case can also be broken up into two flavours:
-   extract the fields of the insn into an ARGBUF struct, or defer the
-   extraction to the semantic handler.  The WITH_SCACHE case always
-   extracts the fields into an ARGBUF struct.  */
-
 #if WITH_SCACHE
 
-#define CIA_ADDR(cia) (cia)
-
 #if WITH_SCACHE_PBB
 
 /* Return the scache pointer of the current insn.  */
@@ -291,8 +278,6 @@ do { \
 
 /* This is the "simple" engine case.  */
 
-#define CIA_ADDR(cia) (cia)
-
 #define SEM_SEM_ARG(vpc, sc) (sc)
 
 #define SEM_NEXT_VPC(sem_arg, pc, len) ((pc) + (len))
@@ -329,8 +314,8 @@ do { \
 /* Instruction information.  */
 
 /* Sanity check, at most one of these may be true.  */
-#if WITH_PARALLEL_READ && WITH_PARALLEL_WRITE
-#error "Both WITH_PARALLEL_READ && WITH_PARALLEL_WRITE can't be true."
+#if WITH_PARALLEL_READ + WITH_PARALLEL_WRITE + WITH_PARALLEL_GENWRITE > 1
+#error "At most one of WITH_PARALLEL_{READ,WRITE,GENWRITE} can be true."
 #endif
 
 /* Compile time computable instruction data.  */
@@ -346,7 +331,7 @@ struct insn_sem {
   /* Semantic format number.  */
   int sfmt;
 
-#if WITH_PARALLEL_READ || WITH_PARALLEL_WRITE
+#if HAVE_PARALLEL_INSNS && ! WITH_PARALLEL_ONLY
   /* Index in IDESC table of parallel handler.  */
   int par_index;
 #endif
@@ -397,7 +382,7 @@ struct idesc {
 #endif
 
   /* Parallel support.  */
-#if WITH_PARALLEL_READ || WITH_PARALLEL_WRITE
+#if HAVE_PARALLEL_INSNS && (! WITH_PARALLEL_ONLY || (WITH_PARALLEL_ONLY && ! WITH_PARALLEL_GENWRITE))
   /* Pointer to parallel handler if serial insn.
      Pointer to readahead/writeback handler if parallel insn.  */
   struct idesc *par_idesc;
This page took 0.026722 seconds and 4 git commands to generate.