sim: mips: move bitsize defines to top-level configure
authorMike Frysinger <vapier@gentoo.org>
Fri, 11 Nov 2022 08:57:55 +0000 (15:57 +0700)
committerMike Frysinger <vapier@gentoo.org>
Thu, 22 Dec 2022 03:27:12 +0000 (22:27 -0500)
Since the msb value is always defined as the wordsize-1, stop
hardcoding that value directly, and use a CPP value instead.

sim/Makefile.in
sim/arch-subdir.mk.in
sim/configure
sim/mips/Makefile.in
sim/mips/acinclude-top.m4
sim/mips/aclocal.m4
sim/mips/configure
sim/mips/configure.ac

index a1483457ba4cd02fa8405e078a74fd3bb73d3aea..da5af94988eaa486efb0bfc20d668738634e0b11 100644 (file)
@@ -1106,6 +1106,7 @@ SIM_FRV_TRAPDUMP_FLAGS = @SIM_FRV_TRAPDUMP_FLAGS@
 SIM_HW_CFLAGS = @SIM_HW_CFLAGS@
 SIM_HW_SOCKSER = @SIM_HW_SOCKSER@
 SIM_INLINE = @SIM_INLINE@
+SIM_MIPS_BITSIZE = @SIM_MIPS_BITSIZE@
 SIM_MIPS_SUBTARGET = @SIM_MIPS_SUBTARGET@
 SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
 SIM_RISCV_BITSIZE = @SIM_RISCV_BITSIZE@
index ca2d2417ec6a8b41f2e48720223ffcdbc548ed87..c98a39ed2d7e47cb68e967e60eaa5a9ffff420c8 100644 (file)
@@ -76,3 +76,4 @@ SIM_HW_OBJS = $(SIM_HW_DEVICES:%=dv-%.o)
 
 # 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
index bf81c8326960a9dc8da25ca0089f9624642ba5a7..c818c106111a68e38e0493c0a6a525069c0b0940 100755 (executable)
@@ -641,6 +641,7 @@ LTLIBOBJS
 include_makefile
 SIM_RX_CYCLE_ACCURATE_FLAGS
 SIM_RISCV_BITSIZE
+SIM_MIPS_BITSIZE
 SIM_MIPS_SUBTARGET
 SIM_FRV_TRAPDUMP_FLAGS
 sim_float
@@ -12432,7 +12433,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12435 "configure"
+#line 12436 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12538,7 +12539,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12541 "configure"
+#line 12542 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16301,6 +16302,31 @@ esac
 $as_echo "${SIM_MIPS_SUBTARGET:-none}" >&6; }
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking mips bitsize" >&5
+$as_echo_n "checking mips bitsize... " >&6; }
+SIM_MIPS_BITSIZE=64
+case ${target} in #(
+  mips*-sde-elf*) :
+    SIM_MIPS_BITSIZE=64 ;; #(
+  mips*-mti-elf*) :
+    SIM_MIPS_BITSIZE=64 ;; #(
+  mips64*-*-*) :
+    SIM_MIPS_BITSIZE=64 ;; #(
+  mips16*-*-*) :
+    SIM_MIPS_BITSIZE=64 ;; #(
+  mipsisa32*-*-*) :
+    SIM_MIPS_BITSIZE=32 ;; #(
+  mipsisa64*-*-*) :
+    SIM_MIPS_BITSIZE=64 ;; #(
+  mips*-*-*) :
+    SIM_MIPS_BITSIZE=32 ;; #(
+  *) :
+     ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SIM_MIPS_BITSIZE" >&5
+$as_echo "$SIM_MIPS_BITSIZE" >&6; }
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking riscv bitsize" >&5
 $as_echo_n "checking riscv bitsize... " >&6; }
 SIM_RISCV_BITSIZE=64
index d8d50eaabd71a5c63057f84abb397e063ec9a3a9..328c191507349e88913a9f19de69a82c2e7f9032 100644 (file)
@@ -69,6 +69,8 @@ SIM_OBJS = \
 # List of flags to always pass to $(CC).
 SIM_EXTRA_CFLAGS = $(SIM_MIPS_SUBTARGET)
 
+SIM_BITSIZE = $(SIM_MIPS_BITSIZE)
+
 SIM_EXTRA_CLEAN = clean-extra
 SIM_EXTRA_DISTCLEAN = distclean-extra
 
