From e106fc358c217f8f1e09cfdd383f564178c8f5eb Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 21 Jan 2016 21:13:06 -0500 Subject: [PATCH] sim: cgen: invert sim_state storage for cgen ports --- sim/bpf/ChangeLog | 4 ++++ sim/bpf/sim-main.h | 9 --------- sim/common/ChangeLog | 8 ++++++++ sim/common/cgen-defs.h | 2 +- sim/common/sim-base.h | 10 ++++++++++ sim/cris/ChangeLog | 4 ++++ sim/cris/sim-main.h | 10 ---------- sim/frv/ChangeLog | 4 ++++ sim/frv/sim-main.h | 10 ---------- sim/iq2000/ChangeLog | 4 ++++ sim/iq2000/sim-main.h | 10 ---------- sim/lm32/ChangeLog | 4 ++++ sim/lm32/sim-main.h | 11 ----------- sim/m32r/ChangeLog | 4 ++++ sim/m32r/sim-main.h | 10 ---------- sim/or1k/ChangeLog | 5 +++++ sim/or1k/sim-main.h | 14 +------------- 17 files changed, 49 insertions(+), 74 deletions(-) diff --git a/sim/bpf/ChangeLog b/sim/bpf/ChangeLog index 69156e6fa1d..f5f57162599 100644 --- a/sim/bpf/ChangeLog +++ b/sim/bpf/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * bpf-helpers.c, bpf.c, sim-if.c, traps.c: Include defs.h. diff --git a/sim/bpf/sim-main.h b/sim/bpf/sim-main.h index 84943d1c885..571c14c67bc 100644 --- a/sim/bpf/sim-main.h +++ b/sim/bpf/sim-main.h @@ -39,13 +39,4 @@ struct _sim_cpu #endif }; - - -struct sim_state -{ - sim_cpu *cpu[MAX_NR_PROCESSORS]; - CGEN_STATE cgen_state; - sim_state_base base; -}; - #endif /* ! SIM_MAIN_H */ diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index f3fcaee0b05..3a6c31a07c0 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,11 @@ +2021-05-17 Mike Frysinger + + * 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 * sim-base.h (struct sim_state): Update comment. diff --git a/sim/common/cgen-defs.h b/sim/common/cgen-defs.h index 0d598ce4175..dab2f9ff16d 100644 --- a/sim/common/cgen-defs.h +++ b/sim/common/cgen-defs.h @@ -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; /* Various utilities. */ diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index f38e8412aed..e552d94d02c 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -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 diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index 80b0d7cb736..06ca4e4132b 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * cris-tmpl.c, crisv10f.c, crisv32f.c, dv-cris.c, dv-cris_900000xx.c, diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h index 3bd86126354..be75e22278e 100644 --- a/sim/cris/sim-main.h +++ b/sim/cris/sim-main.h @@ -205,16 +205,6 @@ struct _sim_cpu { #endif }; -/* The sim_state struct. */ - -struct sim_state { - sim_cpu *cpu[MAX_NR_PROCESSORS]; - - CGEN_STATE cgen_state; - - sim_state_base base; -}; - /* Misc. */ /* Catch address exceptions. */ diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog index e9e94631afd..d94526a4594 100644 --- a/sim/frv/ChangeLog +++ b/sim/frv/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * cache.c, frv.c, interrupts.c, memory.c, options.c, pipeline.c, diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h index 1515c325e73..e2b09a3778d 100644 --- a/sim/frv/sim-main.h +++ b/sim/frv/sim-main.h @@ -104,16 +104,6 @@ struct _sim_cpu { #endif /* defined (WANT_CPU_FRVBF) */ }; -/* The sim_state struct. */ - -struct sim_state { - sim_cpu *cpu[MAX_NR_PROCESSORS]; - - CGEN_STATE cgen_state; - - sim_state_base base; -}; - /* Misc. */ /* Catch address exceptions. */ diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog index b21e075d71d..d5805edfad7 100644 --- a/sim/iq2000/ChangeLog +++ b/sim/iq2000/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * iq2000.c, sim-if.c: Include defs.h. diff --git a/sim/iq2000/sim-main.h b/sim/iq2000/sim-main.h index d0ae1cfef7b..3615a712b06 100644 --- a/sim/iq2000/sim-main.h +++ b/sim/iq2000/sim-main.h @@ -43,16 +43,6 @@ struct _sim_cpu { #endif }; -/* The sim_state struct. */ - -struct sim_state { - sim_cpu *cpu[MAX_NR_PROCESSORS]; - - CGEN_STATE cgen_state; - - sim_state_base base; -}; - /* Misc. */ /* Catch address exceptions. */ diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog index db0e8f0c8af..c014a6d8b53 100644 --- a/sim/lm32/ChangeLog +++ b/sim/lm32/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * dv-lm32cpu.c, dv-lm32timer.c, dv-lm32uart.c, lm32.c, sim-if.c, diff --git a/sim/lm32/sim-main.h b/sim/lm32/sim-main.h index d00412fbfe7..c53557aa1e5 100644 --- a/sim/lm32/sim-main.h +++ b/sim/lm32/sim-main.h @@ -57,17 +57,6 @@ struct _sim_cpu LM32BF_CPU_DATA cpu_data; #endif -}; - -/* The sim_state struct. */ - -struct sim_state -{ - sim_cpu *cpu[MAX_NR_PROCESSORS]; - - CGEN_STATE cgen_state; - - sim_state_base base; }; /* Misc. */ diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 2e099a07fe9..04d342defeb 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,7 @@ +2021-05-17 Mike Frysinger + + * sim-main.h (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * dv-m32r_cache.c, dv-m32r_uart.c: Replace config.h include with diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h index 5b24ce84a62..f89db483c8c 100644 --- a/sim/m32r/sim-main.h +++ b/sim/m32r/sim-main.h @@ -48,16 +48,6 @@ struct _sim_cpu { #endif }; -/* The sim_state struct. */ - -struct sim_state { - sim_cpu *cpu[MAX_NR_PROCESSORS]; - - CGEN_STATE cgen_state; - - sim_state_base base; -}; - /* Misc. */ /* Catch address exceptions. */ diff --git a/sim/or1k/ChangeLog b/sim/or1k/ChangeLog index af6afc4609d..3484c07055d 100644 --- a/sim/or1k/ChangeLog +++ b/sim/or1k/ChangeLog @@ -1,3 +1,8 @@ +2021-05-17 Mike Frysinger + + * sim-main.h: Move or1k-opc.h include. + (struct sim_state): Delete. + 2021-05-16 Mike Frysinger * sim-main.h: Delete config.h include. diff --git a/sim/or1k/sim-main.h b/sim/or1k/sim-main.h index f91a351a2db..1727fe84658 100644 --- a/sim/or1k/sim-main.h +++ b/sim/or1k/sim-main.h @@ -23,13 +23,13 @@ #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 }; - - -/* 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 */ -- 2.30.2