* genmloop.sh (engine_resume): Update insn_count before exiting.
[deliverable/binutils-gdb.git] / sim / common / genmloop.sh
index 31716d117d5da5c677c44cc4f8e73008c3e63859..e2a283cbec9065712fc5fcfb309d187a8b7b0705 100644 (file)
@@ -48,7 +48,7 @@ cat <<EOF
 /* This file is is generated by the genmloop script.  DO NOT EDIT! */
 
 /* Main loop for CGEN-based simulators.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of the GNU simulators.
@@ -188,12 +188,16 @@ engine_resume (SIM_DESC sd, int step, int siggnal)
   engine->jmpbuf = &buf;
   if (setjmp (buf))
     {
+      /* Account for the last insn executed.  */
+      ++insn_count;
+
       engine->jmpbuf = NULL;
       TRACE_INSN_FINI ((sim_cpu *) cpu);
       PROFILE_EXEC_TIME (CPU_PROFILE_DATA (cpu))
        += sim_elapsed_time_since (start_time);
       PROFILE_TOTAL_INSN_COUNT (CPU_PROFILE_DATA (cpu))
        += insn_count;
+
       return;
     }
 
@@ -232,6 +236,8 @@ cat <<EOF
 
 EOF
 
+##########################################################################
+
 if [ x$scache = xyes ] ; then
        cat <<EOF
 
@@ -247,8 +253,28 @@ ${parallel+  int icount = 0;}
 EOF
 
 # Any initialization code before looping starts.
+# Note that this code may declare some locals.
 ${SHELL} $file init
 
+if [ x$parallel = xyes ] ; then
+cat << EOF
+
+#if defined (HAVE_PARALLEL_EXEC) && defined (__GNUC__)
+  {
+    static read_init_p = 0;
+    if (! read_init_p)
+      {
+/* ??? Later maybe paste read.c in when building mainloop.c.  */
+#define DEFINE_LABELS
+#include "readx.c"
+       read_init_p = 1;
+      }
+  }
+#endif
+
+EOF
+fi
+
 cat <<EOF
 
   do
@@ -285,6 +311,9 @@ cat <<EOF
        else
          {
            PROFILE_COUNT_SCACHE_HIT (current_cpu);
+           /* Make core access statistics come out right.
+              The size is a guess, but it's currently not used either.  */
+           PROFILE_COUNT_CORE (current_cpu, pc, 2, sim_core_execute_map);
          }
 
 /* begin full-exec-scache */
@@ -305,6 +334,8 @@ cat <<EOF
 }
 EOF
 
+##########################################################################
+
 else # ! WITH_SCACHE
        cat <<EOF
 
@@ -321,8 +352,28 @@ ${parallel+  int icount = 0;}
 EOF
 
 # Any initialization code before looping starts.
+# Note that this code may declare some locals.
 ${SHELL} $file init
 
+if [ x$parallel = xyes ] ; then
+cat << EOF
+
+#if defined (HAVE_PARALLEL_EXEC) && defined (__GNUC__)
+  {
+    static read_init_p = 0;
+    if (! read_init_p)
+      {
+/* ??? Later maybe paste read.c in when building mainloop.c.  */
+#define DEFINE_LABELS
+#include "readx.c"
+       read_init_p = 1;
+      }
+  }
+#endif
+
+EOF
+fi
+
 cat <<EOF
 
   do
@@ -354,6 +405,8 @@ cat <<EOF
 EOF
 fi # ! WITH_SCACHE
 
+##########################################################################
+
 if [ x$fast = xyes ] ; then
     if [ x$scache = xyes ] ; then
        cat <<EOF
@@ -369,8 +422,28 @@ ${parallel+  int icount = 0;}
 EOF
 
 # Any initialization code before looping starts.
+# Note that this code may declare some locals.
 ${SHELL} $file init
 
+if [ x$parallel = xyes ] ; then
+cat << EOF
+
+#if defined (HAVE_PARALLEL_EXEC) && defined (__GNUC__)
+  {
+    static read_init_p = 0;
+    if (! read_init_p)
+      {
+/* ??? Later maybe paste read.c in when building mainloop.c.  */
+#define DEFINE_LABELS
+#include "readx.c"
+       read_init_p = 1;
+      }
+  }
+#endif
+
+EOF
+fi
+
 cat <<EOF
 
 #if defined (WITH_SEM_SWITCH_FAST) && defined (__GNUC__)
@@ -430,6 +503,8 @@ cat <<EOF
 
 EOF
 
+##########################################################################
+
 else # ! WITH_SCACHE
        cat <<EOF
 
@@ -446,8 +521,28 @@ ${parallel+  int icount = 0;}
 EOF
 
 # Any initialization code before looping starts.
+# Note that this code may declare some locals.
 ${SHELL} $file init
 
+if [ x$parallel = xyes ] ; then
+cat << EOF
+
+#if defined (HAVE_PARALLEL_EXEC) && defined (__GNUC__)
+  {
+    static read_init_p = 0;
+    if (! read_init_p)
+      {
+/* ??? Later maybe paste read.c in when building mainloop.c.  */
+#define DEFINE_LABELS
+#include "readx.c"
+       read_init_p = 1;
+      }
+  }
+#endif
+
+EOF
+fi
+
 cat <<EOF
 
   do
This page took 0.024132 seconds and 4 git commands to generate.