sim: delete dead current_state globals

The global current_state handle to the current simulator state is a
design idea that was half implemented, but never really cleaned up.
The point was to have a global variable pointing to the state so that
funcs could more quickly & easily access the state anywhere.  We've
instead moved in the direction of passing state around everywhere and
don't have any intention of moving back.

I also can't find any references to gdb using this variable, or to
cgen related "dump_regs" functions, both of which were used in the
comments related to this code.
This commit is contained in:
Mike Frysinger 2016-01-02 09:23:06 -05:00
parent 32273fe68f
commit d47f5b30d8
19 changed files with 42 additions and 86 deletions

View File

@ -1,3 +1,9 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* cgen-defs.h (current_state): Delete.
* sim-base.h (CURRENT_STATE_REG, CURRENT_STATE): Delete.
* sim-utils.c (current_state): Delete.
2015-12-30 Mike Frysinger <vapier@gentoo.org>
* sim-module.c (sim_pre_argv_init): Change STATE_MY_NAME assignment

View File

@ -140,12 +140,6 @@ typedef enum {
/* Simulator state. */
/* Records simulator descriptor so utilities like @cpu@_dump_regs can be
called from gdb. */
extern SIM_DESC current_state;
/* Simulator state. */
/* CGEN_STATE contains additional state information not present in
sim_state_base. */

View File

@ -89,28 +89,6 @@ typedef struct _sim_cpu sim_cpu;
#include "sim-memopt.h"
#include "sim-cpu.h"
/* Global pointer to current state while sim_resume is running.
On a machine with lots of registers, it might be possible to reserve
one of them for current_state. However on a machine with few registers
current_state can't permanently live in one and indirecting through it
will be slower [in which case one can have sim_resume set globals from
current_state for faster access].
If CURRENT_STATE_REG is defined, it means current_state is living in
a global register. */
#ifdef CURRENT_STATE_REG
/* FIXME: wip */
#else
extern struct sim_state *current_state;
#endif
/* The simulator may provide different (and faster) definition. */
#ifndef CURRENT_STATE
#define CURRENT_STATE current_state
#endif
/* We require all sims to dynamically allocate cpus. See comment up top about
struct sim_state. */

View File

@ -48,10 +48,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "bfd.h"
#include "sim-utils.h"
/* Global pointer to all state data.
Set by sim_resume. */
struct sim_state *current_state;
/* Allocate zero filled memory with xcalloc - xcalloc aborts if the
allocation fails. */

View File

@ -1,3 +1,8 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-30 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (sim_open): Delete current_target_byte_order assignment.

View File

@ -81,10 +81,6 @@ static int cris_program_offset = 0;
enum cris_unknown_syscall_action_type cris_unknown_syscall_action
= CRIS_USYSC_MSG_STOP;
/* Records simulator descriptor so utilities like cris_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* CRIS-specific options. */
typedef enum {
OPTION_CRIS_STATS = OPTION_START,
@ -985,10 +981,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
Must be done after cris_cgen_cpu_open. */
cgen_init (sd);
/* Store in a global so things like cris_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
cris_set_callbacks (callback);
return sd;

View File

@ -1,3 +1,9 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* reset.c (frv_term): Change current_state to sd.
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.

View File

@ -105,7 +105,7 @@ frv_term (SIM_DESC sd)
then turn it off again. This is the only place we can currently gain
control to do this. */
if (frv_interrupt_state.timer.enabled && ! frv_save_profile_model_p)
sim_profile_set_option (current_state, "-model", PROFILE_MODEL_IDX, "0");
sim_profile_set_option (sd, "-model", PROFILE_MODEL_IDX, "0");
}
/* Perform a power on reset. */

View File

@ -30,10 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
static void free_state (SIM_DESC);
static void print_frv_misc_cpu (SIM_CPU *cpu, int verbose);
/* Records simulator descriptor so utilities like frv_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* Cover function of sim_state_free to free the cpu buffers as well. */
@ -175,10 +171,6 @@ sim_open (kind, callback, abfd, argv)
frv_initialize (cpu, sd);
}
/* Store in a global so things like sparc32_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
return sd;
}

View File

@ -1,3 +1,8 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.

View File

@ -26,10 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "bfd.h"
static void free_state (SIM_DESC);
/* Records simulator descriptor so utilities like iq2000_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* Cover function for sim_cgen_disassemble_insn. */
@ -149,10 +145,6 @@ sim_open (kind, callback, abfd, argv)
Must be done after iq2000_cgen_cpu_open. */
cgen_init (sd);
/* Store in a global so things like sparc32_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
return sd;
}

View File

@ -1,3 +1,8 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.

View File

@ -43,10 +43,6 @@ static const OPTION lm32_options[] = {
lm32_option_handler},
{{NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL}
};
/* Records simulator descriptor so utilities like lm32_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* Cover function of sim_state_free to free the cpu buffers as well. */
@ -240,10 +236,6 @@ sim_open (kind, callback, abfd, argv)
Must be done after lm32_cgen_cpu_open. */
cgen_init (sd);
/* Store in a global so things like lm32_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
return sd;
}

View File

@ -1,3 +1,8 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.

View File

@ -37,10 +37,6 @@
static void free_state (SIM_DESC);
static void print_m32r_misc_cpu (SIM_CPU *cpu, int verbose);
/* Records simulator descriptor so utilities like m32r_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* Cover function of sim_state_free to free the cpu buffers as well. */
@ -169,10 +165,6 @@ sim_open (kind, callback, abfd, argv)
= print_m32r_misc_cpu;
}
/* Store in a global so things like sparc32_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
return sd;
}

View File

@ -1,3 +1,7 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* dv-tx3904cpu.c (CPU, SD): Delete.
2015-12-30 Mike Frysinger <vapier@gentoo.org>
* wrapper.c (mips_reg_store, mips_reg_fetch): Define.

View File

@ -143,9 +143,6 @@ deliver_tx3904cpu_interrupt (struct hw *me,
sim_cpu *cpu = STATE_CPU (sd, 0); /* NB: fix CPU 0. */
address_word cia = CPU_PC_GET (cpu);
#define CPU cpu
#define SD current_state
if (controller->pending_reset)
{
controller->pending_reset = 0;
@ -190,8 +187,6 @@ deliver_tx3904cpu_interrupt (struct hw *me,
}
} /* interrupt set */
}
#undef CPU cpu
#undef SD current_state
}

View File

@ -1,3 +1,8 @@
2016-01-02 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (current_state): Delete.
(sim_open): Delete current_state assignment.
2015-12-27 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete sim-hload.o.

View File

@ -32,10 +32,6 @@ static void free_state (SIM_DESC);
/* Since we don't build the cgen-opcode table, we use a wrapper around
the existing disassembler from libopcodes. */
static CGEN_DISASSEMBLER sh64_disassemble_insn;
/* Records simulator descriptor so utilities like sh5_dump_regs can be
called from gdb. */
SIM_DESC current_state;
/* Cover function of sim_state_free to free the cpu buffers as well. */
@ -155,10 +151,6 @@ sim_open (kind, callback, abfd, argv)
Must be done after sh_cgen_cpu_open. */
cgen_init (sd);
/* Store in a global so things like sparc32_dump_regs can be invoked
from the gdb command line. */
current_state = sd;
return sd;
}