]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: sim-model: build for everyone
authorMike Frysinger <vapier@gentoo.org>
Fri, 25 Dec 2015 09:27:27 +0000 (04:27 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 25 Dec 2015 09:40:31 +0000 (04:40 -0500)
Rather than include this for some targets, set it up so we can build it
all the time via the common code.  This makes it easier for targets to
opt into it when they're ready, increases build coverage, and allows us
to centralize much of the logic.

We also get to delete tconfig.h from two more targets -- they were
setting WITH_DEVICES to 0 which has the same behavior as not defining
it at all.

While the SIM_HAVE_MODEL knob is gone, we now have WITH_MODEL_P, but it
is only used by the common sim-model code.  We use it to declare dummy
model lists when the arch hasn't created its own.

29 files changed:
sim/bfin/ChangeLog
sim/bfin/Makefile.in
sim/bfin/tconfig.h
sim/common/ChangeLog
sim/common/Make-common.in
sim/common/cgen-types.h
sim/common/sim-base.h
sim/common/sim-config.h
sim/common/sim-cpu.h
sim/common/sim-model.c
sim/common/sim-model.h
sim/common/sim-module.c
sim/common/sim-profile.h
sim/cris/ChangeLog
sim/cris/Makefile.in
sim/cris/tconfig.h
sim/frv/ChangeLog
sim/frv/Makefile.in
sim/frv/tconfig.h
sim/iq2000/ChangeLog
sim/iq2000/Makefile.in
sim/iq2000/tconfig.h [deleted file]
sim/lm32/ChangeLog
sim/lm32/Makefile.in
sim/m32r/ChangeLog
sim/m32r/Makefile.in
sim/sh64/ChangeLog
sim/sh64/Makefile.in
sim/sh64/tconfig.h [deleted file]

index 5599af66b1966d786a3a7ac12c2ef9276f60e6e8..744f5eb20003d8c87244e7a02b3184e4cab06d83 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+       * tconfig.h (SIM_HAVE_MODEL): Delete.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * machs.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
index 817fecbb6306b55b8f0c7b78b56038e12442a4ad..a2b6b0b94e26de0ae3344a32cd1bed93fe3c0160 100644 (file)
@@ -28,7 +28,6 @@ SIM_OBJS = \
        interp.o \
        machs.o \
        sim-hload.o \
-       sim-model.o \
        sim-resume.o
 
 INCLUDE = bfin-sim.h
index 254aba9b984ffa7763443e7b0c63ed5eb45fc061..3ecd1743fea706ea5c2920c194053a60334f0f90 100644 (file)
@@ -3,6 +3,3 @@
 /* We use this so that we are passed the requesting CPU for HW acesses.
    Common sim core by default sets hw_system_cpu to NULL for WITH_HW.  */
 #define WITH_DEVICES 1
-
-/* ??? Temporary hack until model support unified.  */
-#define SIM_HAVE_MODEL
index e36895a15539e3e6c2126f26c1179a2399a8c0e6..09f29bb9e28efd79bcce94cec20c208e22cf722b 100644 (file)
@@ -1,3 +1,18 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-model.o.
+       * cgen-types.h (SIM_HAVE_MODEL): Delete.
+       * sim-base.h: Always include sim-model.h.
+       * sim-config.h (WITH_DEFAULT_MODEL): Delete.
+       * sim-cpu.h (sim_cpu_base): Always declare mach/model members.
+       * sim-model.c (sim_model_init): Return when !WITH_MODEL_P.
+       [!WITH_MODEL_P] (sim_machs): Define.
+       * sim-model.h: Add some developer docs.
+       [!WITH_DEFAULT_MODEL] (mach_attr, WITH_DEFAULT_MODEL): Define.
+       (WITH_MODEL_P): Define.
+       * sim-module.c (modules): Always include sim_model_install.
+       * sim-profile.h (WITH_PROFILE_MODEL_P): Delete.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-cpu.h: Rename MACH to SIM_MACH and MODEL to SIM_MODEL.
index 647ec80eb795521ab47d707592625813a8a52508..2566bf4bf5b08576bb55ef440a011468f87b8dd8 100644 (file)
@@ -190,6 +190,7 @@ SIM_NEW_COMMON_OBJS = \
        sim-info.o \
        sim-load.o \
        sim-memopt.o \
+       sim-model.o \
        sim-module.o \
        sim-options.o \
        sim-profile.o \
index 74dc6402af9a5f1571adac65a5cfe6508a9b6349..77793936f9d5fb953bc483af0ab980a1fd01bafa 100644 (file)
@@ -26,10 +26,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Miscellaneous cgen configury defined here as this file gets
    included soon enough.  */
 
-/* Indicate we support --profile-model.  */
-#undef SIM_HAVE_MODEL
-#define SIM_HAVE_MODEL
-
 /* Indicate we support --{profile,trace}-{range,function}.  */
 #undef SIM_HAVE_ADDR_RANGE
 #define SIM_HAVE_ADDR_RANGE
index cfef6ecddc08ce0420f0525a34e02ec3d87d6f22..3e15a8505e42f3ff64f53bb681851422f0b3b7d2 100644 (file)
@@ -82,9 +82,7 @@ typedef struct _sim_cpu sim_cpu;
 #include "sim-core.h"
 #include "sim-events.h"
 #include "sim-profile.h"
-#ifdef SIM_HAVE_MODEL
 #include "sim-model.h"
-#endif
 #include "sim-io.h"
 #include "sim-engine.h"
 #include "sim-watch.h"
index 599b84c09c80d47274de55336e9b04e8052b9205..064d9368947cf61ecea5dc2e22e1fc3bd9030ff4 100644 (file)
@@ -524,10 +524,6 @@ extern int current_floating_point;
                       ? WITH_MODEL     \
                       : current_model)
 
