# Generate the main loop of the simulator.
-# Copyright (C) 1996-2019 Free Software Foundation, Inc.
+# Copyright (C) 1996-2022 Free Software Foundation, Inc.
# Contributed by Cygnus Support.
#
# This file is part of the GNU simulators.
cpu="unknown"
infile=""
prefix="unknown"
+outprefix=""
outsuffix=""
while test $# -gt 0
-scache) scache=yes ;;
-pbb) pbb=yes ;;
-no-parallel) ;;
+ -outfile-prefix) shift ; outprefix=$1 ;;
-outfile-suffix) shift ; outsuffix=$1 ;;
-parallel-read) parallel=read ;;
-parallel-write) parallel=write ;;
##########################################################################
-rm -f eng${outsuffix}.hin
-exec 1>eng${outsuffix}.hin
+rm -f ${outprefix}eng${outsuffix}.hin
+exec 1>${outprefix}eng${outsuffix}.hin
echo "/* engine configuration for ${cpu} */"
echo ""
##########################################################################
-rm -f tmp-mloop-$$.cin mloop${outsuffix}.cin
-exec 1>tmp-mloop-$$.cin
+rm -f ${outprefix}tmp-mloop-$$.cin ${outprefix}mloop${outsuffix}.cin
+exec 1>${outprefix}tmp-mloop-$$.cin
# We use @cpu@ instead of ${cpu} because we still need to run sed to handle
# transformation of @cpu@ for mainloop.in, so there's no need to use ${cpu}
cat << EOF
/* This file is generated by the genmloop script. DO NOT EDIT! */
+/* This must come before any other includes. */
+#include "defs.h"
+
/* Enable switch() support in cgen headers. */
#define SEM_IN_SWITCH
#define WANT_CPU @cpu@
#define WANT_CPU_@CPU@
-#include "sim-main.h"
+#include "ansidecl.h"
#include "bfd.h"
+
+#include "sim-main.h"
#include "cgen-mem.h"
#include "cgen-ops.h"
#include "sim-assert.h"
This is as opposed to x-after which is only emitted at the end of a group
of parallel insns. */
-static INLINE void
+ATTRIBUTE_UNUSED static INLINE void
@prefix@_emit_before (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc, int first_p)
{
ARGBUF *abuf = &sc[0].argbuf;
x-after is emitted after a serial insn or at the end of a group of
parallel insns. */
-static INLINE void
+ATTRIBUTE_UNUSED static INLINE void
@prefix@_emit_after (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc)
{
ARGBUF *abuf = &sc[0].argbuf;
# Expand @..@ macros appearing in tmp-mloop-{pid}.cin.
sed \
-e "s/@cpu@/$cpu/g" -e "s/@CPU@/$CPU/g" \
- -e "s/@prefix@/$prefix/g" -e "s/@PREFIX@/$PREFIX/g" < tmp-mloop-$$.cin > mloop${outsuffix}.cin
+ -e "s/@prefix@/$prefix/g" -e "s/@PREFIX@/$PREFIX/g" \
+ < ${outprefix}tmp-mloop-$$.cin > ${outprefix}mloop${outsuffix}.cin
rc=$?
-rm -f tmp-mloop-$$.cin
+rm -f ${outprefix}tmp-mloop-$$.cin
exit $rc