sim: cgen: invert sim_state storage for cgen ports
authorMike Frysinger <vapier@gentoo.org>
Fri, 22 Jan 2016 02:13:06 +0000 (21:13 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 17 May 2021 04:46:32 +0000 (00:46 -0400)
17 files changed:
sim/bpf/ChangeLog
sim/bpf/sim-main.h
sim/common/ChangeLog
sim/common/cgen-defs.h
sim/common/sim-base.h
sim/cris/ChangeLog
sim/cris/sim-main.h
sim/frv/ChangeLog
sim/frv/sim-main.h
sim/iq2000/ChangeLog
sim/iq2000/sim-main.h
sim/lm32/ChangeLog
sim/lm32/sim-main.h
sim/m32r/ChangeLog
sim/m32r/sim-main.h
sim/or1k/ChangeLog
sim/or1k/sim-main.h

index 69156e6fa1d7957ca54eaeb52832811c9e4429ed..f5f57162599449899edd70ac2b0044f2a717adc0 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * bpf-helpers.c, bpf.c, sim-if.c, traps.c: Include defs.h.
index 84943d1c885826149d1c7cccf14e918e4d41d99b..571c14c67bc51a316c414598104acf1df2113181 100644 (file)
@@ -39,13 +39,4 @@ struct _sim_cpu
 #endif
 };
 
-\f
-
-struct sim_state
-{
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-  CGEN_STATE cgen_state;
-  sim_state_base base;
-};
-
 #endif /* ! SIM_MAIN_H */
index f3fcaee0b05584df6073b6ccd91fbf988351d270..3a6c31a07c045c548dbb68c3e271507715d1f40a 100644 (file)
@@ -1,3 +1,11 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * cgen-defs.h (STATE_RUN_FAST_P): Call STATE_CGEN_STATE.
+       * sim-base.h [CGEN_ARCH]: Include cgen-sim.h and define
+       SIM_HAVE_COMMON_SIM_STATE.
+       (struct sim_state): Add cgen_state.
+       (STATE_CGEN_STATE): Define.
+
 2021-05-17  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-base.h (struct sim_state): Update comment.