-#ifndef WITH_DEFAULT_MODEL
-#define WITH_DEFAULT_MODEL             DEFAULT_MODEL
-#endif
-
 #define MODEL_ISSUE_IGNORE             (-1)
 #define MODEL_ISSUE_PROCESS            1
 
index 20838e876e54591f28ee03b2b80a2a7f89f2cc24..f998befa08c6466d8a2d54bda6c95d1134576262 100644 (file)
@@ -100,7 +100,6 @@ typedef struct {
   PROFILE_DATA profile_data;
 #define CPU_PROFILE_DATA(cpu) (& (cpu)->base.profile_data)
 
-#ifdef SIM_HAVE_MODEL
   /* Machine tables for this cpu.  See sim-model.h.  */
   const SIM_MACH *mach;
 #define CPU_MACH(cpu) ((cpu)->base.mach)
@@ -110,7 +109,6 @@ typedef struct {
   /* Model data (profiling state, etc.).  */
   void *model_data;
 #define CPU_MODEL_DATA(cpu) ((cpu)->base.model_data)
-#endif
 
   /* Routines to fetch/store registers.  */
   CPUREG_FETCH_FN *reg_fetch;
index 0d0c28d33543aacffce419df0a0270b79c05cd1f..054f0bcf7f0cf3b7fa2be00630ab9c98351c81b7 100644 (file)
@@ -190,6 +190,9 @@ sim_model_init (SIM_DESC sd)
 {
   SIM_CPU *cpu;
 
+  if (!WITH_MODEL_P)
+    return SIM_RC_OK;
+
   /* If both cpu model and state architecture are set, ensure they're
      compatible.  If only one is set, set the other.  If neither are set,
      use the default model.  STATE_ARCHITECTURE is the bfd_arch_info data
@@ -241,3 +244,12 @@ sim_model_init (SIM_DESC sd)
 
   return SIM_RC_OK;
 }
+\f
+#if !WITH_MODEL_P
+/* Set up basic model support.  This is a stub for ports that do not define
+   models.  See sim-model.h for more details.  */
+const SIM_MACH *sim_machs[] =
+{
+  NULL
+};
+#endif
index 5baa5ce1d9459caeddf6d5b8967fb9ee6da8b801..a206626b1d2096212c14a1ba4d9da5b3cf12b3d1 100644 (file)
@@ -21,6 +21,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    architecture = one of sparc, mips, sh, etc.
    in the sparc architecture, mach = one of v6, v7, v8, sparclite, etc.
    in the v8 mach, model = one of supersparc, etc.
+
+   To use the model framework, your arch needs to do a few things:
+   (1) Call SIM_AC_OPTION_DEFAULT_MODEL() in configure.ac.
+   (2) Define enum mach_attr in sim-main.h.
+   (3) Define sim_machs array (and all the callbacks it uses).
 */
 
 /* This file is intended to be included by sim-basics.h.  */
@@ -42,6 +47,15 @@ typedef struct {
 #define MAX_UNITS 1
 #endif
 
+#ifndef WITH_DEFAULT_MODEL
+/* Just a stub for ports that do not define models.  */
+enum mach_attr { _MACH_NONE };
+# define WITH_DEFAULT_MODEL NULL
+# define WITH_MODEL_P 0
+#else
+# define WITH_MODEL_P 1
+#endif
+
 typedef int (MODEL_FN) (sim_cpu *, void *);
 
 typedef struct {
index 4f23882acd39bfc83a997eb4f40f21e61e22a3e1..670225bd7731d07ce9d4ffe0d60e021e8b0d195f 100644 (file)
@@ -40,9 +40,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 static MODULE_INSTALL_FN * const modules[] = {
   standard_install,
   sim_events_install,
-#ifdef SIM_HAVE_MODEL
   sim_model_install,
-#endif
 #if WITH_ENGINE
   sim_engine_install,
 #endif
index 3370f0cbdb899bdded5a0ed8de77c21f3fe94df4..b756af59db77a757d2e27b7be3c266d987a88c22 100644 (file)
@@ -102,12 +102,6 @@ SIM_RC sim_profile_set_option (SIM_DESC sd_, const char *name_, int idx_,
 #define WITH_PROFILE_MEMORY_P 0
 #endif
 
-/* Only build MODEL code when the target simulator has support for it */
-#ifndef SIM_HAVE_MODEL
-#undef WITH_PROFILE_MODEL_P
-#define WITH_PROFILE_MODEL_P 0
-#endif
-
 /* Profiling install handler.  */
 MODULE_INSTALL_FN profile_install;
 
index ff73db19a342ffd246dcd43592469deb4a477138..66ef461120f149ea2ae2dbe693036ae218230739 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+       * tconfig.h (SIM_HAVE_MODEL): Delete.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index f7762dd79700af6053f6147c6976dfcd5258a84d..384922f746ff0f0f18e34307956701fa29ee2ba2 100644 (file)
@@ -24,7 +24,6 @@ CRISV32F_OBJS = crisv32f.o cpuv32.o decodev32.o modelv32.o mloopv32f.o
 
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
-       sim-model.o \
        cgen-utils.o cgen-trace.o cgen-scache.o \
        cgen-run.o \
        sim-if.o arch.o \
index 05d86233ea016318273de5cc1a55c41051c9e310..2ac6c5bd803711a57c062e4f6ca695f2ed285831 100644 (file)
@@ -27,6 +27,4 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 1
 
-#define SIM_HAVE_MODEL
-
 #endif /* CRIS_TCONFIG_H */
index 6fca1e1cd5cdd54a0688108800df84916370884a..26caec46bf40a49664ad889802b85fb801141e02 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+       * tconfig.h (SIM_HAVE_MODEL): Delete.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index 62e480abb2a18ff3fa08ba2cc6b4bbe1412d5345..86095fff0dfe0447c2404a042c22d5c36674b082 100644 (file)
@@ -22,7 +22,6 @@ FRV_OBJS = frv.o cpu.o decode.o sem.o model.o mloop.o cgen-par.o
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
-       sim-model.o \
        cgen-utils.o cgen-trace.o cgen-scache.o cgen-fpu.o cgen-accfp.o \
        cgen-run.o \
        sim-if.o arch.o \
index 1abdc6115771a65bc5ae8ba181de5d13dc8ab7e8..e5db154719e3034f1994b429956377cc57d7fd8b 100644 (file)
@@ -2,6 +2,3 @@
 
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 1
-
-/* ??? Temporary hack until model support unified.  */
-#define SIM_HAVE_MODEL
index 03cc0237ef30f4043b275829efb412b21c480af1..4ee58391d676325e0e45630f454cf98c197a3d87 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+       * tconfig.h: Delete file.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index 3ca392429427521705fcfd2e9cc8798997a4f876..24c4a9b28b6ff0c64de891bcea1cb39405ebac24 100644 (file)
@@ -22,7 +22,6 @@ IQ2000_OBJS = iq2000.o cpu.o decode.o sem.o model.o mloop.o
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
-       sim-model.o \
        cgen-utils.o cgen-trace.o cgen-scache.o \
        cgen-run.o \
        sim-if.o arch.o \
diff --git a/sim/iq2000/tconfig.h b/sim/iq2000/tconfig.h
deleted file mode 100644 (file)
index cf63d44..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/* IQ2000 target configuration file.  -*- C -*- */
-
-/* For MSPR support.  FIXME: revisit.  */
-#define WITH_DEVICES 0
-
-/* ??? Temporary hack until model support unified.  */
-#define SIM_HAVE_MODEL
index 044ce0a18c7b0971bb0b9f4228dc7215b6dce486..b94ef40ec29688008f4953e2d1e9e0ff7450e204 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index 91b6278b3d8226e52069d93ad96bed3a9fedb611..7b7154955dae43980aa580c425d6cb5268d7a004 100644 (file)
@@ -7,7 +7,6 @@
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
-       sim-model.o \
         cgen-utils.o cgen-trace.o cgen-scache.o \
         cgen-run.o \
         sim-if.o arch.o \
index ce71d3008422a25e55a2f756e1fb2c971781a837..f726c3e715d8df5448a3b66e60efb2900914132c 100644 (file)
@@ -1,3 +1,7 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index 801db48391147d57e6cc05d6227ba7199cba5405..ca5c49db96c4517cc38516d1bdb649f72aba23f5 100644 (file)
@@ -27,7 +27,6 @@ TRAPS_OBJ = @traps_obj@
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
-       sim-model.o \
        cgen-utils.o cgen-trace.o cgen-scache.o \
        cgen-run.o \
        sim-if.o arch.o \
index 1601ff50350a2ef6476e7853007e6da66d6fcc87..9a4d1f5094d5039cfde87ad03595523aa117ef34 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-25  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.in (SIM_OBJS): Delete sim-model.o.
+       * tconfig.h: Delete file.
+
 2015-12-25  Mike Frysinger  <vapier@gentoo.org>
 
        * arch.c: Rename MACH to SIM_MACH.
index d1847bd826d2184d32fff35ceb4cd1db4ed7ee4f..aa84c8d35acea90eadb9af03415360c113795038 100644 (file)
@@ -24,7 +24,6 @@ SH64_OBJS = sh64.o cpu.o sh-desc.o \
 SIM_OBJS = \
        $(SIM_NEW_COMMON_OBJS) \
        sim-hload.o \
-       sim-model.o \
        cgen-utils.o cgen-trace.o cgen-scache.o \
        cgen-run.o \
        sim-if.o arch.o \
diff --git a/sim/sh64/tconfig.h b/sim/sh64/tconfig.h
deleted file mode 100644 (file)
index b4e256f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SH64 target configuration file.  -*- C -*- */
-
-/* For MSPR support.  FIXME: revisit.  */
-#define WITH_DEVICES 0
-
-/* ??? Temporary hack until model support unified.  */
-#define SIM_HAVE_MODEL