mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-29 06:50:32 +00:00
Tons of changes to allow model specific information in the instruction file.
This commit is contained in:
parent
aa917e719d
commit
a31140524a
@ -1,10 +1,58 @@
|
||||
Fri Nov 10 06:39:46 1995 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||
|
||||
* table.c (table): New field nr_model_fields.
|
||||
(table_open): New parameter nr_model_fields.
|
||||
(table_entry_read): Parse model fields that begin with a '*' after
|
||||
each instruction.
|
||||
* igen.c, dgen.c: Change callers of table_open.
|
||||
|
||||
* igen.c: Add support for dumping model specific information in
|
||||
model.h and model.c.
|
||||
(insn_field_name): Delete unused array.
|
||||
(global variables): Make global variables static, so we can tell
|
||||
when they are no longer used.
|
||||
(cache_semantic_actual): Delete unused variable.
|
||||
(insn_table_load_insns): If the insn is really a machine model,
|
||||
call model_table_insert instead of other processing.
|
||||
(model_table_insert): New function to handle defining the
|
||||
functional units of a particular machine model.
|
||||
(insn_table): Add last_function field so we can add functions at
|
||||
the end.
|
||||
(insn_table_insert_function): Use last_function field when
|
||||
appending new function.
|
||||
|
||||
* ppc-instructions: Add a few model specific information for 603,
|
||||
603e, and 604 for testing purposes.
|
||||
|
||||
* table.h (table_model_entry): New linked list to hold model
|
||||
specific information, one per line.
|
||||
(table_entry): Add model_first, model_last fields.
|
||||
|
||||
* configure.in (--enable-sim-inline): If gcc is found and
|
||||
--enable-sim-inline is not specified, defaine DEFAULT_INLINE to 1,
|
||||
not 2.
|
||||
(--enable-sim-reserved-bits): New switch to check whether reserved
|
||||
bits are set in the instruction.
|
||||
(--enable-sim-opcode): Make complex the default.
|
||||
(all switches): Add appropriate checks and error messages.
|
||||
* configure: Regenerate.
|
||||
|
||||
* Makefile.in (RESERVED_CFLAGS): New variable set by
|
||||
--enable-sim-reserved-bits.
|
||||
(CONFIG_CFLAGS): Include RESERVED_CFLAGS.
|
||||
(BUILT_SRC): igen now generates model.c and model.h.
|
||||
(LIB_OBJ): Include table.o.
|
||||
(tmp-igen): Add -m/-M options to write model.c/model.h.
|
||||
(model.o): New object.
|
||||
(CPU_H): Include model.h.
|
||||
|
||||
* cpu.h: Include model.h.
|
||||
|
||||
* std-config.h (WITH_RESERVED_BITS): Define.
|
||||
(MODEL_INLINE): Ditto.
|
||||
|
||||
* options.c (print_options): Print out WITH_RESERVED_BITS.
|
||||
|
||||
Thu Nov 9 12:22:15 1995 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||
|
||||
* configure.in: If --silent, don't output information messages.
|
||||
|
128
sim/ppc/configure
vendored
128
sim/ppc/configure
vendored
@ -40,7 +40,7 @@ ac_help="$ac_help
|
||||
ac_help="$ac_help
|
||||
--enable-sim-bitsize=n Specify target bitsize (32 or 64)."
|
||||
ac_help="$ac_help
|
||||
--enable-sim-hostbitsize=n Specify host bitsize (32 or 64)."
|
||||
--enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64)."
|
||||
ac_help="$ac_help
|
||||
--enable-sim-env=env Specify target environment (operating, virtual, user)."
|
||||
ac_help="$ac_help
|
||||
@ -51,6 +51,8 @@ ac_help="$ac_help
|
||||
--enable-sim-trace Specify whether tracing is supported."
|
||||
ac_help="$ac_help
|
||||
--enable-sim-assert Specify whether to perform random assertions."
|
||||
ac_help="$ac_help
|
||||
--enable-sim-reserved-bits Specify whether to check reserved bits in instruction."
|
||||
ac_help="$ac_help
|
||||
--enable-sim-float Specify whether to use host floating point or simulate."
|
||||
ac_help="$ac_help
|
||||
@ -483,30 +485,48 @@ fi
|
||||
enableval="$enable_sim_config"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_config="std-config.h";;
|
||||
no) sim_config="std-config.h";;
|
||||
*) sim_config="${enableval}";;
|
||||
yes|no) { echo "configure: error: "No value supplied for --enable-sim-config=file"" 1>&2; exit 1; };;
|
||||
*) if test -f "${enableval}"; then
|
||||
sim_config="${enableval}";
|
||||
elif test -f "${enableval}-config.h"; then
|
||||
sim_config="${enableval}-config.h"
|
||||
else
|
||||
{ echo "configure: error: "Config file $enableval was not found"" 1>&2; exit 1; };
|
||||
sim_config=std-config.h
|
||||
fi;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
|
||||
echo "Setting config flags = $sim_config" 6>&1
|
||||
fi
|
||||
else
|
||||
sim_config="std-config.h"; echo "Setting config flags = $sim_config" 6>&1
|
||||
sim_config="std-config.h"
|
||||
if test x"$silent" != x"yes"; then
|
||||
echo "Setting config flags = $sim_config" 6>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-sim-opcode or --disable-sim-opcode was given.
|
||||
enableval="$enable_sim_opcode"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_opcode="ppc-opcode-simple";;
|
||||
no) sim_opcode="ppc-opcode-simple";;
|
||||
*) sim_opcode="ppc-opcode-${enableval}";;
|
||||
yes|no) { echo "configure: error: "No value supplied for --enable-sim-opcode=file"" 1>&2; exit 1; };;
|
||||
*) if test -f "${enableval}"; then
|
||||
sim_opcode="${enableval}"
|
||||
elif test -f "ppc-opcode-${enableval}"; then
|
||||
sim_opcode="ppc-opcode-${enableval}"
|
||||
else
|
||||
{ echo "configure: error: "File $enableval is not an opcode rules file"" 1>&2; exit 1; };
|
||||
sim_opcode="ppc-opcode-complex"
|
||||
fi;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
|
||||
echo "Setting opcode flags = $sim_opcode" 6>&1
|
||||
fi
|
||||
else
|
||||
sim_opcode="ppc-opcode-simple"; echo "Setting opcode flags = $sim_opcode"
|
||||
sim_opcode="ppc-opcode-complex"
|
||||
if test x"$silent" != x"yes"; then
|
||||
echo "Setting opcode flags = $sim_opcode"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-sim-switch or --disable-sim-switch was given.
|
||||
@ -514,7 +534,8 @@ enableval="$enable_sim_switch"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_switch="-s";;
|
||||
*) sim_switch="";;
|
||||
no) sim_switch="";;
|
||||
*) { echo "configure: error: "--enable-sim-switch does not take a value"" 1>&2; exit 1; }; sim_switch="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
|
||||
echo "Setting switch flags = $sim_switch" 6>&1
|
||||
@ -530,8 +551,9 @@ fi
|
||||
enableval="$enable_sim_duplicate"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_dup="-e";;
|
||||
*) sim_dup="";;
|
||||
yes) sim_dup="-e";;
|
||||
no) sim_dup="";;
|
||||
*) { echo "configure: error: "--enable-sim-duplicate does not take a value"" 1>&2; exit 1; }; sim_dup="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
|
||||
echo "Setting duplicate flags = $sim_dup" 6>&1
|
||||
@ -547,8 +569,9 @@ fi
|
||||
enableval="$enable_sim_filter"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_filter="";;
|
||||
*) sim_filter="-f $enableval";;
|
||||
yes) { echo "configure: error: "--enable-sim-filter must be specified with a rule to filter or no"" 1>&2; exit 1; }; sim_filter="";;
|
||||
no) sim_filter="";;
|
||||
*) sim_filter="-f $enableval";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
|
||||
echo "Setting filter flags = $sim_filter" 6>&1
|
||||
@ -564,11 +587,12 @@ fi
|
||||
enableval="$enable_sim_icache"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_icache="-r 1024";;
|
||||
*) sim_icache="";;
|
||||
yes) sim_icache="-r 1024";;
|
||||
no) sim_icache="";;
|
||||
*) sim_icache="-r ${enableval}";;
|
||||
esac
|
||||
else
|
||||
sim_icache=""
|
||||
sim_icache="-r 1024"
|
||||
fi
|
||||
|
||||
# Check whether --enable-sim-inline or --disable-sim-inline was given.
|
||||
@ -615,7 +639,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_bswap="-DWITH_BSWAP=1";;
|
||||
no) sim_bswap="-DWITH_BSWAP=0";;
|
||||
*) sim_bswap="";;
|
||||
*) { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
|
||||
echo "Setting bswap flags = $sim_bswap" 6>&1
|
||||
@ -636,7 +660,7 @@ if test -n "$enableval"; then
|
||||
no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) sim_endian="";;
|
||||
*) { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
|
||||
echo "Setting endian flags = $sim_endian" 6>&1
|
||||
@ -652,7 +676,7 @@ if test -n "$enableval"; then
|
||||
no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
|
||||
b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) sim_hostendian="";;
|
||||
*) { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
|
||||
echo "Setting hostendian flags = $sim_hostendian" 6>&1
|
||||
@ -683,9 +707,8 @@ fi
|
||||
enableval="$enable_sim_bitsize"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_bitsize="";;
|
||||
no) sim_bitsize="";;
|
||||
*) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
|
||||
32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
|
||||
*) { echo "configure: error: "--enable-sim-bitsize was given $enableval" 1>&2; exit 1; }; sim_bitsize="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
|
||||
echo "Setting bitsize flags = $sim_bitsize" 6>&1
|
||||
@ -698,9 +721,8 @@ fi
|
||||
enableval="$enable_sim_hostbitsize"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_hostbitsize="";;
|
||||
no) sim_hostbitsize="";;
|
||||
*) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
|
||||
32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
|
||||
*) { echo "configure: error: "--enable-sim-hostbitsize was given $enableval" 1>&2; exit 1; }; sim_hostbitsize="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
|
||||
echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
|
||||
@ -716,7 +738,8 @@ if test -n "$enableval"; then
|
||||
operating | os | oea) sim_env="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
|
||||
virtual | vea) sim_env="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
|
||||
user | uea) sim_env="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
|
||||
*) sim_env="";;
|
||||
no) sim_env="-DWITH_ENVIRONMENT=0";;
|
||||
*) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-env"" 1>&2; exit 1; }; sim_env="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_env" != x""; then
|
||||
echo "Setting env flags = $sim_env" 6>&1
|
||||
@ -731,7 +754,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_timebase="-DWITH_TIME_BASE=1";;
|
||||
no) sim_timebase="-DWITH_TIME_BASE=0";;
|
||||
*) sim_timebase="";;
|
||||
*) { echo "configure: error: "--enable-sim-timebase does not take a value"" 1>&2; exit 1; }; sim_timebase="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
|
||||
echo "Setting timebase flags = $sim_timebase" 6>&1
|
||||
@ -746,7 +769,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
|
||||
no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
|
||||
*) sim_alignment="-DWITH_ALIGNMENT=$enableval";;
|
||||
*) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
|
||||
echo "Setting alignment flags = $sim_alignment" 6>&1
|
||||
@ -761,7 +784,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_trace="-DWITH_TRACE=1";;
|
||||
no) sim_trace="-DWITH_TRACE=0";;
|
||||
*) sim_trace="";;
|
||||
*) { echo "configure: error: "--enable-sim-trace does not take a value"" 1>&2; exit 1; }; sim_trace="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
|
||||
echo "Setting trace flags = $sim_trace" 6>&1
|
||||
@ -776,7 +799,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_assert="-DWITH_ASSERT=1";;
|
||||
no) sim_assert="-DWITH_ASSERT=0";;
|
||||
*) sim_assert="";;
|
||||
*) { echo "configure: error: "--enable-sim-assert does not take a value"" 1>&2; exit 1; }; sim_assert="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
|
||||
echo "Setting assert flags = $sim_assert" 6>&1
|
||||
@ -785,13 +808,28 @@ else
|
||||
sim_assert=""
|
||||
fi
|
||||
|
||||
# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given.
|
||||
enableval="$enable_sim_reserved_bits"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
|
||||
no) sim_reserved="-DWITH_RESERVED_BITS=0";;
|
||||
*) { echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
|
||||
echo "Setting reserved flags = $sim_reserved" 6>&1
|
||||
fi
|
||||
else
|
||||
sim_reserved=""
|
||||
fi
|
||||
|
||||
# Check whether --enable-sim-float or --disable-sim-float was given.
|
||||
enableval="$enable_sim_float"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
|
||||
no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
|
||||
*) sim_float="";;
|
||||
*) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-float"" 1>&2; exit 1; }; sim_float="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
|
||||
echo "Setting float flags = $sim_float" 6>&1
|
||||
@ -808,7 +846,7 @@ if test -n "$enableval"; then
|
||||
no) sim_mon="-DWITH_MON=0";;
|
||||
instruction) sim_mon="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
|
||||
memory) sim_mon="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
|
||||
*) sim_mon="-DWITH_MON='$enableval'";;
|
||||
*) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-mon"" 1>&2; exit 1; }; sim_env="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_mon" != x""; then
|
||||
echo "Setting monitor flags = $sim_mon" 6>&1
|
||||
@ -823,7 +861,7 @@ if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_func="-DWITH_FUNCTION_UNIT=1";;
|
||||
no) sim_func="-DWITH_FUNCTION_UNIT=0";;
|
||||
*) sim_func="";;
|
||||
*) { echo "configure: error: "--enable-sim-function-unit does not take a value"" 1>&2; exit 1; }; sim_func="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_func" != x""; then
|
||||
echo "Setting function-unit flags = $sim_func" 6>&1
|
||||
@ -836,9 +874,8 @@ fi
|
||||
enableval="$enable_sim_model"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_model="";;
|
||||
no) sim_model="";;
|
||||
*) sim_model="-DWITH_PPC_MODEL=${enableval}";;
|
||||
yes|no) { echo "configure: error: "No value supplied for --enable-sim-model=model"" 1>&2; exit 1; };;
|
||||
*) sim_model="-DWITH_MODEL=${enableval}";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
|
||||
echo "Setting model flags = $sim_model" 6>&1
|
||||
@ -851,9 +888,8 @@ fi
|
||||
enableval="$enable_sim_default_model"
|
||||
if test -n "$enableval"; then
|
||||
case "${enableval}" in
|
||||
yes) sim_default_model="";;
|
||||
no) sim_default_model="";;
|
||||
*) sim_default_model="-DWITH_DEFAULT_PPC_MODEL=${enableval}";;
|
||||
yes|no) { echo "configure: error: "No value supplied for --enable-sim-default-model=model"" 1>&2; exit 1; };;
|
||||
*) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
|
||||
echo "Setting default-model flags = $sim_default_model" 6>&1
|
||||
@ -1118,6 +1154,7 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in getrusage
|
||||
@ -1127,7 +1164,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1131 "configure"
|
||||
#line 1168 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
@ -1182,7 +1219,7 @@ else
|
||||
ac_cv_c_cross=yes
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1186 "configure"
|
||||
#line 1223 "configure"
|
||||
#include "confdefs.h"
|
||||
main(){return(0);}
|
||||
EOF
|
||||
@ -1220,7 +1257,7 @@ else
|
||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||
# not just through cpp.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1224 "configure"
|
||||
#line 1261 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
@ -1234,7 +1271,7 @@ else
|
||||
rm -rf conftest*
|
||||
CPP="${CC-cc} -E -traditional-cpp"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1238 "configure"
|
||||
#line 1275 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
@ -1267,7 +1304,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1271 "configure"
|
||||
#line 1308 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
@ -1438,6 +1475,7 @@ s%@sim_alignment@%$sim_alignment%g
|
||||
s%@sim_float@%$sim_float%g
|
||||
s%@sim_trace@%$sim_trace%g
|
||||
s%@sim_assert@%$sim_assert%g
|
||||
s%@sim_reserved@%$sim_reserved%g
|
||||
s%@sim_monitor@%$sim_monitor%g
|
||||
s%@sim_func@%$sim_func%g
|
||||
s%@sim_model@%$sim_model%g
|
||||
|
@ -27,30 +27,49 @@ fi],[sim_warnings=""])dnl
|
||||
AC_ARG_ENABLE(sim-config,
|
||||
[ --enable-sim-config=file Override default config file],
|
||||
[case "${enableval}" in
|
||||
yes) sim_config="std-config.h";;
|
||||
no) sim_config="std-config.h";;
|
||||
*) sim_config="${enableval}";;
|
||||
yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
|
||||
*) if test -f "${enableval}"; then
|
||||
sim_config="${enableval}";
|
||||
elif test -f "${enableval}-config.h"; then
|
||||
sim_config="${enableval}-config.h"
|
||||
else
|
||||
AC_MSG_ERROR("Config file $enableval was not found");
|
||||
sim_config=std-config.h
|
||||
fi;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
|
||||
echo "Setting config flags = $sim_config" 6>&1
|
||||
fi],[sim_config="std-config.h"; echo "Setting config flags = $sim_config" 6>&1])dnl
|
||||
fi],[sim_config="std-config.h"
|
||||
if test x"$silent" != x"yes"; then
|
||||
echo "Setting config flags = $sim_config" 6>&1
|
||||
fi])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-opcode,
|
||||
[ --enable-sim-opcode=which Override default opcode lookup.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_opcode="ppc-opcode-simple";;
|
||||
no) sim_opcode="ppc-opcode-simple";;
|
||||
*) sim_opcode="ppc-opcode-${enableval}";;
|
||||
yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
|
||||
*) if test -f "${enableval}"; then
|
||||
sim_opcode="${enableval}"
|
||||
elif test -f "ppc-opcode-${enableval}"; then
|
||||
sim_opcode="ppc-opcode-${enableval}"
|
||||
else
|
||||
AC_MSG_ERROR("File $enableval is not an opcode rules file");
|
||||
sim_opcode="ppc-opcode-complex"
|
||||
fi;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
|
||||
echo "Setting opcode flags = $sim_opcode" 6>&1
|
||||
fi],[sim_opcode="ppc-opcode-simple"; echo "Setting opcode flags = $sim_opcode"])dnl
|
||||
fi],[sim_opcode="ppc-opcode-complex"
|
||||
if test x"$silent" != x"yes"; then
|
||||
echo "Setting opcode flags = $sim_opcode"
|
||||
fi])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-switch,
|
||||
[ --enable-sim-switch Use a switch instead of a table for instruction call.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_switch="-s";;
|
||||
*) sim_switch="";;
|
||||
no) sim_switch="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
|
||||
echo "Setting switch flags = $sim_switch" 6>&1
|
||||
@ -62,8 +81,9 @@ fi])dnl
|
||||
AC_ARG_ENABLE(sim-duplicate,
|
||||
[ --enable-sim-duplicate Expand (duplicate) semantic functions.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_dup="-e";;
|
||||
*) sim_dup="";;
|
||||
yes) sim_dup="-e";;
|
||||
no) sim_dup="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
|
||||
echo "Setting duplicate flags = $sim_dup" 6>&1
|
||||
@ -75,8 +95,9 @@ fi])dnl
|
||||
AC_ARG_ENABLE(sim-filter,
|
||||
[ --enable-sim-filter=rule Specify filter rules.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_filter="";;
|
||||
*) sim_filter="-f $enableval";;
|
||||
yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
|
||||
no) sim_filter="";;
|
||||
*) sim_filter="-f $enableval";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
|
||||
echo "Setting filter flags = $sim_filter" 6>&1
|
||||
@ -88,9 +109,10 @@ fi])dnl
|
||||
AC_ARG_ENABLE(sim-icache,
|
||||
[ --enable-sim-icache=size Specify instruction cache size.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_icache="-r 1024";;
|
||||
*) sim_icache="";;
|
||||
esac],[sim_icache=""])dnl
|
||||
yes) sim_icache="-r 1024";;
|
||||
no) sim_icache="";;
|
||||
*) sim_icache="-r ${enableval}";;
|
||||
esac],[sim_icache="-r 1024"])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-inline,
|
||||
[ --enable-sim-inline=inlines Specify which functions should be inlined.],
|
||||
@ -131,7 +153,7 @@ AC_ARG_ENABLE(sim-bswap,
|
||||
[case "${enableval}" in
|
||||
yes) sim_bswap="-DWITH_BSWAP=1";;
|
||||
no) sim_bswap="-DWITH_BSWAP=0";;
|
||||
*) sim_bswap="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
|
||||
echo "Setting bswap flags = $sim_bswap" 6>&1
|
||||
@ -148,7 +170,7 @@ AC_ARG_ENABLE(sim-endian,
|
||||
no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
|
||||
b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) sim_endian="";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
|
||||
echo "Setting endian flags = $sim_endian" 6>&1
|
||||
@ -160,7 +182,7 @@ AC_ARG_ENABLE(sim-hostendian,
|
||||
no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
|
||||
b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
|
||||
l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
|
||||
*) sim_hostendian="";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
|
||||
echo "Setting hostendian flags = $sim_hostendian" 6>&1
|
||||
@ -183,20 +205,18 @@ fi])dnl
|
||||
AC_ARG_ENABLE(sim-bitsize,
|
||||
[ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
|
||||
[case "${enableval}" in
|
||||
yes) sim_bitsize="";;
|
||||
no) sim_bitsize="";;
|
||||
*) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
|
||||
32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
|
||||
*) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval, expected 32 or 64"); sim_bitsize="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
|
||||
echo "Setting bitsize flags = $sim_bitsize" 6>&1
|
||||
fi],[sim_bitsize=""])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-hostbitsize,
|
||||
[ --enable-sim-hostbitsize=n Specify host bitsize (32 or 64).],
|
||||
[ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
|
||||
[case "${enableval}" in
|
||||
yes) sim_hostbitsize="";;
|
||||
no) sim_hostbitsize="";;
|
||||
*) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
|
||||
32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
|
||||
*) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval, expected 32 or 64"); sim_hostbitsize="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
|
||||
echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
|
||||
@ -208,7 +228,8 @@ AC_ARG_ENABLE(sim-env,
|
||||
operating | os | oea) sim_env="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
|
||||
virtual | vea) sim_env="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
|
||||
user | uea) sim_env="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
|
||||
*) sim_env="";;
|
||||
no) sim_env="-DWITH_ENVIRONMENT=0";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-env"); sim_env="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_env" != x""; then
|
||||
echo "Setting env flags = $sim_env" 6>&1
|
||||
@ -219,7 +240,7 @@ AC_ARG_ENABLE(sim-timebase,
|
||||
[case "${enableval}" in
|
||||
yes) sim_timebase="-DWITH_TIME_BASE=1";;
|
||||
no) sim_timebase="-DWITH_TIME_BASE=0";;
|
||||
*) sim_timebase="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
|
||||
echo "Setting timebase flags = $sim_timebase" 6>&1
|
||||
@ -230,7 +251,7 @@ AC_ARG_ENABLE(sim-alignment,
|
||||
[case "${enableval}" in
|
||||
yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
|
||||
no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
|
||||
*) sim_alignment="-DWITH_ALIGNMENT=$enableval";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
|
||||
echo "Setting alignment flags = $sim_alignment" 6>&1
|
||||
@ -241,7 +262,7 @@ AC_ARG_ENABLE(sim-trace,
|
||||
[case "${enableval}" in
|
||||
yes) sim_trace="-DWITH_TRACE=1";;
|
||||
no) sim_trace="-DWITH_TRACE=0";;
|
||||
*) sim_trace="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-trace does not take a value"); sim_trace="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
|
||||
echo "Setting trace flags = $sim_trace" 6>&1
|
||||
@ -252,18 +273,29 @@ AC_ARG_ENABLE(sim-assert,
|
||||
[case "${enableval}" in
|
||||
yes) sim_assert="-DWITH_ASSERT=1";;
|
||||
no) sim_assert="-DWITH_ASSERT=0";;
|
||||
*) sim_assert="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
|
||||
echo "Setting assert flags = $sim_assert" 6>&1
|
||||
fi],[sim_assert=""])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-reserved-bits,
|
||||
[ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
|
||||
no) sim_reserved="-DWITH_RESERVED_BITS=0";;
|
||||
*) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
|
||||
echo "Setting reserved flags = $sim_reserved" 6>&1
|
||||
fi],[sim_reserved=""])dnl
|
||||
|
||||
AC_ARG_ENABLE(sim-float,
|
||||
[ --enable-sim-float Specify whether to use host floating point or simulate.],
|
||||
[case "${enableval}" in
|
||||
yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
|
||||
no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
|
||||
*) sim_float="";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
|
||||
echo "Setting float flags = $sim_float" 6>&1
|
||||
@ -276,7 +308,7 @@ AC_ARG_ENABLE(sim-monitor,
|
||||
no) sim_mon="-DWITH_MON=0";;
|
||||
instruction) sim_mon="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
|
||||
memory) sim_mon="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
|
||||
*) sim_mon="-DWITH_MON='$enableval'";;
|
||||
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon"); sim_env="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_mon" != x""; then
|
||||
echo "Setting monitor flags = $sim_mon" 6>&1
|
||||
@ -287,7 +319,7 @@ AC_ARG_ENABLE(sim-function-unit,
|
||||
[case "${enableval}" in
|
||||
yes) sim_func="-DWITH_FUNCTION_UNIT=1";;
|
||||
no) sim_func="-DWITH_FUNCTION_UNIT=0";;
|
||||
*) sim_func="";;
|
||||
*) AC_MSG_ERROR("--enable-sim-function-unit does not take a value"); sim_func="";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_func" != x""; then
|
||||
echo "Setting function-unit flags = $sim_func" 6>&1
|
||||
@ -296,9 +328,8 @@ fi],[sim_func=""])dnl
|
||||
AC_ARG_ENABLE(sim-model,
|
||||
[ --enable-sim-model=which Specify PowerPC to model.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_model="";;
|
||||
no) sim_model="";;
|
||||
*) sim_model="-DWITH_PPC_MODEL=${enableval}";;
|
||||
yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
|
||||
*) sim_model="-DWITH_MODEL=${enableval}";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
|
||||
echo "Setting model flags = $sim_model" 6>&1
|
||||
@ -307,9 +338,8 @@ fi],[sim_model=""])dnl
|
||||
AC_ARG_ENABLE(sim-default-model,
|
||||
[ --enable-sim-default-model=which Specify default PowerPC to model.],
|
||||
[case "${enableval}" in
|
||||
yes) sim_default_model="";;
|
||||
no) sim_default_model="";;
|
||||
*) sim_default_model="-DWITH_DEFAULT_PPC_MODEL=${enableval}";;
|
||||
yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
|
||||
*) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
|
||||
echo "Setting default-model flags = $sim_default_model" 6>&1
|
||||
@ -350,6 +380,7 @@ AC_SUBST(sim_alignment)
|
||||
AC_SUBST(sim_float)
|
||||
AC_SUBST(sim_trace)
|
||||
AC_SUBST(sim_assert)
|
||||
AC_SUBST(sim_reserved)
|
||||
AC_SUBST(sim_monitor)
|
||||
AC_SUBST(sim_func)
|
||||
AC_SUBST(sim_model)
|
||||
|
432
sim/ppc/igen.c
432
sim/ppc/igen.c
@ -43,24 +43,35 @@ enum {
|
||||
max_insn_size = 32,
|
||||
};
|
||||
|
||||
int hi_bit_nr = 0;
|
||||
int insn_size = max_insn_size;
|
||||
int idecode_expand_semantics = 0;
|
||||
int idecode_cache = 0;
|
||||
int number_lines = 1;
|
||||
static int hi_bit_nr = 0;
|
||||
static int insn_size = max_insn_size;
|
||||
static int idecode_expand_semantics = 0;
|
||||
static int idecode_cache = 0;
|
||||
static int number_lines = 1;
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
char *cache_idecode_formal = "cpu *processor,\n instruction_word instruction,\n unsigned_word cia,\n idecode_cache *cache_entry";
|
||||
char *cache_idecode_actual = "processor, instruction, cia, cache_entry";
|
||||
static char *cache_idecode_formal =
|
||||
"cpu *processor,\n\
|
||||
instruction_word instruction,\n\
|
||||
unsigned_word cia,\n\
|
||||
idecode_cache *cache_entry";
|
||||
|
||||
char *cache_semantic_formal = "cpu *processor,\n idecode_cache *cache_entry,\n unsigned_word cia";
|
||||
char *cache_semantic_actual = "processor, entry, cia";
|
||||
static char *cache_idecode_actual = "processor, instruction, cia, cache_entry";
|
||||
|
||||
char *semantic_formal = "cpu *processor,\n instruction_word instruction,\n unsigned_word cia";
|
||||
char *semantic_actual = "processor, instruction, cia";
|
||||
static char *cache_semantic_formal =
|
||||
"cpu *processor,\n\
|
||||
idecode_cache *cache_entry,\n\
|
||||
unsigned_word cia";
|
||||
|
||||
static char *semantic_formal =
|
||||
"cpu *processor,\n\
|
||||
instruction_word instruction,\n\
|
||||
unsigned_word cia";
|
||||
|
||||
static char *semantic_actual = "processor, instruction, cia";
|
||||
|
||||
|
||||
|
||||
@ -72,7 +83,7 @@ struct _filter {
|
||||
char *flag;
|
||||
filter *next;
|
||||
};
|
||||
filter *filters = NULL;
|
||||
static filter *filters = NULL;
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
@ -87,7 +98,7 @@ struct _cache_rules {
|
||||
char *expression;
|
||||
cache_rules *next;
|
||||
};
|
||||
cache_rules *cache_table;
|
||||
static cache_rules *cache_table;
|
||||
|
||||
|
||||
enum {
|
||||
@ -102,7 +113,7 @@ enum {
|
||||
static cache_rules *
|
||||
load_cache_rules(char *file_name)
|
||||
{
|
||||
table *file = table_open(file_name, nr_cache_rule_fields);
|
||||
table *file = table_open(file_name, nr_cache_rule_fields, 0);
|
||||
table_entry *entry;
|
||||
cache_rules *table = NULL;
|
||||
cache_rules **curr_rule = &table;
|
||||
@ -167,7 +178,7 @@ struct _opcode_rules {
|
||||
unsigned special_rule;
|
||||
opcode_rules *next;
|
||||
};
|
||||
opcode_rules *opcode_table;
|
||||
static opcode_rules *opcode_table;
|
||||
|
||||
|
||||
enum {
|
||||
@ -188,7 +199,7 @@ enum {
|
||||
static opcode_rules *
|
||||
load_opcode_rules(char *file_name)
|
||||
{
|
||||
table *file = table_open(file_name, nr_opcode_fields);
|
||||
table *file = table_open(file_name, nr_opcode_fields, 0);
|
||||
table_entry *entry;
|
||||
opcode_rules *table = NULL;
|
||||
opcode_rules **curr_rule = &table;
|
||||
@ -567,18 +578,19 @@ typedef enum {
|
||||
insn_nmemonic,
|
||||
insn_name,
|
||||
insn_comment,
|
||||
nr_insn_table_fields,
|
||||
nr_insn_table_fields
|
||||
} insn_table_fields;
|
||||
char *insn_field_name[nr_insn_table_fields] = {
|
||||
"format", "form", "flags", "nmemonic", "name", "comments"
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
function_type = insn_format,
|
||||
function_name = insn_name,
|
||||
function_param = insn_comment,
|
||||
function_param = insn_comment
|
||||
} function_table_fields;
|
||||
|
||||
typedef enum {
|
||||
model_name = insn_name,
|
||||
model_func = insn_comment,
|
||||
} model_table_fields;
|
||||
|
||||
typedef struct _insn insn;
|
||||
struct _insn {
|
||||
@ -587,6 +599,23 @@ struct _insn {
|
||||
insn *next;
|
||||
};
|
||||
|
||||
typedef struct _model_func_unit model_func_unit;
|
||||
struct _model_func_unit {
|
||||
model_func_unit *next;
|
||||
char *name;
|
||||
char *comment;
|
||||
int number;
|
||||
unsigned mask;
|
||||
};
|
||||
|
||||
typedef struct _model model;
|
||||
struct _model {
|
||||
model *next;
|
||||
char *name;
|
||||
model_func_unit *func_unit_start;
|
||||
model_func_unit *func_unit_end;
|
||||
};
|
||||
|
||||
typedef struct _insn_table insn_table;
|
||||
struct _insn_table {
|
||||
int opcode_nr;
|
||||
@ -594,6 +623,9 @@ struct _insn_table {
|
||||
int nr_insn;
|
||||
insn *insns;
|
||||
insn *functions;
|
||||
insn *last_function;
|
||||
int max_func_unit_name_len;
|
||||
unsigned max_func_unit_mask;
|
||||
opcode_rules *opcode_rule;
|
||||
opcode_field *opcode;
|
||||
int nr_entries;
|
||||
@ -602,23 +634,135 @@ struct _insn_table {
|
||||
insn_table *parent;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
insn_model_name,
|
||||
insn_model_unit,
|
||||
insn_model_issue,
|
||||
insn_model_done,
|
||||
insn_model_flags,
|
||||
nr_insn_model_table_fields
|
||||
} insn_model_table_fields;
|
||||
|
||||
static model *models;
|
||||
static model *last_model;
|
||||
|
||||
|
||||
static void
|
||||
insn_table_insert_function(insn_table *table,
|
||||
table_entry *file_entry)
|
||||
{
|
||||
insn **ptr_to_cur_function = &table->functions;
|
||||
|
||||
/* create a new function */
|
||||
insn *new_function = ZALLOC(insn);
|
||||
new_function->file_entry = file_entry;
|
||||
|
||||
/* append it to the end of the function list */
|
||||
while (*ptr_to_cur_function != NULL) {
|
||||
ptr_to_cur_function = &(*ptr_to_cur_function)->next;
|
||||
if (table->last_function)
|
||||
table->last_function->next = new_function;
|
||||
else
|
||||
table->functions = new_function;
|
||||
table->last_function = new_function;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
model_table_insert(insn_table *table,
|
||||
table_entry *file_entry)
|
||||
{
|
||||
/* create a new model */
|
||||
model *new_model = ZALLOC(model);
|
||||
model_func_unit *func_unit;
|
||||
char *ptr, *end, *end_name, *comment, *name;
|
||||
int ch;
|
||||
int name_len;
|
||||
int func_name_len;
|
||||
unsigned unit, mask;
|
||||
int number;
|
||||
|
||||
new_model->name = file_entry->fields[model_name];
|
||||
name_len = strlen(new_model->name);
|
||||
|
||||
/* append it to the end of the model list */
|
||||
if (last_model)
|
||||
last_model->next = new_model;
|
||||
else
|
||||
models = new_model;
|
||||
last_model = new_model;
|
||||
|
||||
/* Parse the function units separated by commas */
|
||||
unit = 1;
|
||||
for (ptr = file_entry->fields[model_func];
|
||||
((ch = *ptr) != '\0') && (ch != '\n');
|
||||
ptr = (*end == ',') ? end+1 : end) {
|
||||
|
||||
while (ch == ' ' || ch == '\t')
|
||||
ch = *++ptr;
|
||||
|
||||
if (!ch || ch == '\n')
|
||||
break;
|
||||
|
||||
/* Search for comma or newline ending field */
|
||||
end = ptr;
|
||||
end_name = (char *)0;
|
||||
|
||||
if (ch == ',')
|
||||
continue;
|
||||
|
||||
while (ch != '\0' && ch != ',' && ch != '\n') {
|
||||
if (end_name == (char *)0 && (ch == '=' || isspace(ch)))
|
||||
end_name = end;
|
||||
|
||||
ch = *++end;
|
||||
}
|
||||
if (!end_name)
|
||||
end_name = end;
|
||||
|
||||
func_unit = ZALLOC(model_func_unit);
|
||||
if (new_model->func_unit_end)
|
||||
new_model->func_unit_end->next = func_unit;
|
||||
else
|
||||
new_model->func_unit_start = func_unit;
|
||||
|
||||
new_model->func_unit_end = func_unit;
|
||||
|
||||
/* Record function unit name as model name _ unit name */
|
||||
func_name_len = name_len + end_name - ptr + 2;
|
||||
if (table->max_func_unit_name_len < func_name_len)
|
||||
table->max_func_unit_name_len = func_name_len;
|
||||
|
||||
func_unit->name = name = (char *)zalloc(func_name_len);
|
||||
memcpy(name, new_model->name, name_len);
|
||||
name[name_len] = '_';
|
||||
memcpy(name + name_len + 1, ptr, end_name - ptr);
|
||||
|
||||
/* See if there are multiple functional units */
|
||||
if (*end_name == '=') {
|
||||
number = 0;
|
||||
for(end_name++; end_name < end && isdigit(*end_name); end_name++)
|
||||
number = number * 10 + (*end_name - '0');
|
||||
} else {
|
||||
number = 1;
|
||||
}
|
||||
|
||||
/* Now figure out the mask for these unit(s) */
|
||||
func_unit->number = number;
|
||||
mask = 0;
|
||||
while (number--) {
|
||||
ASSERT(unit != 0);
|
||||
mask |= unit;
|
||||
unit <<= 1;
|
||||
}
|
||||
func_unit->mask = mask;
|
||||
table->max_func_unit_mask |= mask;
|
||||
|
||||
/* Now figure out comments */
|
||||
for (comment = end_name; comment < end && ((ch = *comment) == ' ' || ch == '\t'); comment++)
|
||||
;
|
||||
|
||||
if (comment < end) {
|
||||
func_unit->comment = (char *)zalloc(end - comment + 1);
|
||||
memcpy(func_unit->comment, comment, end - comment);
|
||||
}
|
||||
}
|
||||
*ptr_to_cur_function = new_function;
|
||||
}
|
||||
|
||||
|
||||
@ -629,12 +773,34 @@ insn_table_insert_insn(insn_table *table,
|
||||
{
|
||||
insn **ptr_to_cur_insn = &table->insns;
|
||||
insn *cur_insn = *ptr_to_cur_insn;
|
||||
table_model_entry *insn_model_ptr;
|
||||
model *model_ptr;
|
||||
|
||||
/* create a new instruction */
|
||||
insn *new_insn = ZALLOC(insn);
|
||||
new_insn->file_entry = file_entry;
|
||||
new_insn->fields = fields;
|
||||
|
||||
/* Check out any model information returned to make sure the model
|
||||
is correct. */
|
||||
for(insn_model_ptr = file_entry->model_first; insn_model_ptr; insn_model_ptr = insn_model_ptr->next) {
|
||||
char *name = insn_model_ptr->fields[insn_model_name];
|
||||
|
||||
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
if (strcmp(name, model_ptr->name) == 0) {
|
||||
|
||||
/* Replace the name field with that of the global model, so that when we
|
||||
want to print it out, we can just compare pointers. */
|
||||
insn_model_ptr->fields[insn_model_name] = model_ptr->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!model_ptr)
|
||||
error("%s:%d: machine model `%s' was not known about\n",
|
||||
file_entry->file_name, file_entry->line_nr, name);
|
||||
}
|
||||
|
||||
/* insert it according to the order of the fields */
|
||||
while (cur_insn != NULL
|
||||
&& new_insn->fields->value >= cur_insn->fields->value) {
|
||||
@ -902,7 +1068,7 @@ insn_table_expand_insns(insn_table *table)
|
||||
static insn_table *
|
||||
insn_table_load_insns(char *file_name)
|
||||
{
|
||||
table *file = table_open(file_name, nr_insn_table_fields);
|
||||
table *file = table_open(file_name, nr_insn_table_fields, nr_insn_model_table_fields);
|
||||
insn_table *table = ZALLOC(insn_table);
|
||||
table_entry *file_entry;
|
||||
table->opcode_rule = opcode_table;
|
||||
@ -912,6 +1078,9 @@ insn_table_load_insns(char *file_name)
|
||||
|| it_is("internal", file_entry->fields[insn_flags])) {
|
||||
insn_table_insert_function(table, file_entry);
|
||||
}
|
||||
else if (it_is("model", file_entry->fields[insn_flags])) {
|
||||
model_table_insert(table, file_entry);
|
||||
}
|
||||
else {
|
||||
insn_fields *fields;
|
||||
/* skip instructions that aren't relevant to the mode */
|
||||
@ -1854,7 +2023,7 @@ lf_print_c_validate(lf *file,
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "/* validate: %s */\n",
|
||||
instruction->file_entry->fields[insn_format]);
|
||||
lf_printf(file, "if (WITH_ASSERT && (instruction & 0x%x) != 0x%x)\n",
|
||||
lf_printf(file, "if (WITH_RESERVED_BITS && (instruction & 0x%x) != 0x%x)\n",
|
||||
check_mask, check_val);
|
||||
lf_indent(file, +2);
|
||||
lf_print_idecode_illegal(file);
|
||||
@ -2722,6 +2891,202 @@ gen_itable_c(insn_table *table, lf *file)
|
||||
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#endif /* _ITABLE_C_ */\n");
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
static void
|
||||
gen_model_h(insn_table *table, lf *file)
|
||||
{
|
||||
model *model_ptr;
|
||||
model_func_unit *func_unit_ptr;
|
||||
int hex_size;
|
||||
|
||||
lf_print_copyleft(file);
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#ifndef _MODEL_H_\n");
|
||||
lf_printf(file, "#define _MODEL_H_\n");
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#ifndef INLINE_MODEL\n");
|
||||
lf_printf(file, "#define INLINE_MODEL\n");
|
||||
lf_printf(file, "#endif\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "typedef struct _model_time {\t/* Instruction cycle time */\n");
|
||||
if (table->max_func_unit_mask > 0xffff) {
|
||||
hex_size = 8;
|
||||
lf_printf(file, " unsigned32 units;\n");
|
||||
lf_printf(file, " unsigned16 initial;\n");
|
||||
lf_printf(file, " unsigned16 finish;\n");
|
||||
} else {
|
||||
hex_size = 4;
|
||||
lf_printf(file, " unsigned16 units;\n");
|
||||
lf_printf(file, " unsigned8 initial;\n");
|
||||
lf_printf(file, " unsigned8 finish;\n");
|
||||
}
|
||||
lf_printf(file, " unsigned32 flags;\n");
|
||||
lf_printf(file, "} model_time;\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "typedef enum _model_enum {\n");
|
||||
lf_printf(file, " MODEL_NONE,\n");
|
||||
for (model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
lf_printf(file, " MODEL_%s,\n", model_ptr->name);
|
||||
}
|
||||
lf_printf(file, " nr_models\n");
|
||||
lf_printf(file, "} model_enum;\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
for (model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
for (func_unit_ptr = model_ptr->func_unit_start; func_unit_ptr; func_unit_ptr = func_unit_ptr->next) {
|
||||
if (func_unit_ptr->comment) {
|
||||
lf_printf(file, "#define %-*s 0x%.*x /* %s functional unit */\n",
|
||||
table->max_func_unit_name_len, func_unit_ptr->name,
|
||||
hex_size, func_unit_ptr->mask,
|
||||
func_unit_ptr->comment);
|
||||
} else {
|
||||
lf_printf(file, "#define %-*s 0x%.*x\n",
|
||||
table->max_func_unit_name_len, func_unit_ptr->name,
|
||||
hex_size, func_unit_ptr->mask);
|
||||
}
|
||||
}
|
||||
lf_printf(file, "\n");
|
||||
}
|
||||
|
||||
lf_printf(file, "extern const char *model_name[ (int)nr_models ];\n");
|
||||
lf_printf(file, "extern const char *const *const model_func_unit_name[ (int)nr_models ];\n");
|
||||
lf_printf(file, "extern const model_time *const model_time_mapping[];\n");
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#endif /* _MODEL_H_ */\n");
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
typedef struct _model_c_data model_c_data;
|
||||
struct _model_c_data {
|
||||
lf *file;
|
||||
model *model_ptr;
|
||||
};
|
||||
|
||||
static void
|
||||
model_c_insn(insn_table *entry,
|
||||
void *data,
|
||||
insn *instruction)
|
||||
{
|
||||
model_c_data *data_ptr = (model_c_data *)data;
|
||||
lf *file = data_ptr->file;
|
||||
model *current_model = data_ptr->model_ptr;
|
||||
table_model_entry *model_ptr = instruction->file_entry->model_first;
|
||||
int i;
|
||||
|
||||
while (model_ptr) {
|
||||
if (model_ptr->fields[insn_model_name] == current_model->name) {
|
||||
lf_printf(file, " {");
|
||||
for(i = insn_model_unit; i < nr_insn_model_table_fields; i++) {
|
||||
lf_printf(file, " %s,", model_ptr->fields[i]);
|
||||
}
|
||||
lf_printf(file, " },\n");
|
||||
return;
|
||||
}
|
||||
|
||||
model_ptr = model_ptr->next;
|
||||
}
|
||||
|
||||
lf_printf(file, " { 0 },\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gen_model_c(insn_table *table, lf *file)
|
||||
{
|
||||
model *model_ptr;
|
||||
model_func_unit *func_unit_ptr;
|
||||
int i;
|
||||
|
||||
lf_print_copyleft(file);
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#ifndef _MODEL_C_\n");
|
||||
lf_printf(file, "#define _MODEL_C_\n");
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#ifndef STATIC_INLINE_MODEL\n");
|
||||
lf_printf(file, "#define STATIC_INLINE_MODEL STATIC_INLINE\n");
|
||||
lf_printf(file, "#endif\n");
|
||||
lf_printf(file, "\n");
|
||||
lf_printf(file, "#include \"cpu.h\"\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "/* map model enumeration into printable string */\n");
|
||||
lf_printf(file, "const char *model_name[ (int)nr_models ] = {\n");
|
||||
lf_printf(file, " \"NONE\",\n");
|
||||
for (model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
lf_printf(file, " \"%s\",\n", model_ptr->name);
|
||||
}
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "/* Emit each model's individual function unit names */\n");
|
||||
lf_printf(file, "static const char *const model_func_unit_name_NONE[] = {\n");
|
||||
lf_printf(file, " \"none\",\n");
|
||||
lf_printf(file, " (const char *)0\n");
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
for (model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
lf_printf(file, "static const char *const model_func_unit_name_%s[] = {\n", model_ptr->name);
|
||||
lf_printf(file, " \"none\",\n");
|
||||
for (func_unit_ptr = model_ptr->func_unit_start; func_unit_ptr; func_unit_ptr = func_unit_ptr->next) {
|
||||
|
||||
if (func_unit_ptr->comment)
|
||||
lf_printf(file, " \"%s %s functional unit\",\n", func_unit_ptr->name, func_unit_ptr->comment);
|
||||
else
|
||||
lf_printf(file, " \"%s\",\n", func_unit_ptr->name);
|
||||
|
||||
for(i = 2; i < func_unit_ptr->number; i++) {
|
||||
if (func_unit_ptr->comment)
|
||||
lf_printf(file, " \"%s %s functional unit #%d\",\n", func_unit_ptr->name,
|
||||
func_unit_ptr->comment, i);
|
||||
else
|
||||
lf_printf(file, " \"%s #%d\",\n", func_unit_ptr->name, i);
|
||||
}
|
||||
}
|
||||
|
||||
lf_printf(file, " (const char *)0\n");
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
}
|
||||
|
||||
lf_printf(file, "/* Array to map model,function unit number to printable string. */\n");
|
||||
lf_printf(file, "const char *const *const model_func_unit_name[] = {\n");
|
||||
lf_printf(file, " model_func_unit_name_NONE,\n");
|
||||
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
lf_printf(file, " model_func_unit_name_%s,\n", model_ptr->name);
|
||||
}
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "/* Insn functional unit info */\n");
|
||||
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
model_c_data data;
|
||||
|
||||
lf_printf(file, "static const model_time model_time_%s[] = {\n", model_ptr->name);
|
||||
data.file = file;
|
||||
data.model_ptr = model_ptr;
|
||||
insn_table_traverse_insn(table,
|
||||
(void *)&data,
|
||||
model_c_insn);
|
||||
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
}
|
||||
|
||||
lf_printf(file, "const model_time *const model_time_mapping[] = {\n");
|
||||
lf_printf(file, " (const model_time *const)0,\n");
|
||||
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
|
||||
lf_printf(file, " model_time_%s,\n", model_ptr->name);
|
||||
}
|
||||
lf_printf(file, "};\n");
|
||||
lf_printf(file, "\n");
|
||||
|
||||
lf_printf(file, "#endif /* _MODEL_C_ */\n");
|
||||
|
||||
}
|
||||
|
||||
@ -2755,12 +3120,13 @@ main(int argc,
|
||||
printf("Output options:\n");
|
||||
printf(" -[Cc] <output-file> output icache.h(C) invalid(c)\n");
|
||||
printf(" -[Dd] <output-file> output idecode.h(D) idecode.c(d)\n");
|
||||
printf(" -[Mm] <output-file> output model.h(M) model.c(M)\n");
|
||||
printf(" -[Ss] <output-file> output schematic.h(S) schematic.c(s)\n");
|
||||
printf(" -[Tt] <table> output itable.h(T) itable.c(t)\n");
|
||||
}
|
||||
|
||||
while ((ch = getopt(argc, argv,
|
||||
"leb:h:r:f:I:i:O:o:K:k:n:S:s:D:d:T:t:C:")) != -1) {
|
||||
"leb:h:r:f:I:i:O:o:K:k:M:m:n:S:s:D:d:T:t:C:")) != -1) {
|
||||
fprintf(stderr, "\t-%c %s\n", ch, (optarg ? optarg : ""));
|
||||
switch(ch) {
|
||||
case 'l':
|
||||
@ -2822,6 +3188,8 @@ main(int argc,
|
||||
case 's':
|
||||
case 'D':
|
||||
case 'd':
|
||||
case 'M':
|
||||
case 'm':
|
||||
case 'T':
|
||||
case 't':
|
||||
case 'C':
|
||||
@ -2841,6 +3209,12 @@ main(int argc,
|
||||
case 'd':
|
||||
gen_idecode_c(instructions, file);
|
||||
break;
|
||||
case 'M':
|
||||
gen_model_h(instructions, file);
|
||||
break;
|
||||
case 'm':
|
||||
gen_model_c(instructions, file);
|
||||
break;
|
||||
case 'T':
|
||||
gen_itable_h(instructions, file);
|
||||
break;
|
||||
|
@ -62,6 +62,14 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MODEL_INLINE
|
||||
#if MODEL_INLINE == 2
|
||||
#define INLINE_MODEL static INLINE
|
||||
#else
|
||||
#define INLINE_MODEL static
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BITS_INLINE
|
||||
#if BITS_INLINE == 2
|
||||
#define INLINE_BITS static INLINE
|
||||
|
@ -131,6 +131,7 @@ print_options (void)
|
||||
printf_filtered ("WITH_FUNCTION_UNIT = %d\n", WITH_FUNCTION_UNIT);
|
||||
printf_filtered ("WITH_DEFAULT_PPC_MODEL = %s\n", options_ppc (WITH_DEFAULT_PPC_MODEL));
|
||||
printf_filtered ("WITH_PPC_MODEL = %s\n", options_ppc (WITH_PPC_MODEL));
|
||||
printf_filtered ("WITH_RESERVE_BITS = %d\n", WITH_RESERVE_BITS);
|
||||
printf_filtered ("DEFAULT_INLINE = %d\n", DEFAULT_INLINE);
|
||||
printf_filtered ("SIM_ENDIAN_INLINE = %d\n", SIM_ENDIAN_INLINE);
|
||||
printf_filtered ("BITS_INLINE = %d\n", BITS_INLINE);
|
||||
|
Loading…
Reference in New Issue
Block a user