index 4eb6c19f812372c51b5f5b1d5e3e0484e648a7ca..2d53bee13576a0a50bf3de219a53d12b877dbd9f 100644 (file)
@@ -32,3 +32,17 @@ AS_CASE([${target}],
   [mipsisa64*-*-*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"])
 AC_MSG_RESULT([${SIM_MIPS_SUBTARGET:-none}])
 AC_SUBST(SIM_MIPS_SUBTARGET)
+
+dnl Select the bitsize of the target.
+AC_MSG_CHECKING([mips bitsize])
+SIM_MIPS_BITSIZE=64
+AS_CASE([${target}],
+  [mips*-sde-elf*], [SIM_MIPS_BITSIZE=64],
+  [mips*-mti-elf*], [SIM_MIPS_BITSIZE=64],
+  [mips64*-*-*],    [SIM_MIPS_BITSIZE=64],
+  [mips16*-*-*],    [SIM_MIPS_BITSIZE=64],
+  [mipsisa32*-*-*], [SIM_MIPS_BITSIZE=32],
+  [mipsisa64*-*-*], [SIM_MIPS_BITSIZE=64],
+  [mips*-*-*],      [SIM_MIPS_BITSIZE=32])
+AC_MSG_RESULT([$SIM_MIPS_BITSIZE])
+AC_SUBST(SIM_MIPS_BITSIZE)
index 247e9dbf3339c85357bd9c9b003c449a35ddbc16..6d4e93ea5c6d17756378c0da2f0cc5a2fa59df0c 100644 (file)
@@ -12,6 +12,5 @@
 # PARTICULAR PURPOSE.
 
 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
-m4_include([../m4/sim_ac_option_bitsize.m4])
 m4_include([../m4/sim_ac_option_float.m4])
 m4_include([../m4/sim_ac_output.m4])
index 70939f9851a2caff857fef462a05907a7cd42ff8..7d80b506482c0fe72b7213f815d22d4e4e270fd3 100755 (executable)
@@ -586,6 +586,7 @@ ac_subst_vars='LTLIBOBJS
 LIBOBJS
 SIM_COMMON_BUILD_FALSE
 SIM_COMMON_BUILD_TRUE
+sim_bitsize
 sim_multi_obj
 sim_multi_src
 sim_multi_igen_configs
@@ -645,12 +646,10 @@ PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
 SHELL
-sim_float
-sim_bitsize'
+sim_float'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-enable_sim_bitsize
 enable_sim_float
 '
       ac_precious_vars='build_alias
@@ -1268,7 +1267,6 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-sim-bitsize=N  Specify target bitsize (32 or 64)
   --enable-sim-float      Specify that the target processor has floating point
                           hardware
 
@@ -1843,81 +1841,6 @@ test -n "$target_alias" &&
   program_prefix=${target_alias}-
 
 
-#
-# Select the bitsize of the target
-#
-case "${target}" in
-  mips*-sde-elf*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips*-mti-elf*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips64*-*-*)          mips_bitsize=64 ; mips_msb=63 ;;
-  mips16*-*-*)          mips_bitsize=64 ; mips_msb=63 ;;
-  mipsisa32*-*-*)       mips_bitsize=32 ; mips_msb=31 ;;
-  mipsisa64*-*-*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips*-*-*)            mips_bitsize=32 ; mips_msb=31 ;;
-  *)                    mips_bitsize=64 ; mips_msb=63 ;;
-esac
-wire_word_bitsize="$mips_bitsize"
-wire_word_msb="$mips_msb"
-wire_address_bitsize=""
-wire_cell_bitsize=""
-# Check whether --enable-sim-bitsize was given.
-if test "${enable_sim_bitsize+set}" = set; then :
-  enableval=$enable_sim_bitsize; sim_bitsize=
-case "${enableval}" in
-  64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
-  32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
-  64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
-  32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
-  32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
-        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
-      else
-        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
-      fi ;;
-  64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
-        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
-      else
-        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
-      fi ;;
-  *)  as_fn_error $? "\"--enable-sim-bitsize was given $enableval.  Expected 32 or 64\"" "$LINENO" 5 ;;
-esac
-# address bitsize
-tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9]*,*//"`
-case x"${tmp}" in
-  x ) ;;
-  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
-  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
-  * ) as_fn_error $? "\"--enable-sim-bitsize was given address size $enableval.  Expected 32 or 64\"" "$LINENO" 5 ;;
-esac
-# cell bitsize
-tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9*]*,*[0-9]*,*//"`
-case x"${tmp}" in
-  x ) ;;
-  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
-  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
-  * ) as_fn_error $? "\"--enable-sim-bitsize was given cell size $enableval.  Expected 32 or 64\"" "$LINENO" 5 ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
-  echo "Setting bitsize flags = $sim_bitsize" 6>&1
-fi
-else
-  sim_bitsize=""
-if test x"$wire_word_bitsize" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
-fi
-if test x"$wire_word_msb" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
-fi
-if test x"$wire_address_bitsize" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
-fi
-if test x"$wire_cell_bitsize" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
-fi
-fi
-
-
-
-
 #
 # Select the floating hardware support of the target
 #
index 308b3aefbeb150d53d432e500915ebdf7784d415..d820b816fe0189cd5c46c02b097a7b47c1ce47d5 100644 (file)
@@ -6,23 +6,6 @@ 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 bitsize of the target
-#
-case "${target}" in
-  mips*-sde-elf*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips*-mti-elf*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips64*-*-*)          mips_bitsize=64 ; mips_msb=63 ;;
-  mips16*-*-*)          mips_bitsize=64 ; mips_msb=63 ;;
-  mipsisa32*-*-*)       mips_bitsize=32 ; mips_msb=31 ;;
-  mipsisa64*-*-*)       mips_bitsize=64 ; mips_msb=63 ;;
-  mips*-*-*)            mips_bitsize=32 ; mips_msb=31 ;;
-  *)                    mips_bitsize=64 ; mips_msb=63 ;;
-esac
-SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb)
-
-
-
 #
 # Select the floating hardware support of the target
 #