[PATCH] sim: unify scache settings
Mike Frysinger
vapier@gentoo.org
Wed Jun 30 17:00:12 GMT 2021
The cgen scache module is enabled by every cgen port, and with the
same default value of 16k (which matches the common default value).
Let's pull this option out of the individual ports (via CPPFLAGS)
and into the common code (via config.h).
The object itself is compiled only for cgen ports atm, so that part
doesn't change. The scache code is initialized dynamically via the
modules.c logic. That's why the profile code needs an additional
CGEN_ARCH check.
This will allow us to collapse arch configure files more. Merging
the source files will require more future work, but integrating the
cgen & non-cgen worlds itself will take a lot.
---
sim/Makefile.in | 2 +-
sim/aclocal.m4 | 1 +
sim/bpf/aclocal.m4 | 1 -
sim/bpf/configure | 24 ------------------------
sim/bpf/configure.ac | 1 -
sim/common/Make-common.in | 2 --
sim/common/cgen-scache.h | 4 ----
sim/common/sim-profile.c | 4 ++--
sim/config.h.in | 3 +++
sim/configure | 30 ++++++++++++++++++++++++++----
sim/configure.ac | 2 +-
sim/cris/aclocal.m4 | 1 -
sim/cris/configure | 32 +-------------------------------
sim/cris/configure.ac | 2 --
sim/frv/aclocal.m4 | 1 -
sim/frv/configure | 27 +--------------------------
sim/frv/configure.ac | 2 --
sim/iq2000/aclocal.m4 | 1 -
sim/iq2000/configure | 32 +-------------------------------
sim/iq2000/configure.ac | 2 --
sim/lm32/aclocal.m4 | 1 -
sim/lm32/configure | 32 +-------------------------------
sim/lm32/configure.ac | 2 --
sim/m32r/aclocal.m4 | 1 -
sim/m32r/configure | 32 +-------------------------------
sim/m32r/configure.ac | 2 --
sim/m4/sim_ac_option_scache.m4 | 24 ++++++++++--------------
sim/m4/sim_ac_output.m4 | 1 -
sim/mips/configure | 2 --
sim/mn10300/configure | 2 --
sim/or1k/aclocal.m4 | 1 -
sim/or1k/configure | 24 ------------------------
sim/or1k/configure.ac | 1 -
sim/riscv/configure | 2 --
sim/v850/configure | 2 --
35 files changed, 49 insertions(+), 254 deletions(-)
diff --git a/sim/bpf/configure.ac b/sim/bpf/configure.ac
index 9cbd202d590d..87654ec6a919 100644
--- a/sim/bpf/configure.ac
+++ b/sim/bpf/configure.ac
@@ -3,6 +3,5 @@ AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
SIM_AC_OPTION_BITSIZE([64])
-SIM_AC_OPTION_SCACHE(16384)
SIM_AC_OUTPUT
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 992fd7f8a6ef..e7c1cce46f41 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -75,7 +75,6 @@ SHELL = @SHELL@
SIM_BITSIZE = @sim_bitsize@
SIM_FLOAT = @sim_float@
SIM_RESERVED_BITS = @sim_reserved_bits@
-SIM_SCACHE = @sim_scache@
SIM_WARN_CFLAGS = $(WARN_CFLAGS)
SIM_WERROR_CFLAGS = $(WERROR_CFLAGS)
@@ -199,7 +198,6 @@ CONFIG_CFLAGS = \
$(SIM_HW_CFLAGS) \
$(SIM_INLINE) \
$(SIM_RESERVED_BITS) \
- $(SIM_SCACHE) \
$(SIM_WARN_CFLAGS) \
$(SIM_WERROR_CFLAGS) \
$(SIM_HARDWARE)
diff --git a/sim/common/cgen-scache.h b/sim/common/cgen-scache.h
index b43528101abe..70ea0907d824 100644
--- a/sim/common/cgen-scache.h
+++ b/sim/common/cgen-scache.h
@@ -20,10 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef CGEN_SCACHE_H
#define CGEN_SCACHE_H
-#ifndef WITH_SCACHE
-#define WITH_SCACHE 0
-#endif
-
/* When caching bb's, instructions are extracted into "chains".
SCACHE_MAP is a hash table into these chains. */
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index 3a8ed1f2567f..1459ae70ab28 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -1152,7 +1152,7 @@ profile_info (SIM_DESC sd, int verbose)
#if WITH_PROFILE_MODEL_P
|| PROFILE_FLAGS (data) [PROFILE_MODEL_IDX]
#endif
-#if WITH_PROFILE_SCACHE_P && WITH_SCACHE
+#if WITH_PROFILE_SCACHE_P && WITH_SCACHE && defined(CGEN_ARCH)
|| PROFILE_FLAGS (data) [PROFILE_SCACHE_IDX]
#endif
#if WITH_PROFILE_PC_P
@@ -1190,7 +1190,7 @@ profile_info (SIM_DESC sd, int verbose)
profile_print_model (cpu, verbose);
#endif
-#if WITH_PROFILE_SCACHE_P && WITH_SCACHE
+#if WITH_PROFILE_SCACHE_P && WITH_SCACHE && defined(CGEN_ARCH)
if (PROFILE_FLAGS (data) [PROFILE_SCACHE_IDX])
scache_print_profile (cpu, verbose);
#endif
diff --git a/sim/configure.ac b/sim/configure.ac
index c2a724b61386..7e6d01360b6e 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -161,6 +161,7 @@ SIM_AC_OPTION_ENVIRONMENT
SIM_AC_OPTION_HARDWARE
SIM_AC_OPTION_INLINE
SIM_AC_OPTION_PROFILE
+SIM_AC_OPTION_SCACHE
SIM_AC_OPTION_STDIO
SIM_AC_OPTION_TRACE
SIM_AC_OPTION_WARNINGS
@@ -171,7 +172,6 @@ dnl when the rest of the code is in the respective macros. Once we merge the
dnl respective SIM_AC_OPTION_xxx call above, we can drop these.
AC_SUBST(sim_bitsize)
AC_SUBST(sim_float)
-AC_SUBST(sim_scache)
AC_SUBST(sim_reserved_bits)
dnl Some arches have unique configure flags.
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index d2037221bfee..99370b3a5770 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -2,6 +2,4 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-SIM_AC_OPTION_SCACHE(16384)
-
SIM_AC_OUTPUT
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index 785a3bc1cc23..883bb62001fb 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -2,8 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-SIM_AC_OPTION_SCACHE(16384)
-
#
# Enable making unknown traps dump out registers
#
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index d2037221bfee..99370b3a5770 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -2,6 +2,4 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-SIM_AC_OPTION_SCACHE(16384)
-
SIM_AC_OUTPUT
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index d2037221bfee..99370b3a5770 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -2,6 +2,4 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-SIM_AC_OPTION_SCACHE(16384)
-
SIM_AC_OUTPUT
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index eed2e91c87a7..d8054034abcb 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -2,8 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-SIM_AC_OPTION_SCACHE(16384)
-
case "${target_alias}" in
m32r*-linux*)
traps_obj=traps-linux.o
diff --git a/sim/m4/sim_ac_option_scache.m4 b/sim/m4/sim_ac_option_scache.m4
index 20e36158f909..7ae883fd7da2 100644
--- a/sim/m4/sim_ac_option_scache.m4
+++ b/sim/m4/sim_ac_option_scache.m4
@@ -12,23 +12,19 @@ dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
-dnl
-dnl The argument is the default cache size if none is specified.
AC_DEFUN([SIM_AC_OPTION_SCACHE],
-[
-default_sim_scache="ifelse([$1],,0,[$1])"
+[dnl
+AC_MSG_CHECKING([for sim cache size])
+sim_scache="16384"
AC_ARG_ENABLE(sim-scache,
[AS_HELP_STRING([--enable-sim-scache=size],
[Specify simulator execution cache size])],
[case "${enableval}" in
- yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
- no) sim_scache="-DWITH_SCACHE=0" ;;
- [[0-9]]*) sim_scache="-DWITH_SCACHE=${enableval}";;
- *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
- sim_scache="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
- echo "Setting scache size = $sim_scache" 6>&1
-fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
+ yes) ;;
+ no) sim_scache="0";;
+ [[0-9]]*) sim_scache="${enableval}";;
+ *) AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");;
+esac])
+AC_DEFINE_UNQUOTED([WITH_SCACHE], [$sim_scache], [Sim cache szie])
+AC_MSG_RESULT($sim_scache)
])
-AC_SUBST(sim_scache)
diff --git a/sim/m4/sim_ac_output.m4 b/sim/m4/sim_ac_output.m4
index 100e2f9b4024..3866213b91fe 100644
--- a/sim/m4/sim_ac_output.m4
+++ b/sim/m4/sim_ac_output.m4
@@ -47,7 +47,6 @@ dnl but always used by common/Make-common.in. So we have to subst here even
dnl when the rest of the code is in the respective macros.
AC_SUBST(sim_bitsize)
AC_SUBST(sim_float)
-AC_SUBST(sim_scache)
AC_SUBST(sim_reserved_bits)
dnl Used by common/Make-common.in to see which configure script created it.
diff --git a/sim/or1k/configure.ac b/sim/or1k/configure.ac
index aaeb12135654..4a989e3fc4f3 100644
--- a/sim/or1k/configure.ac
+++ b/sim/or1k/configure.ac
@@ -3,6 +3,5 @@ AC_INIT(Makefile.in)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
SIM_AC_OPTION_BITSIZE([32], [31], [32])
-SIM_AC_OPTION_SCACHE(16384)
SIM_AC_OUTPUT
--
2.31.1
More information about the Gdb-patches
mailing list