* [PATCH 1/3] sim: mips: namespace igen configure vars
@ 2022-12-25 3:16 Mike Frysinger
2022-12-25 3:16 ` [PATCH 2/3] sim: mips: move igen settings to top-level configure Mike Frysinger
2022-12-25 3:16 ` [PATCH 3/3] sim: mips: clean up a bit after mips/configure removal Mike Frysinger
0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2022-12-25 3:16 UTC (permalink / raw)
To: gdb-patches
To prepare moving this logic to the top-level configure, the vars
need to be namespaced. Do that here to make it easier to review.
Basically sim_xxx -> SIM_MIPS_XXX when a var is exported from the
configure script to the Makefile, and sim_xxx -> sim_mips_xxx when
the var is internal in the configure script.
---
sim/mips/Makefile.in | 43 ++++++----
sim/mips/configure | 192 +++++++++++++++++++++---------------------
sim/mips/configure.ac | 192 +++++++++++++++++++++---------------------
3 files changed, 218 insertions(+), 209 deletions(-)
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index 25b6c65bfeee..0e2f1057530d 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -3,6 +3,16 @@
## COMMON_PRE_CONFIG_FRAG
+SIM_MIPS_IGEN_FLAGS = @SIM_MIPS_IGEN_FLAGS@
+SIM_MIPS_M16_FLAGS = @SIM_MIPS_M16_FLAGS@
+SIM_MIPS_MICROMIPS_FLAGS = @SIM_MIPS_MICROMIPS_FLAGS@
+SIM_MIPS_MICROMIPS16_FLAGS = @SIM_MIPS_MICROMIPS16_FLAGS@
+SIM_MIPS_GEN = @SIM_MIPS_GEN@
+SIM_MIPS_MULTI_FLAGS = @SIM_MIPS_MULTI_FLAGS@
+SIM_MIPS_MULTI_IGEN_CONFIGS = @SIM_MIPS_MULTI_IGEN_CONFIGS@
+SIM_MIPS_MULTI_SRC = @SIM_MIPS_MULTI_SRC@
+SIM_MIPS_MULTI_OBJ = @SIM_MIPS_MULTI_OBJ@
+
arch = mips
# Object files created by various simulator generators.
@@ -52,13 +62,13 @@ SIM_MICROMIPS_OBJ = \
micromipsrun.o \
-SIM_MULTI_OBJ = @sim_multi_obj@ \
+SIM_MULTI_OBJ = $(SIM_MIPS_MULTI_OBJ) \
itable.o \
multi-run.o \
SIM_OBJS = \
interp.o \
- $(SIM_@sim_gen@_OBJ) \
+ $(SIM_$(SIM_MIPS_GEN)_OBJ) \
$(SIM_NEW_COMMON_OBJS) \
cp1.o \
mdmx.o \
@@ -75,7 +85,7 @@ SIM_FLOAT = -DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POI
SIM_EXTRA_CLEAN = clean-extra
SIM_EXTRA_DISTCLEAN = distclean-extra
-all: $(SIM_@sim_gen@_ALL)
+all: $(SIM_$(SIM_MIPS_GEN)_ALL)
SIM_EXTRA_DEPS = itable.h
@@ -114,7 +124,7 @@ SIM_M16_ALL = tmp-m16
SIM_MICROMIPS_ALL = tmp-micromips
SIM_MULTI_ALL = tmp-multi
-$(BUILT_SRC_FROM_GEN): $(SIM_@sim_gen@_ALL)
+$(BUILT_SRC_FROM_GEN): $(SIM_$(SIM_MIPS_GEN)_ALL)
@@ -141,7 +151,7 @@ tmp-igen: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_igen_flags@ \
+ $(SIM_MIPS_IGEN_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 32 \
@@ -197,7 +207,7 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_m16_flags@ \
+ $(SIM_MIPS_M16_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 16 \
@@ -222,7 +232,7 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_igen_flags@ \
+ $(SIM_MIPS_IGEN_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 32 \
@@ -248,7 +258,7 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-Werror \
-Wnodiscard \
-Wnowidth \
- @sim_igen_flags@ @sim_m16_flags@ \
+ $(SIM_MIPS_IGEN_FLAGS) $(SIM_MIPS_M16_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-i $(IGEN_INSN) \
@@ -299,7 +309,7 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_micromips16_flags@ \
+ $(SIM_MIPS_MICROMIPS16_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 16 \
@@ -324,7 +334,7 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_micromips_flags@ \
+ $(SIM_MIPS_MICROMIPS_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 32 \
@@ -349,7 +359,7 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-I $(srcdir) \
-Werror \
-Wnodiscard \
- @sim_igen_flags@ \
+ $(SIM_MIPS_IGEN_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-B 32 \
@@ -375,7 +385,7 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-Werror \
-Wnodiscard \
-Wnowidth \
- @sim_igen_flags@ @sim_micromips_flags@ @sim_micromips16_flags@\
+ $(SIM_MIPS_IGEN_FLAGS) $(SIM_MIPS_MICROMIPS_FLAGS) $(SIM_MIPS_MICROMIPS16_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-i $(IGEN_INSN) \
@@ -384,13 +394,12 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
#
$(SILENCE) touch $@
-BUILT_SRC_FROM_MULTI = @sim_multi_src@
-SIM_MULTI_IGEN_CONFIGS = @sim_multi_igen_configs@
+BUILT_SRC_FROM_MULTI = $(SIM_MIPS_MULTI_SRC)
$(BUILT_SRC_FROM_MULTI): tmp-multi
tmp-multi: tmp-mach-multi tmp-itable-multi tmp-run-multi
tmp-mach-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
- for t in $(SIM_MULTI_IGEN_CONFIGS); do \
+ for t in $(SIM_MIPS_MULTI_IGEN_CONFIGS); do \
p=`echo $${t} | sed -e 's/:.*//'` ; \
m=`echo $${t} | sed -e 's/.*:\(.*\):.*/\1/'` ; \
f=`echo $${t} | sed -e 's/.*://'` ; \
@@ -443,7 +452,7 @@ tmp-itable-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
-Wnodiscard \
-Wnowidth \
-N 0 \
- @sim_multi_flags@ \
+ $(SIM_MIPS_MULTI_FLAGS) \
-G gen-direct-access \
-G gen-zero-r0 \
-i $(IGEN_INSN) \
@@ -452,7 +461,7 @@ tmp-itable-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
#
$(SILENCE) touch $@
tmp-run-multi: $(srcdir)/m16run.c $(srcdir)/micromipsrun.c
- for t in $(SIM_MULTI_IGEN_CONFIGS); do \
+ for t in $(SIM_MIPS_MULTI_IGEN_CONFIGS); do \
case $${t} in \
m16*) \
m=`echo $${t} | sed -e 's/^m16//' -e 's/:.*//'`; \
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index a015fcdbda84..7059db459b11 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -9,85 +9,85 @@ AC_CANONICAL_SYSTEM
#
# Select the IGEN architecture
#
-sim_gen=IGEN
-sim_igen_machine="-M mipsIV"
-sim_m16_machine="-M mips16,mipsIII"
-sim_igen_filter="32,64,f"
-sim_m16_filter="16"
+SIM_MIPS_GEN=IGEN
+sim_mips_igen_machine="-M mipsIV"
+sim_mips_m16_machine="-M mips16,mipsIII"
+sim_mips_igen_filter="32,64,f"
+sim_mips_m16_filter="16"
case "${target}" in
- mips*tx39*) sim_gen=IGEN
- sim_igen_filter="32,f"
- sim_igen_machine="-M r3900"
+ mips*tx39*) SIM_MIPS_GEN=IGEN
+ sim_mips_igen_filter="32,f"
+ sim_mips_igen_machine="-M r3900"
;;
- mips64vr41*) sim_gen=M16
- sim_igen_machine="-M vr4100"
- sim_m16_machine="-M vr4100"
+ mips64vr41*) SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M vr4100"
+ sim_mips_m16_machine="-M vr4100"
;;
mips64*)
- sim_gen=MULTI
- sim_multi_configs="\
+ SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
vr5000:mipsIV:32,64,f:mips4300,mips5000,mips8000\
vr5400:mipsIV,vr5400:32,64,f:mips5400\
vr5500:mipsIV,vr5500:32,64,f:mips5500"
- sim_multi_default=mips5000
+ sim_mips_multi_default=mips5000
;;
mips*-sde-elf* | mips*-mti-elf*)
- sim_gen=MULTI
- sim_multi_configs="\
+ SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
mipsisa64r2:mips64r2,mips16,mips16e,mdmx,dsp,dsp2,mips3d,smartmips:32,64,f:mipsisa32r2,mipsisa64r2,mipsisa32r5,mipsisa64r5\
mipsisa64r6:mips64r6:32,64,f:mipsisa32r6,mipsisa64r6"
- sim_multi_default=mipsisa64r2
+ sim_mips_multi_default=mipsisa64r2
;;
- mips16*) sim_gen=M16
+ mips16*) SIM_MIPS_GEN=M16
;;
- mipsisa32r2*) sim_gen=MULTI
- sim_multi_configs="\
+ mipsisa32r2*) SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
micromips:micromips32,micromipsdsp:32,f:mips_micromips\
mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
- sim_multi_default=mipsisa32r2
+ sim_mips_multi_default=mipsisa32r2
;;
- mipsisa32r6*) sim_gen=IGEN
- sim_igen_machine="-M mips32r6"
- sim_igen_filter="32,f"
+ mipsisa32r6*) SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips32r6"
+ sim_mips_igen_filter="32,f"
;;
- mipsisa32*) sim_gen=M16
- sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
- sim_m16_machine="-M mips16,mips16e,mips32"
- sim_igen_filter="32,f"
+ mipsisa32*) SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips32,mips16,mips16e,smartmips"
+ sim_mips_m16_machine="-M mips16,mips16e,mips32"
+ sim_mips_igen_filter="32,f"
;;
- mipsisa64r2*) sim_gen=M16
- sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
- sim_m16_machine="-M mips16,mips16e,mips64r2"
+ mipsisa64r2*) SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
+ sim_mips_m16_machine="-M mips16,mips16e,mips64r2"
;;
- mipsisa64r6*) sim_gen=IGEN
- sim_igen_machine="-M mips64r6"
+ mipsisa64r6*) SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips64r6"
;;
- mipsisa64sb1*) sim_gen=IGEN
- sim_igen_machine="-M mips64,mips3d,sb1"
+ mipsisa64sb1*) SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips64,mips3d,sb1"
;;
- mipsisa64*) sim_gen=M16
- sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
- sim_m16_machine="-M mips16,mips16e,mips64"
+ mipsisa64*) SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
+ sim_mips_m16_machine="-M mips16,mips16e,mips64"
;;
- mips*lsi*) sim_gen=M16
- sim_igen_machine="-M mipsIII,mips16"
- sim_m16_machine="-M mips16,mipsIII"
- sim_igen_filter="32,f"
+ mips*lsi*) SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mipsIII,mips16"
+ sim_mips_m16_machine="-M mips16,mipsIII"
+ sim_mips_igen_filter="32,f"
;;
- mips*) sim_gen=IGEN
- sim_igen_filter="32,f"
+ mips*) SIM_MIPS_GEN=IGEN
+ sim_mips_igen_filter="32,f"
;;
esac
# The MULTI generator can combine several simulation engines into one.
# executable. A configuration which uses the MULTI should set two
-# variables: ${sim_multi_configs} and ${sim_multi_default}.
+# variables: ${sim_mips_multi_configs} and ${sim_mips_multi_default}.
#
-# ${sim_multi_configs} is the list of engines to build. Each
+# ${sim_mips_multi_configs} is the list of engines to build. Each
# space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
# where:
#
@@ -105,22 +105,22 @@ esac
#
# The simulator compares the bfd mach against BFDMACHS to decide
# which engine to use. Entries in BFDMACHS should be bfd_mach
-# values with "bfd_mach_" removed. ${sim_multi_default} says
+# values with "bfd_mach_" removed. ${sim_mips_multi_default} says
# which entry should be the default.
-if test ${sim_gen} = MULTI; then
+SIM_MIPS_MULTI_FLAGS=
+SIM_MIPS_MULTI_SRC=
+SIM_MIPS_MULTI_OBJ=
+SIM_MIPS_MULTI_IGEN_CONFIGS=
+if test ${SIM_MIPS_GEN} = MULTI; then
# Simple sanity check.
- if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
+ if test -z "${sim_mips_multi_configs}" || test -z "${sim_mips_multi_default}"; then
AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
fi
# Start in a known state.
rm -f multi-include.h multi-run.c
- sim_multi_flags=
- sim_multi_src=
- sim_multi_obj=
- sim_multi_igen_configs=
- sim_seen_default=no
+ sim_mips_seen_default=no
cat << __EOF__ > multi-run.c
/* Main entry point for MULTI simulators.
@@ -161,7 +161,7 @@ sim_engine_run (SIM_DESC sd,
int mach;
if (STATE_ARCHITECTURE (sd) == NULL)
- mach = bfd_mach_${sim_multi_default};
+ mach = bfd_mach_${sim_mips_multi_default};
else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
& EF_MIPS_ARCH_ASE_MICROMIPS)
mach = bfd_mach_mips_micromips;
@@ -176,7 +176,7 @@ sim_engine_run (SIM_DESC sd,
{
__EOF__
- for fc in ${sim_multi_configs}; do
+ for fc in ${sim_mips_multi_configs}; do
# Split up the entry. ${c} contains the first three elements.
# Note: outer sqaure brackets are m4 quotes.
@@ -188,15 +188,15 @@ __EOF__
# Build the following lists:
#
- # sim_multi_flags: all -M and -F flags used by the simulator
- # sim_multi_src: all makefile-generated source files
- # sim_multi_obj: the objects for ${sim_multi_src}
- # sim_multi_igen_configs: igen configuration strings.
+ # SIM_MIPS_MULTI_FLAGS: all -M and -F flags used by the simulator
+ # SIM_MIPS_MULTI_SRC: all makefile-generated source files
+ # SIM_MIPS_MULTI_OBJ: the objects for ${SIM_MIPS_MULTI_SRC}
+ # SIM_MIPS_MULTI_IGEN_CONFIGS: igen configuration strings.
#
- # Each entry in ${sim_multi_igen_configs} is a prefix (m32
+ # Each entry in ${SIM_MIPS_MULTI_IGEN_CONFIGS} is a prefix (m32
# or m16) followed by the NAME, MACHINE and FILTER part of
- # the ${sim_multi_configs} entry.
- sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
+ # the ${sim_mips_multi_configs} entry.
+ SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F ${filter} -M ${machine}"
# Check whether special handling is needed.
case ${c} in
@@ -207,9 +207,9 @@ __EOF__
# The top-level function for the mips16 simulator is
# in a file m16${name}_run.c, generated by the
# tmp-run-multi Makefile rule.
- sim_multi_src="${sim_multi_src} m16${name}_run.c"
- sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
- sim_multi_flags="${sim_multi_flags} -F 16"
+ SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} m16${name}_run.c"
+ SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} m16${name}_run.o"
+ SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16"
;;
*:*micromips32*:*)
# Run igen thrice, once for micromips32, once for micromips16,
@@ -219,9 +219,9 @@ __EOF__
# The top-level function for the micromips simulator is
# in a file micromips${name}_run.c, generated by the
# tmp-run-multi Makefile rule.
- sim_multi_src="${sim_multi_src} micromips${name}_run.c"
- sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
- sim_multi_flags="${sim_multi_flags} -F 16,32"
+ SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} micromips${name}_run.c"
+ SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} micromips${name}_run.o"
+ SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16,32"
;;
*:*micromips64*:*)
# Run igen thrice, once for micromips64, once for micromips16,
@@ -231,24 +231,24 @@ __EOF__
# The top-level function for the micromips simulator is
# in a file micromips${name}_run.c, generated by the
# tmp-run-multi Makefile rule.
- sim_multi_src="${sim_multi_src} micromips${name}_run.c"
- sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
- sim_multi_flags="${sim_multi_flags} -F 16,32,64"
+ SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} micromips${name}_run.c"
+ SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} micromips${name}_run.o"
+ SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16,32,64"
;;
*)
ws=m32
;;
esac
- # Now add the list of igen-generated files to ${sim_multi_src}
- # and ${sim_multi_obj}.
+ # Now add the list of igen-generated files to ${SIM_MIPS_MULTI_SRC}
+ # and ${SIM_MIPS_MULTI_OBJ}.
for w in ${ws}; do
for base in engine icache idecode model semantics support; do
- sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
- sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
- sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
+ SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} ${w}${name}_${base}.c"
+ SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} ${w}${name}_${base}.h"
+ SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} ${w}${name}_${base}.o"
done
- sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
+ SIM_MIPS_MULTI_IGEN_CONFIGS="${SIM_MIPS_MULTI_IGEN_CONFIGS} ${w}${c}"
done
# Add an include for the engine.h file. This file declares the
@@ -258,9 +258,9 @@ __EOF__
# Add case statements for this engine to sim_engine_run().
for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
echo " case bfd_mach_${mach}:" >> multi-run.c
- if test ${mach} = ${sim_multi_default}; then
+ if test ${mach} = ${sim_mips_multi_default}; then
echo " default:" >> multi-run.c
- sim_seen_default=yes
+ sim_mips_seen_default=yes
fi
done
echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
@@ -269,8 +269,8 @@ __EOF__
done
# Check whether we added a 'default:' label.
- if test ${sim_seen_default} = no; then
- AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
+ if test ${sim_mips_seen_default} = no; then
+ AC_MSG_ERROR(Error in configure.ac: \${sim_mips_multi_configs} doesn't have an entry for \${sim_mips_multi_default})
fi
cat << __EOF__ >> multi-run.c
@@ -279,20 +279,20 @@ __EOF__
__EOF__
else
# For clean-extra
- sim_multi_src=doesnt-exist.c
+ SIM_MIPS_MULTI_SRC=doesnt-exist.c
fi
-sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
-sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
-sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
-sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
-AC_SUBST(sim_igen_flags)
-AC_SUBST(sim_m16_flags)
-AC_SUBST(sim_micromips_flags)
-AC_SUBST(sim_micromips16_flags)
-AC_SUBST(sim_gen)
-AC_SUBST(sim_multi_flags)
-AC_SUBST(sim_multi_igen_configs)
-AC_SUBST(sim_multi_src)
-AC_SUBST(sim_multi_obj)
+SIM_MIPS_IGEN_FLAGS="-F ${sim_mips_igen_filter} ${sim_mips_igen_machine} ${sim_igen_smp}"
+SIM_MIPS_M16_FLAGS="-F ${sim_mips_m16_filter} ${sim_mips_m16_machine} ${sim_igen_smp}"
+SIM_MIPS_MICROMIPS16_FLAGS="-F ${sim_mips_micromips16_filter} ${sim_mips_micromips16_machine} ${sim_igen_smp}"
+SIM_MIPS_MICROMIPS_FLAGS="-F ${sim_mips_micromips_filter} ${sim_mips_micromips_machine} ${sim_igen_smp}"
+AC_SUBST(SIM_MIPS_IGEN_FLAGS)
+AC_SUBST(SIM_MIPS_M16_FLAGS)
+AC_SUBST(SIM_MIPS_MICROMIPS_FLAGS)
+AC_SUBST(SIM_MIPS_MICROMIPS16_FLAGS)
+AC_SUBST(SIM_MIPS_GEN)
+AC_SUBST(SIM_MIPS_MULTI_FLAGS)
+AC_SUBST(SIM_MIPS_MULTI_IGEN_CONFIGS)
+AC_SUBST(SIM_MIPS_MULTI_SRC)
+AC_SUBST(SIM_MIPS_MULTI_OBJ)
SIM_AC_OUTPUT
--
2.39.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] sim: mips: move igen settings to top-level configure
2022-12-25 3:16 [PATCH 1/3] sim: mips: namespace igen configure vars Mike Frysinger
@ 2022-12-25 3:16 ` Mike Frysinger
2022-12-25 3:16 ` [PATCH 3/3] sim: mips: clean up a bit after mips/configure removal Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2022-12-25 3:16 UTC (permalink / raw)
To: gdb-patches
This is the last bit of logic that exists in the mips configure
script, so move it to the top-level configure to kill it off.
We still have to move the Makefile.in igen logic to local.mk,
but this is a required first step for that.
---
sim/Makefile.in | 30 +-
sim/configure | 268 ++-
sim/configure.ac | 2 +-
sim/mips/acinclude-top.m4 | 278 ++++
sim/mips/aclocal.m4 | 15 -
sim/mips/configure | 3321 -------------------------------------
sim/mips/configure.ac | 298 ----
7 files changed, 560 insertions(+), 3652 deletions(-)
delete mode 100644 sim/mips/aclocal.m4
delete mode 100755 sim/mips/configure
delete mode 100644 sim/mips/configure.ac
diff --git a/sim/configure.ac b/sim/configure.ac
index a631d2b3a222..e17dd974303a 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -143,7 +143,7 @@ if test "${enable_sim}" != no; then
SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
SIM_TARGET([mcore-*-*], [mcore])
SIM_TARGET([microblaze*-*-*], [microblaze])
- SIM_TARGET([mips*-*-*], [mips], [true], [sim_igen=yes])
+ SIM_TARGET([mips*-*-*], [mips], [], [sim_igen=yes])
SIM_TARGET([mn10300*-*-*], [mn10300], [], [sim_igen=yes])
SIM_TARGET([moxie-*-*], [moxie])
SIM_TARGET([msp430*-*-*], [msp430])
diff --git a/sim/mips/acinclude-top.m4 b/sim/mips/acinclude-top.m4
index 612aa92a2b80..ca11a2784b36 100644
--- a/sim/mips/acinclude-top.m4
+++ b/sim/mips/acinclude-top.m4
@@ -59,3 +59,281 @@ AS_CASE([${target}],
[mips*-*-*], [SIM_MIPS_FPU_BITSIZE=32])
AC_MSG_RESULT([$SIM_MIPS_FPU_BITSIZE])
AC_SUBST(SIM_MIPS_FPU_BITSIZE)
+
+dnl Select the IGEN architecture.
+SIM_MIPS_GEN=IGEN
+sim_mips_igen_machine="-M mipsIV"
+sim_mips_m16_machine="-M mips16,mipsIII"
+sim_mips_igen_filter="32,64,f"
+sim_mips_m16_filter="16"
+AS_CASE([${target}],
+ [mips*tx39*], [dnl
+ SIM_MIPS_GEN=IGEN
+ sim_mips_igen_filter="32,f"
+ sim_mips_igen_machine="-M r3900"],
+ [mips64vr41*], [dnl
+ SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M vr4100"
+ sim_mips_m16_machine="-M vr4100"],
+ [mips64*], [dnl
+ SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
+ vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
+ vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
+ vr5000:mipsIV:32,64,f:mips4300,mips5000,mips8000\
+ vr5400:mipsIV,vr5400:32,64,f:mips5400\
+ vr5500:mipsIV,vr5500:32,64,f:mips5500"
+ sim_mips_multi_default=mips5000],
+ [mips*-sde-elf* | mips*-mti-elf*], [dnl
+ SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
+ micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
+ mipsisa64r2:mips64r2,mips16,mips16e,mdmx,dsp,dsp2,mips3d,smartmips:32,64,f:mipsisa32r2,mipsisa64r2,mipsisa32r5,mipsisa64r5\
+ mipsisa64r6:mips64r6:32,64,f:mipsisa32r6,mipsisa64r6"
+ sim_mips_multi_default=mipsisa64r2],
+ [mips16*], [dnl
+ SIM_MIPS_GEN=M16],
+ [mipsisa32r2*], [dnl
+ SIM_MIPS_GEN=MULTI
+ sim_mips_multi_configs="\
+ micromips:micromips32,micromipsdsp:32,f:mips_micromips\
+ mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
+ sim_mips_multi_default=mipsisa32r2],
+ [mipsisa32r6*], [dnl
+ SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips32r6"
+ sim_mips_igen_filter="32,f"],
+ [mipsisa32*], [dnl
+ SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips32,mips16,mips16e,smartmips"
+ sim_mips_m16_machine="-M mips16,mips16e,mips32"
+ sim_mips_igen_filter="32,f"],
+ [mipsisa64r2*], [dnl
+ SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
+ sim_mips_m16_machine="-M mips16,mips16e,mips64r2"],
+ [mipsisa64r6*], [dnl
+ SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips64r6"],
+ [mipsisa64sb1*], [dnl
+ SIM_MIPS_GEN=IGEN
+ sim_mips_igen_machine="-M mips64,mips3d,sb1"],
+ [mipsisa64*], [dnl
+ SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
+ sim_mips_m16_machine="-M mips16,mips16e,mips64"],
+ [mips*lsi*], [dnl
+ SIM_MIPS_GEN=M16
+ sim_mips_igen_machine="-M mipsIII,mips16"
+ sim_mips_m16_machine="-M mips16,mipsIII"
+ sim_mips_igen_filter="32,f"],
+ [mips*], [dnl
+ SIM_MIPS_GEN=IGEN
+ sim_mips_igen_filter="32,f"])
+
+dnl The MULTI generator can combine several simulation engines into one.
+dnl executable. A configuration which uses the MULTI should set two
+dnl variables: ${sim_mips_multi_configs} and ${sim_mips_multi_default}.
+dnl
+dnl ${sim_mips_multi_configs} is the list of engines to build. Each
+dnl space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
+dnl where:
+dnl
+dnl - NAME is a C-compatible prefix for the engine,
+dnl - MACHINE is a -M argument,
+dnl - FILTER is a -F argument, and
+dnl - BFDMACHS is a comma-separated list of bfd machines that the
+dnl simulator can run.
+dnl
+dnl Each entry will have a separate simulation engine whose prefix is
+dnl m32<NAME>. If the machine list includes "mips16", there will also
+dnl be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
+dnl generated using the same machine list as the 32-bit version,
+dnl but the filter will be "16" instead of FILTER.
+dnl
+dnl The simulator compares the bfd mach against BFDMACHS to decide
+dnl which engine to use. Entries in BFDMACHS should be bfd_mach
+dnl values with "bfd_mach_" removed. ${sim_mips_multi_default} says
+dnl which entry should be the default.
+SIM_MIPS_MULTI_FLAGS=
+SIM_MIPS_MULTI_SRC=
+SIM_MIPS_MULTI_OBJ=
+SIM_MIPS_MULTI_IGEN_CONFIGS=
+AS_VAR_IF([SIM_MIPS_GEN], ["MULTI"], [dnl
+ dnl Verify the AS_CASE logic above is setup correctly.
+ AS_IF([test -z "${sim_mips_multi_configs}" || test -z "${sim_mips_multi_default}"], [dnl
+ AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)])
+
+ dnl Start in a known state.
+ AS_MKDIR_P([mips])
+ rm -f mips/multi-include.h mips/multi-run.c
+ sim_mips_seen_default=no
+
+ cat << __EOF__ > mips/multi-run.c
+/* Main entry point for MULTI simulators.
+ Copyright (C) 2003-2022 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ --
+
+ This file was generated by sim/mips/configure. */
+
+#include "sim-main.h"
+#include "multi-include.h"
+#include "elf-bfd.h"
+#include "elfxx-mips.h"
+#include "elf/mips.h"
+
+#define SD sd
+#define CPU cpu
+
+void
+sim_engine_run (SIM_DESC sd,
+ int next_cpu_nr,
+ int nr_cpus,
+ int signal) /* ignore */
+{
+ int mach;
+
+ if (STATE_ARCHITECTURE (sd) == NULL)
+ mach = bfd_mach_${sim_mips_multi_default};
+ else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
+ & EF_MIPS_ARCH_ASE_MICROMIPS)
+ mach = bfd_mach_mips_micromips;
+ else
+ {
+ mach = _bfd_elf_mips_mach (elf_elfheader (STATE_PROG_BFD (sd))->e_flags);
+ if (!mach)
+ mach = STATE_ARCHITECTURE (SD)->mach;
+ }
+
+ switch (mach)
+ {
+__EOF__
+
+ for fc in ${sim_mips_multi_configs}; do
+
+ dnl Split up the entry. ${c} contains the first three elements.
+ dnl Note: outer sqaure brackets are m4 quotes.
+ c=`echo ${fc} | sed ['s/:[^:]*$//']`
+ bfdmachs=`echo ${fc} | sed 's/.*://'`
+ name=`echo ${c} | sed 's/:.*//'`
+ machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
+ filter=`echo ${c} | sed 's/.*://'`
+
+ dnl Build the following lists:
+ dnl
+ dnl SIM_MIPS_MULTI_FLAGS: all -M and -F flags used by the simulator
+ dnl SIM_MIPS_MULTI_SRC: all makefile-generated source files
+ dnl SIM_MIPS_MULTI_OBJ: the objects for ${SIM_MIPS_MULTI_SRC}
+ dnl SIM_MIPS_MULTI_IGEN_CONFIGS: igen configuration strings.
+ dnl
+ dnl Each entry in ${SIM_MIPS_MULTI_IGEN_CONFIGS} is a prefix (m32
+ dnl or m16) followed by the NAME, MACHINE and FILTER part of
+ dnl the ${sim_mips_multi_configs} entry.
+ AS_VAR_APPEND([SIM_MIPS_MULTI_FLAGS], [" -F ${filter} -M ${machine}"])
+
+ dnl Check whether special handling is needed.
+ AS_CASE([${c}],
+ [*:*mips16*:*], [dnl
+ dnl Run igen twice, once for normal mode and once for mips16.
+ ws="m32 m16"
+
+ dnl The top-level function for the mips16 simulator is
+ dnl in a file m16${name}_run.c, generated by the
+ dnl tmp-run-multi Makefile rule.
+ AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" m16${name}_run.c"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" m16${name}_run.o"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_FLAGS], [" -F 16"])
+ ],
+ [*:*micromips32*:*], [dnl
+ dnl Run igen thrice, once for micromips32, once for micromips16,
+ dnl and once for m32.
+ ws="micromips_m32 micromips16 micromips32"
+
+ dnl The top-level function for the micromips simulator is
+ dnl in a file micromips${name}_run.c, generated by the
+ dnl tmp-run-multi Makefile rule.
+ AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_FLAGS], [" -F 16,32"])
+ ],
+ [*:*micromips64*:*], [dnl
+ dnl Run igen thrice, once for micromips64, once for micromips16,
+ dnl and once for m64.
+ ws="micromips_m64 micromips16 micromips64"
+
+ dnl The top-level function for the micromips simulator is
+ dnl in a file micromips${name}_run.c, generated by the
+ dnl tmp-run-multi Makefile rule.
+ AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_FLAGS], [" -F 16,32,64"])
+ ],
+ [ws=m32])
+
+ dnl Now add the list of igen-generated files to ${SIM_MIPS_MULTI_SRC}
+ dnl and ${SIM_MIPS_MULTI_OBJ}.
+ for w in ${ws}; do
+ for base in engine icache idecode model semantics support; do
+ AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.c"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.h"])
+ AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" ${w}${name}_${base}.o"])
+ done
+ AS_VAR_APPEND([SIM_MIPS_MULTI_IGEN_CONFIGS], [" ${w}${c}"])
+ done
+
+ dnl Add an include for the engine.h file. This file declares the
+ dnl top-level foo_engine_run() function.
+ echo "#include \"${w}${name}_engine.h\"" >> mips/multi-include.h
+
+ dnl Add case statements for this engine to sim_engine_run().
+ for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
+ echo " case bfd_mach_${mach}:" >> mips/multi-run.c
+ AS_VAR_IF([mach], ["${sim_mips_multi_default}"], [dnl
+ echo " default:" >> mips/multi-run.c
+ sim_mips_seen_default=yes
+ ])
+ done
+ echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
+ >> mips/multi-run.c
+ echo " break;" >> mips/multi-run.c
+ done
+
+ dnl Check whether we added a 'default:' label.
+ AS_VAR_IF([sim_mips_seen_default], [no], [dnl
+ AC_MSG_ERROR(Error in configure.ac: \${sim_mips_multi_configs} doesn't have an entry for \${sim_mips_multi_default})])
+
+ cat << __EOF__ >> mips/multi-run.c
+ }
+}
+__EOF__
+], [dnl
+ dnl For clean-extra target.
+ SIM_MIPS_MULTI_SRC=doesnt-exist.c
+])
+SIM_MIPS_IGEN_FLAGS="-F ${sim_mips_igen_filter} ${sim_mips_igen_machine} ${sim_igen_smp}"
+SIM_MIPS_M16_FLAGS="-F ${sim_mips_m16_filter} ${sim_mips_m16_machine} ${sim_igen_smp}"
+SIM_MIPS_MICROMIPS16_FLAGS="-F ${sim_mips_micromips16_filter} ${sim_mips_micromips16_machine} ${sim_igen_smp}"
+SIM_MIPS_MICROMIPS_FLAGS="-F ${sim_mips_micromips_filter} ${sim_mips_micromips_machine} ${sim_igen_smp}"
+AC_SUBST(SIM_MIPS_IGEN_FLAGS)
+AC_SUBST(SIM_MIPS_M16_FLAGS)
+AC_SUBST(SIM_MIPS_MICROMIPS_FLAGS)
+AC_SUBST(SIM_MIPS_MICROMIPS16_FLAGS)
+AC_SUBST(SIM_MIPS_GEN)
+AC_SUBST(SIM_MIPS_MULTI_FLAGS)
+AC_SUBST(SIM_MIPS_MULTI_IGEN_CONFIGS)
+AC_SUBST(SIM_MIPS_MULTI_SRC)
+AC_SUBST(SIM_MIPS_MULTI_OBJ)
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
deleted file mode 100644
index 7059db459b11..000000000000
--- a/sim/mips/configure.ac
+++ /dev/null
@@ -1,298 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(Makefile.in)
-AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-
-dnl The sim shouldn't be checking $target and changing behavior. But it is,
-dnl and until we clean that up, we need to expand --target for use below.
-AC_CANONICAL_SYSTEM
-
-#
-# Select the IGEN architecture
-#
-SIM_MIPS_GEN=IGEN
-sim_mips_igen_machine="-M mipsIV"
-sim_mips_m16_machine="-M mips16,mipsIII"
-sim_mips_igen_filter="32,64,f"
-sim_mips_m16_filter="16"
-
-case "${target}" in
- mips*tx39*) SIM_MIPS_GEN=IGEN
- sim_mips_igen_filter="32,f"
- sim_mips_igen_machine="-M r3900"
- ;;
- mips64vr41*) SIM_MIPS_GEN=M16
- sim_mips_igen_machine="-M vr4100"
- sim_mips_m16_machine="-M vr4100"
- ;;
- mips64*)
- SIM_MIPS_GEN=MULTI
- sim_mips_multi_configs="\
- vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
- vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
- vr5000:mipsIV:32,64,f:mips4300,mips5000,mips8000\
- vr5400:mipsIV,vr5400:32,64,f:mips5400\
- vr5500:mipsIV,vr5500:32,64,f:mips5500"
- sim_mips_multi_default=mips5000
- ;;
- mips*-sde-elf* | mips*-mti-elf*)
- SIM_MIPS_GEN=MULTI
- sim_mips_multi_configs="\
- micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
- mipsisa64r2:mips64r2,mips16,mips16e,mdmx,dsp,dsp2,mips3d,smartmips:32,64,f:mipsisa32r2,mipsisa64r2,mipsisa32r5,mipsisa64r5\
- mipsisa64r6:mips64r6:32,64,f:mipsisa32r6,mipsisa64r6"
- sim_mips_multi_default=mipsisa64r2
- ;;
- mips16*) SIM_MIPS_GEN=M16
- ;;
- mipsisa32r2*) SIM_MIPS_GEN=MULTI
- sim_mips_multi_configs="\
- micromips:micromips32,micromipsdsp:32,f:mips_micromips\
- mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
- sim_mips_multi_default=mipsisa32r2
- ;;
- mipsisa32r6*) SIM_MIPS_GEN=IGEN
- sim_mips_igen_machine="-M mips32r6"
- sim_mips_igen_filter="32,f"
- ;;
- mipsisa32*) SIM_MIPS_GEN=M16
- sim_mips_igen_machine="-M mips32,mips16,mips16e,smartmips"
- sim_mips_m16_machine="-M mips16,mips16e,mips32"
- sim_mips_igen_filter="32,f"
- ;;
- mipsisa64r2*) SIM_MIPS_GEN=M16
- sim_mips_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
- sim_mips_m16_machine="-M mips16,mips16e,mips64r2"
- ;;
- mipsisa64r6*) SIM_MIPS_GEN=IGEN
- sim_mips_igen_machine="-M mips64r6"
- ;;
- mipsisa64sb1*) SIM_MIPS_GEN=IGEN
- sim_mips_igen_machine="-M mips64,mips3d,sb1"
- ;;
- mipsisa64*) SIM_MIPS_GEN=M16
- sim_mips_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
- sim_mips_m16_machine="-M mips16,mips16e,mips64"
- ;;
- mips*lsi*) SIM_MIPS_GEN=M16
- sim_mips_igen_machine="-M mipsIII,mips16"
- sim_mips_m16_machine="-M mips16,mipsIII"
- sim_mips_igen_filter="32,f"
- ;;
- mips*) SIM_MIPS_GEN=IGEN
- sim_mips_igen_filter="32,f"
- ;;
-esac
-
-# The MULTI generator can combine several simulation engines into one.
-# executable. A configuration which uses the MULTI should set two
-# variables: ${sim_mips_multi_configs} and ${sim_mips_multi_default}.
-#
-# ${sim_mips_multi_configs} is the list of engines to build. Each
-# space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
-# where:
-#
-# - NAME is a C-compatible prefix for the engine,
-# - MACHINE is a -M argument,
-# - FILTER is a -F argument, and
-# - BFDMACHS is a comma-separated list of bfd machines that the
-# simulator can run.
-#
-# Each entry will have a separate simulation engine whose prefix is
-# m32<NAME>. If the machine list includes "mips16", there will also
-# be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
-# generated using the same machine list as the 32-bit version,
-# but the filter will be "16" instead of FILTER.
-#
-# The simulator compares the bfd mach against BFDMACHS to decide
-# which engine to use. Entries in BFDMACHS should be bfd_mach
-# values with "bfd_mach_" removed. ${sim_mips_multi_default} says
-# which entry should be the default.
-SIM_MIPS_MULTI_FLAGS=
-SIM_MIPS_MULTI_SRC=
-SIM_MIPS_MULTI_OBJ=
-SIM_MIPS_MULTI_IGEN_CONFIGS=
-if test ${SIM_MIPS_GEN} = MULTI; then
-
- # Simple sanity check.
- if test -z "${sim_mips_multi_configs}" || test -z "${sim_mips_multi_default}"; then
- AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
- fi
-
- # Start in a known state.
- rm -f multi-include.h multi-run.c
- sim_mips_seen_default=no
-
- cat << __EOF__ > multi-run.c
-/* Main entry point for MULTI simulators.
- Copyright (C) 2003-2022 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- --
-
- This file was generated by sim/mips/configure. */
-
-#include "sim-main.h"
-#include "multi-include.h"
-#include "elf-bfd.h"
-#include "elfxx-mips.h"
-#include "elf/mips.h"
-
-#define SD sd
-#define CPU cpu
-
-void
-sim_engine_run (SIM_DESC sd,
- int next_cpu_nr,
- int nr_cpus,
- int signal) /* ignore */
-{
- int mach;
-
- if (STATE_ARCHITECTURE (sd) == NULL)
- mach = bfd_mach_${sim_mips_multi_default};
- else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
- & EF_MIPS_ARCH_ASE_MICROMIPS)
- mach = bfd_mach_mips_micromips;
- else
- {
- mach = _bfd_elf_mips_mach (elf_elfheader (STATE_PROG_BFD (sd))->e_flags);
- if (!mach)
- mach = STATE_ARCHITECTURE (SD)->mach;
- }
-
- switch (mach)
- {
-__EOF__
-
- for fc in ${sim_mips_multi_configs}; do
-
- # Split up the entry. ${c} contains the first three elements.
- # Note: outer sqaure brackets are m4 quotes.
- c=`echo ${fc} | sed ['s/:[^:]*$//']`
- bfdmachs=`echo ${fc} | sed 's/.*://'`
- name=`echo ${c} | sed 's/:.*//'`
- machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
- filter=`echo ${c} | sed 's/.*://'`
-
- # Build the following lists:
- #
- # SIM_MIPS_MULTI_FLAGS: all -M and -F flags used by the simulator
- # SIM_MIPS_MULTI_SRC: all makefile-generated source files
- # SIM_MIPS_MULTI_OBJ: the objects for ${SIM_MIPS_MULTI_SRC}
- # SIM_MIPS_MULTI_IGEN_CONFIGS: igen configuration strings.
- #
- # Each entry in ${SIM_MIPS_MULTI_IGEN_CONFIGS} is a prefix (m32
- # or m16) followed by the NAME, MACHINE and FILTER part of
- # the ${sim_mips_multi_configs} entry.
- SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F ${filter} -M ${machine}"
-
- # Check whether special handling is needed.
- case ${c} in
- *:*mips16*:*)
- # Run igen twice, once for normal mode and once for mips16.
- ws="m32 m16"
-
- # The top-level function for the mips16 simulator is
- # in a file m16${name}_run.c, generated by the
- # tmp-run-multi Makefile rule.
- SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} m16${name}_run.c"
- SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} m16${name}_run.o"
- SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16"
- ;;
- *:*micromips32*:*)
- # Run igen thrice, once for micromips32, once for micromips16,
- # and once for m32.
- ws="micromips_m32 micromips16 micromips32"
-
- # The top-level function for the micromips simulator is
- # in a file micromips${name}_run.c, generated by the
- # tmp-run-multi Makefile rule.
- SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} micromips${name}_run.c"
- SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} micromips${name}_run.o"
- SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16,32"
- ;;
- *:*micromips64*:*)
- # Run igen thrice, once for micromips64, once for micromips16,
- # and once for m64.
- ws="micromips_m64 micromips16 micromips64"
-
- # The top-level function for the micromips simulator is
- # in a file micromips${name}_run.c, generated by the
- # tmp-run-multi Makefile rule.
- SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} micromips${name}_run.c"
- SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} micromips${name}_run.o"
- SIM_MIPS_MULTI_FLAGS="${SIM_MIPS_MULTI_FLAGS} -F 16,32,64"
- ;;
- *)
- ws=m32
- ;;
- esac
-
- # Now add the list of igen-generated files to ${SIM_MIPS_MULTI_SRC}
- # and ${SIM_MIPS_MULTI_OBJ}.
- for w in ${ws}; do
- for base in engine icache idecode model semantics support; do
- SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} ${w}${name}_${base}.c"
- SIM_MIPS_MULTI_SRC="${SIM_MIPS_MULTI_SRC} ${w}${name}_${base}.h"
- SIM_MIPS_MULTI_OBJ="${SIM_MIPS_MULTI_OBJ} ${w}${name}_${base}.o"
- done
- SIM_MIPS_MULTI_IGEN_CONFIGS="${SIM_MIPS_MULTI_IGEN_CONFIGS} ${w}${c}"
- done
-
- # Add an include for the engine.h file. This file declares the
- # top-level foo_engine_run() function.
- echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
-
- # Add case statements for this engine to sim_engine_run().
- for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
- echo " case bfd_mach_${mach}:" >> multi-run.c
- if test ${mach} = ${sim_mips_multi_default}; then
- echo " default:" >> multi-run.c
- sim_mips_seen_default=yes
- fi
- done
- echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
- >> multi-run.c
- echo " break;" >> multi-run.c
- done
-
- # Check whether we added a 'default:' label.
- if test ${sim_mips_seen_default} = no; then
- AC_MSG_ERROR(Error in configure.ac: \${sim_mips_multi_configs} doesn't have an entry for \${sim_mips_multi_default})
- fi
-
- cat << __EOF__ >> multi-run.c
- }
-}
-__EOF__
-else
- # For clean-extra
- SIM_MIPS_MULTI_SRC=doesnt-exist.c
-fi
-SIM_MIPS_IGEN_FLAGS="-F ${sim_mips_igen_filter} ${sim_mips_igen_machine} ${sim_igen_smp}"
-SIM_MIPS_M16_FLAGS="-F ${sim_mips_m16_filter} ${sim_mips_m16_machine} ${sim_igen_smp}"
-SIM_MIPS_MICROMIPS16_FLAGS="-F ${sim_mips_micromips16_filter} ${sim_mips_micromips16_machine} ${sim_igen_smp}"
-SIM_MIPS_MICROMIPS_FLAGS="-F ${sim_mips_micromips_filter} ${sim_mips_micromips_machine} ${sim_igen_smp}"
-AC_SUBST(SIM_MIPS_IGEN_FLAGS)
-AC_SUBST(SIM_MIPS_M16_FLAGS)
-AC_SUBST(SIM_MIPS_MICROMIPS_FLAGS)
-AC_SUBST(SIM_MIPS_MICROMIPS16_FLAGS)
-AC_SUBST(SIM_MIPS_GEN)
-AC_SUBST(SIM_MIPS_MULTI_FLAGS)
-AC_SUBST(SIM_MIPS_MULTI_IGEN_CONFIGS)
-AC_SUBST(SIM_MIPS_MULTI_SRC)
-AC_SUBST(SIM_MIPS_MULTI_OBJ)
-
-SIM_AC_OUTPUT
--
2.39.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] sim: mips: clean up a bit after mips/configure removal
2022-12-25 3:16 [PATCH 1/3] sim: mips: namespace igen configure vars Mike Frysinger
2022-12-25 3:16 ` [PATCH 2/3] sim: mips: move igen settings to top-level configure Mike Frysinger
@ 2022-12-25 3:16 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2022-12-25 3:16 UTC (permalink / raw)
To: gdb-patches
Now that there is no subdir configure script, we can clean up some
logic that was spread between the files.
---
sim/Makefile.in | 3 +--
sim/arch-subdir.mk.in | 5 -----
sim/configure.ac | 2 +-
sim/mips/Makefile.in | 6 +++---
sim/mips/{acinclude-top.m4 => acinclude.m4} | 2 --
5 files changed, 5 insertions(+), 13 deletions(-)
rename sim/mips/{acinclude-top.m4 => acinclude.m4} (99%)
diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index 8964b1d99329..cfde3f3fb785 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -73,8 +73,3 @@ SIM_INLINE = @SIM_INLINE@
SIM_HW_CFLAGS = @SIM_HW_CFLAGS@
SIM_HW_OBJS = $(SIM_HW_DEVICES:%=dv-%.o)
@SIM_ENABLE_HW_FALSE@SIM_HW_OBJS =
-
-# This can be removed once mips/configure is gone.
-SIM_MIPS_SUBTARGET = @SIM_MIPS_SUBTARGET@
-SIM_MIPS_BITSIZE = -DWITH_TARGET_WORD_BITSIZE=@SIM_MIPS_BITSIZE@ -DWITH_TARGET_WORD_MSB=WITH_TARGET_WORD_BITSIZE-1
-SIM_MIPS_FPU_BITSIZE = @SIM_MIPS_FPU_BITSIZE@
diff --git a/sim/configure.ac b/sim/configure.ac
index e17dd974303a..bfcd9e59d10e 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -203,7 +203,7 @@ AC_SUBST(sim_float)
dnl Some arches have unique configure flags.
m4_include([frv/acinclude.m4])
-m4_include([mips/acinclude-top.m4])
+m4_include([mips/acinclude.m4])
m4_include([riscv/acinclude.m4])
m4_include([rx/acinclude.m4])
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index 0e2f1057530d..c287a632ae73 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -77,10 +77,10 @@ SIM_OBJS = \
sim-resume.o \
# List of flags to always pass to $(CC).
-SIM_EXTRA_CFLAGS = $(SIM_MIPS_SUBTARGET)
+SIM_EXTRA_CFLAGS = @SIM_MIPS_SUBTARGET@
-SIM_BITSIZE = $(SIM_MIPS_BITSIZE)
-SIM_FLOAT = -DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=$(SIM_MIPS_FPU_BITSIZE)
+SIM_BITSIZE = -DWITH_TARGET_WORD_BITSIZE=@SIM_MIPS_BITSIZE@ -DWITH_TARGET_WORD_MSB=WITH_TARGET_WORD_BITSIZE-1
+SIM_FLOAT = -DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=@SIM_MIPS_FPU_BITSIZE@
SIM_EXTRA_CLEAN = clean-extra
SIM_EXTRA_DISTCLEAN = distclean-extra
diff --git a/sim/mips/acinclude-top.m4 b/sim/mips/acinclude.m4
similarity index 99%
rename from sim/mips/acinclude-top.m4
rename to sim/mips/acinclude.m4
index ca11a2784b36..0a8bf97ba854 100644
--- a/sim/mips/acinclude-top.m4
+++ b/sim/mips/acinclude.m4
@@ -1,5 +1,3 @@
-dnl TODO: Rename this to acinclude.m4 once mips/configure is removed.
-dnl
dnl Copyright (C) 2005-2022 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
--
2.39.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-25 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-25 3:16 [PATCH 1/3] sim: mips: namespace igen configure vars Mike Frysinger
2022-12-25 3:16 ` [PATCH 2/3] sim: mips: move igen settings to top-level configure Mike Frysinger
2022-12-25 3:16 ` [PATCH 3/3] sim: mips: clean up a bit after mips/configure removal Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).