index 0d598ce4175f6a572c683b8163242c21748f3513..dab2f9ff16de1c4b83ff1b65163ea4b22e940936 100644 (file)
@@ -146,7 +146,7 @@ typedef enum {
 typedef struct cgen_state {
   /* Non-zero if no tracing or profiling is selected.  */
   int run_fast_p;
-#define STATE_RUN_FAST_P(sd) ((sd) -> cgen_state.run_fast_p)
+#define STATE_RUN_FAST_P(sd) (STATE_CGEN_STATE (sd).run_fast_p)
 } CGEN_STATE;
 \f
 /* Various utilities.  */
index f38e8412aed6df16fe98bc5e44a776755751b4b3..e552d94d02c54305b8e816af04a3ba8b9c5a47a0 100644 (file)
@@ -88,6 +88,10 @@ typedef struct _sim_cpu sim_cpu;
 #include "sim-cpu.h"
 #include "sim-assert.h"
 
+#ifdef CGEN_ARCH
+# include "cgen-sim.h"
+# define SIM_HAVE_COMMON_SIM_STATE
+#endif
 
 /* We require all sims to dynamically allocate cpus.  See comment up top about
    struct sim_state.  */
@@ -232,6 +236,12 @@ struct sim_state {
      target should define a struct and use it here.  */
   void *arch_data;
 #define STATE_ARCH_DATA(sd) ((sd)->arch_data)
+
+#ifdef CGEN_ARCH
+  /* Various cgen runtime state.  */
+  CGEN_STATE cgen_state;
+#endif
+#define STATE_CGEN_STATE(sd) ((sd)->cgen_state)
 };
 #endif
 
index 80b0d7cb7361c2a0579d188df3e132563faaf9ff..06ca4e4132b3a16c70b3a741692288983a8bc7b3 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * cris-tmpl.c, crisv10f.c, crisv32f.c, dv-cris.c, dv-cris_900000xx.c,
index 3bd86126354b34ab945c726e7602fe350d84cb60..be75e22278ed6ca6b5c64e305ba03a18deafa8a6 100644 (file)
@@ -205,16 +205,6 @@ struct _sim_cpu {
 #endif
 };
 \f
-/* The sim_state struct.  */
-
-struct sim_state {
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
-};
-\f
 /* Misc.  */
 
 /* Catch address exceptions.  */
index e9e94631afd46539aa2a8dde2647ff5072aa8c77..d94526a4594b696768d1f3828d083e56dcb1ca4d 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * cache.c, frv.c, interrupts.c, memory.c, options.c, pipeline.c,
index 1515c325e737bdf5677e1dac6308fb4a1edf62f5..e2b09a3778d186f2cbd9139b713a0ab3aa68eca0 100644 (file)
@@ -104,16 +104,6 @@ struct _sim_cpu {
 #endif /* defined (WANT_CPU_FRVBF) */
 };
 \f
-/* The sim_state struct.  */
-
-struct sim_state {
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
-};
-\f
 /* Misc.  */
 
 /* Catch address exceptions.  */
index b21e075d71d6de44c4c16c1d2afe0e12d670d601..d5805edfad7d9b69818bd37bd62ad9d3be4d20b8 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * iq2000.c, sim-if.c: Include defs.h.
index d0ae1cfef7b14c3571c569c472511bfccd430c50..3615a712b065c8bc954130934a29c6717f8d077f 100644 (file)
@@ -43,16 +43,6 @@ struct _sim_cpu {
 #endif
 };
 \f
-/* The sim_state struct.  */
-
-struct sim_state {
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
-};
-\f
 /* Misc.  */
 
 /* Catch address exceptions.  */
index db0e8f0c8af80058fe9745a039878327a56afb0e..c014a6d8b53ac041770cb56572da70dd99418945 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-lm32cpu.c, dv-lm32timer.c, dv-lm32uart.c, lm32.c, sim-if.c,
index d00412fbfe757d12bd0f44734c5c5f506667047c..c53557aa1e515aeaa4e7f66d54259ea9aeefbac7 100644 (file)
@@ -57,17 +57,6 @@ struct _sim_cpu
   LM32BF_CPU_DATA cpu_data;
 #endif
 
-};
-\f
-/* The sim_state struct.  */
-
-struct sim_state
-{
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
 };
 \f
 /* Misc.  */
index 2e099a07fe9ba5b8903eca5fdb8aa4979507c362..04d342defeb14f7952c99ff8e9e0a0c850d8d9b5 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-m32r_cache.c, dv-m32r_uart.c: Replace config.h include with
index 5b24ce84a62f4c84d2ef07fe1871bed38e67fc25..f89db483c8cf544ced0c51e566af02dfe80347bb 100644 (file)
@@ -48,16 +48,6 @@ struct _sim_cpu {
 #endif
 };
 \f
-/* The sim_state struct.  */
-
-struct sim_state {
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
-};
-\f
 /* Misc.  */
 
 /* Catch address exceptions.  */
index af6afc4609dbc3653cee52997eb7c03e1988ba1d..3484c07055da5d7d5653ee693ab8bcb9e51849ea 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-17  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.h: Move or1k-opc.h include.
+       (struct sim_state): Delete.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-main.h: Delete config.h include.
index f91a351a2db1b0df8eeddd6ade39a2388f621f3e..1727fe84658e9e426e1d5a966055aea1edb6a493 100644 (file)
 
 #include "ansidecl.h"
 #include "or1k-desc.h"
+#include "or1k-opc.h"
 #include "sim-basics.h"
 #include "cgen-types.h"
 #include "arch.h"
 #include "sim-base.h"
 #include "sim-fpu.h"
 
-#include "or1k-opc.h"
 #include "cgen-sim.h"
 #include "or1k-sim.h"
 
@@ -66,16 +66,4 @@ struct _sim_cpu
 #endif
 };
 
-\f
-
-/* The sim_state struct.  */
-struct sim_state
-{
-  sim_cpu *cpu[MAX_NR_PROCESSORS];
-
-  CGEN_STATE cgen_state;
-
-  sim_state_base base;
-};
-
 #endif /* SIM_MAIN_H */