sim: cgen: inline cgen_init logic

This function has done only one thing: post-process command line
settings to see if profiling or tracing has been enabled, and if
so, set the run_fast_p flag in the simulator state.  That flag is
only used in one place: to select the fast or slow cgen engine.
By inlining the run_fast_p logic to the one place it's used, we
can delete a good amount of logic specific to cgen ports: both
the call to cgen_init and the conditional simulator state.  This
in turn allows us to have a single simulator state struct across
all ports so we can share objects more between them, and makes
the sim_open calls look more consistent.
This commit is contained in:
Mike Frysinger
2021-06-05 10:21:46 -04:00
parent c70fdc45f6
commit 906192d785
20 changed files with 62 additions and 89 deletions

View File

@@ -89,41 +89,6 @@ const CGEN_INSN cgen_virtual_insn_table[] =
{ & virtual_insn_entries[5] }
};
/* Initialize cgen things.
This is called after sim_post_argv_init. */
void
cgen_init (SIM_DESC sd)
{
int i, c;
/* If no profiling or tracing has been enabled, run in fast mode. */
{
int run_fast_p = 1;
for (c = 0; c < MAX_NR_PROCESSORS; ++c)
{
SIM_CPU *cpu = STATE_CPU (sd, c);
for (i = 0; i < MAX_PROFILE_VALUES; ++i)
if (CPU_PROFILE_FLAGS (cpu) [i])
{
run_fast_p = 0;
break;
}
for (i = 0; i < MAX_TRACE_VALUES; ++i)
if (CPU_TRACE_FLAGS (cpu) [i])
{
run_fast_p = 0;
break;
}
if (! run_fast_p)
break;
}
STATE_RUN_FAST_P (sd) = run_fast_p;
}
}
/* Return the name of insn number I. */
const char *