summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-25 04:27:27 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-25 04:40:31 -0500
commit0d58595077841917ad57c9f8d2a61184a504ef40 (patch)
tree700d848c63f82b4284abebb23b1689a2272eb108 /sim
parent8a0ebee658862bec66191df192c1d3b09bf0c943 (diff)
downloadbinutils-gdb-0d58595077841917ad57c9f8d2a61184a504ef40.tar.gz
sim: sim-model: build for everyone
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.
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog5
-rw-r--r--sim/bfin/Makefile.in1
-rw-r--r--sim/bfin/tconfig.h3
-rw-r--r--sim/common/ChangeLog15
-rw-r--r--sim/common/Make-common.in1
-rw-r--r--sim/common/cgen-types.h4
-rw-r--r--sim/common/sim-base.h2
-rw-r--r--sim/common/sim-config.h4
-rw-r--r--sim/common/sim-cpu.h2
-rw-r--r--sim/common/sim-model.c12
-rw-r--r--sim/common/sim-model.h14
-rw-r--r--sim/common/sim-module.c2
-rw-r--r--sim/common/sim-profile.h6
-rw-r--r--sim/cris/ChangeLog5
-rw-r--r--sim/cris/Makefile.in1
-rw-r--r--sim/cris/tconfig.h2
-rw-r--r--sim/frv/ChangeLog5
-rw-r--r--sim/frv/Makefile.in1
-rw-r--r--sim/frv/tconfig.h3
-rw-r--r--sim/iq2000/ChangeLog5
-rw-r--r--sim/iq2000/Makefile.in1
-rw-r--r--sim/iq2000/tconfig.h7
-rw-r--r--sim/lm32/ChangeLog4
-rw-r--r--sim/lm32/Makefile.in1
-rw-r--r--sim/m32r/ChangeLog4
-rw-r--r--sim/m32r/Makefile.in1
-rw-r--r--sim/sh64/ChangeLog5
-rw-r--r--sim/sh64/Makefile.in1
-rw-r--r--sim/sh64/tconfig.h7
29 files changed, 75 insertions, 49 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 5599af66b19..744f5eb2000 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,10 @@
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
SIM_MACH_IMP_PROPERTIES, and MODEL to SIM_MODEL.
diff --git a/sim/bfin/Makefile.in b/sim/bfin/Makefile.in
index 817fecbb630..a2b6b0b94e2 100644
--- a/sim/bfin/Makefile.in
+++ b/sim/bfin/Makefile.in
@@ -28,7 +28,6 @@ SIM_OBJS = \
interp.o \
machs.o \
sim-hload.o \
- sim-model.o \
sim-resume.o
INCLUDE = bfin-sim.h
diff --git a/sim/bfin/tconfig.h b/sim/bfin/tconfig.h
index 254aba9b984..3ecd1743fea 100644
--- a/sim/bfin/tconfig.h
+++ b/sim/bfin/tconfig.h
@@ -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
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index e36895a1553..09f29bb9e28 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,20 @@
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.
* sim-model.c: Likewise.
* sim-model.h: Likewise. Rename MACH_IMP_PROPERTIES to
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 647ec80eb79..2566bf4bf5b 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -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 \
diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index 74dc6402af9..77793936f9d 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -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
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index cfef6ecddc0..3e15a8505e4 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -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"
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index 599b84c09c8..064d9368947 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -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
diff --git a/sim/common/sim-cpu.h b/sim/common/sim-cpu.h
index 20838e876e5..f998befa08c 100644
--- a/sim/common/sim-cpu.h
+++ b/sim/common/sim-cpu.h
@@ -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;
diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c
index 0d0c28d3354..054f0bcf7f0 100644
--- a/sim/common/sim-model.c
+++ b/sim/common/sim-model.c
@@ -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;
}
+
+#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
diff --git a/sim/common/sim-model.h b/sim/common/sim-model.h
index 5baa5ce1d94..a206626b1d2 100644
--- a/sim/common/sim-model.h
+++ b/sim/common/sim-model.h
@@ -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 {
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index 4f23882acd3..670225bd773 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -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
diff --git a/sim/common/sim-profile.h b/sim/common/sim-profile.h
index 3370f0cbdb8..b756af59db7 100644
--- a/sim/common/sim-profile.h
+++ b/sim/common/sim-profile.h
@@ -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;
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index ff73db19a34..66ef461120f 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,5 +1,10 @@
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.
* cpuall.h: Likewise.
* modelv10.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/cris/Makefile.in b/sim/cris/Makefile.in
index f7762dd7970..384922f746f 100644
--- a/sim/cris/Makefile.in
+++ b/sim/cris/Makefile.in
@@ -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 \
diff --git a/sim/cris/tconfig.h b/sim/cris/tconfig.h
index 05d86233ea0..2ac6c5bd803 100644
--- a/sim/cris/tconfig.h
+++ b/sim/cris/tconfig.h
@@ -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 */
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 6fca1e1cd5c..26caec46bf4 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,5 +1,10 @@
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.
* cpuall.h: Likewise.
* model.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/frv/Makefile.in b/sim/frv/Makefile.in
index 62e480abb2a..86095fff0df 100644
--- a/sim/frv/Makefile.in
+++ b/sim/frv/Makefile.in
@@ -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 \
diff --git a/sim/frv/tconfig.h b/sim/frv/tconfig.h
index 1abdc611577..e5db154719e 100644
--- a/sim/frv/tconfig.h
+++ b/sim/frv/tconfig.h
@@ -2,6 +2,3 @@
/* For MSPR support. FIXME: revisit. */
#define WITH_DEVICES 1
-
-/* ??? Temporary hack until model support unified. */
-#define SIM_HAVE_MODEL
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 03cc0237ef3..4ee58391d67 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,5 +1,10 @@
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.
* cpuall.h: Likewise.
* model.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/iq2000/Makefile.in b/sim/iq2000/Makefile.in
index 3ca39242942..24c4a9b28b6 100644
--- a/sim/iq2000/Makefile.in
+++ b/sim/iq2000/Makefile.in
@@ -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
index cf63d449ac9..00000000000
--- a/sim/iq2000/tconfig.h
+++ /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
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 044ce0a18c7..b94ef40ec29 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,5 +1,9 @@
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.
* cpuall.h: Likewise.
* model.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/lm32/Makefile.in b/sim/lm32/Makefile.in
index 91b6278b3d8..7b7154955da 100644
--- a/sim/lm32/Makefile.in
+++ b/sim/lm32/Makefile.in
@@ -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 \
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index ce71d300842..f726c3e715d 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,5 +1,9 @@
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.
* cpuall.h: Likewise.
* model.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in
index 801db483911..ca5c49db96c 100644
--- a/sim/m32r/Makefile.in
+++ b/sim/m32r/Makefile.in
@@ -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 \
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index 1601ff50350..9a4d1f5094d 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,5 +1,10 @@
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.
* cpuall.h: Likewise.
* sh64.c: Rename MACH to SIM_MACH, MACH_IMP_PROPERTIES to
diff --git a/sim/sh64/Makefile.in b/sim/sh64/Makefile.in
index d1847bd826d..aa84c8d35ac 100644
--- a/sim/sh64/Makefile.in
+++ b/sim/sh64/Makefile.in
@@ -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
index b4e256f7bee..00000000000
--- a/sim/sh64/tconfig.h
+++ /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