diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-06-28 21:42:56 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-06-30 01:52:51 -0400 |
commit | 1c636da093f335cd57e7fca0fc25ae9f9e849264 (patch) | |
tree | e33d33c678ae988d2ad31027bb2b23c8f009e34e /sim/common/cgen-utils.c | |
parent | f8261de1b22cc1a72ae18a2300df8b2cf7f027db (diff) | |
download | binutils-1c636da093f335cd57e7fca0fc25ae9f9e849264.zip binutils-1c636da093f335cd57e7fca0fc25ae9f9e849264.tar.gz binutils-1c636da093f335cd57e7fca0fc25ae9f9e849264.tar.bz2 |
sim: namespace sim_machs
We want to do a single build with all arches in one binary which means
we need to namespace sim_machs on a per-arch basis. Move it from a
global variable to the sim description structure so it can be setup at
runtime.
Changing the SIM_MODEL->num from an enum to an int is unfortunate, but
we specifically don't want to maintain a centralized list anymore, and
this was never used directly in common code, just passed to per-arch
callbacks.
Diffstat (limited to 'sim/common/cgen-utils.c')
-rw-r--r-- | sim/common/cgen-utils.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c index 8c0856c..d9c3ea9 100644 --- a/sim/common/cgen-utils.c +++ b/sim/common/cgen-utils.c @@ -101,14 +101,16 @@ cgen_insn_name (SIM_CPU *cpu, int i) /* Return the maximum number of extra bytes required for a SIM_CPU struct. */ int -cgen_cpu_max_extra_bytes (void) +cgen_cpu_max_extra_bytes (SIM_DESC sd) { - int i; + const SIM_MACH * const *machp; int extra = 0; - for (i = 0; sim_machs[i] != 0; ++i) + SIM_ASSERT (STATE_MACHS (sd) != NULL); + + for (machp = STATE_MACHS (sd); *machp != NULL; ++machp) { - int size = IMP_PROPS_SIM_CPU_SIZE (MACH_IMP_PROPS (sim_machs[i])); + int size = IMP_PROPS_SIM_CPU_SIZE (MACH_IMP_PROPS (*machp)); if (size > extra) extra = size; } |