public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: igen: support in-place updates ourself
@ 2022-12-25  2:35 Mike Frysinger
  2022-12-25  2:37 ` [PATCH] sim: igen: drop move-if-changed usage Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2022-12-25  2:35 UTC (permalink / raw)
  To: gdb-patches

Every file that igen outputs is then processed with the move-if-changed
shell script.  This creates a lot of boilerplate in the build and not an
insignificant amount of build-time overhead.  Move the simple "is the file
changed" logic into igen itself.
---
 sim/igen/lf.c | 79 ++++++++++++++++++++++++++++++++++++++++++-----
 sim/ppc/lf.c  | 85 +++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 148 insertions(+), 16 deletions(-)

diff --git a/sim/igen/lf.c b/sim/igen/lf.c
index ca7a56ab0aa3..9316dd6d1588 100644
--- a/sim/igen/lf.c
+++ b/sim/igen/lf.c
@@ -20,7 +20,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <ctype.h>
@@ -37,7 +37,9 @@ struct _lf
   int line_nr;			/* nr complete lines written, curr line is line_nr+1 */
   int indent;
   int line_blank;
-  const char *name;
+  const char *name;		/* Output name with diagnostics.  */
+  const char *filename;		/* Output filename.  */
+  char *tmpname;		/* Temporary output filename.  */
   const char *program;
   lf_file_references references;
   lf_file_type type;
@@ -56,6 +58,7 @@ lf_open (const char *name,
   new_lf->references = references;
   new_lf->type = type;
   new_lf->name = (real_name == NULL ? name : real_name);
+  new_lf->filename = name;
   new_lf->program = program;
   /* attach to stdout if pipe */
   if (!strcmp (name, "-"))
@@ -65,7 +68,11 @@ lf_open (const char *name,
   else
     {
       /* create a new file */
-      new_lf->stream = fopen (name, "w");
+      char *tmpname = zalloc (strlen (name) + 5);
+      sprintf (tmpname, "%s.tmp", name);
+      new_lf->filename = name;
+      new_lf->tmpname = tmpname;
+      new_lf->stream = fopen (tmpname, "w+");
       if (new_lf->stream == NULL)
 	{
 	  perror (name);
@@ -86,15 +93,73 @@ lf_get_file_type (const lf *file)
 void
 lf_close (lf *file)
 {
-  if (file->stream != stdout)
+  FILE *fp;
+  bool update = true;
+
+  /* If we wrote to stdout, no house keeping needed.  */
+  if (file->stream == stdout)
+    return;
+
+  /* Rename the temp file to the real file if it's changed.  */
+  fp = fopen (file->filename, "r");
+  if (fp != NULL)
     {
-      if (fclose (file->stream))
+      off_t len;
+
+      fseek (fp, 0, SEEK_END);
+      len = ftell (fp);
+
+      if (len == ftell (file->stream))
 	{
-	  perror ("lf_close.fclose");
+	  off_t off;
+	  size_t cnt;
+	  char *oldbuf = zalloc (len);
+	  char *newbuf = zalloc (len);
+
+	  rewind (fp);
+	  off = 0;
+	  while ((cnt = fread (oldbuf + off, 1, len - off, fp)) > 0)
+	    off += cnt;
+	  ASSERT (off == len);
+
+	  rewind (file->stream);
+	  off = 0;
+	  while ((cnt = fread (newbuf + off, 1, len - off, file->stream)) > 0)
+	    off += cnt;
+	  ASSERT (off == len);
+
+	  if (memcmp (oldbuf, newbuf, len) == 0)
+	    update = false;
+	}
+
+      fclose (fp);
+    }
+
+  if (fclose (file->stream))
+    {
+      perror ("lf_close.fclose");
+      exit (1);
+    }
+
+  if (update)
+    {
+      if (rename (file->tmpname, file->filename) != 0)
+	{
+	  perror ("lf_close.rename");
+	  exit (1);
+	}
+    }
+  else
+    {
+      if (remove (file->tmpname) != 0)
+	{
+	  perror ("lf_close.unlink");
 	  exit (1);
 	}
-      free (file);
     }
+
+  free (file->tmpname);
+  free (file);
 }
 
 
diff --git a/sim/ppc/lf.c b/sim/ppc/lf.c
index c40de5b5c5db..e170a47b0902 100644
--- a/sim/ppc/lf.c
+++ b/sim/ppc/lf.c
@@ -17,7 +17,7 @@
 
     */
 
-
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <ctype.h>
@@ -34,7 +34,9 @@ struct _lf {
   int line_nr; /* nr complete lines written, curr line is line_nr+1 */
   int indent;
   int line_blank;
-  const char *name;
+  const char *name;		/* Output name with diagnostics.  */
+  const char *filename;		/* Output filename.  */
+  char *tmpname;		/* Temporary output filename.  */
   const char *program;
   lf_file_references references;
   lf_file_type type;
@@ -54,6 +56,7 @@ lf_open(const char *name,
   new_lf->references = references;
   new_lf->type = type;
   new_lf->name = (real_name == NULL ? name : real_name);
+  new_lf->filename = name;
   new_lf->program = program;
   /* attach to stdout if pipe */
   if (!strcmp(name, "-")) {
@@ -61,7 +64,11 @@ lf_open(const char *name,
   }
   else {
     /* create a new file */
-    new_lf->stream = fopen(name, "w");
+    char *tmpname = zalloc (strlen (name) + 5);
+    sprintf (tmpname, "%s.tmp", name);
+    new_lf->filename = name;
+    new_lf->tmpname = tmpname;
+    new_lf->stream = fopen(tmpname, "w+");
     if (new_lf->stream == NULL) {
       perror(name);
       exit(1);
@@ -74,13 +81,73 @@ lf_open(const char *name,
 void
 lf_close(lf *file)
 {
-  if (file->stream != stdout) {
-    if (fclose(file->stream)) {
-      perror("lf_close.fclose");
-      exit(1);
+  FILE *fp;
+  bool update = true;
+
+  /* If we wrote to stdout, no house keeping needed.  */
+  if (file->stream == stdout)
+    return;
+
+  /* Rename the temp file to the real file if it's changed.  */
+  fp = fopen (file->filename, "r");
+  if (fp != NULL)
+    {
+      off_t len;
+
+      fseek (fp, 0, SEEK_END);
+      len = ftell (fp);
+
+      if (len == ftell (file->stream))
+	{
+	  off_t off;
+	  size_t cnt;
+	  char *oldbuf = zalloc (len);
+	  char *newbuf = zalloc (len);
+
+	  rewind (fp);
+	  off = 0;
+	  while ((cnt = fread (oldbuf + off, 1, len - off, fp)) > 0)
+	    off += cnt;
+	  ASSERT (off == len);
+
+	  rewind (file->stream);
+	  off = 0;
+	  while ((cnt = fread (newbuf + off, 1, len - off, file->stream)) > 0)
+	    off += cnt;
+	  ASSERT (off == len);
+
+	  if (memcmp (oldbuf, newbuf, len) == 0)
+	    update = false;
+	}
+
+      fclose (fp);
     }
-    free(file);
-  }
+
+  if (fclose (file->stream))
+    {
+      perror ("lf_close.fclose");
+      exit (1);
+    }
+
+  if (update)
+    {
+      if (rename (file->tmpname, file->filename) != 0)
+	{
+	  perror ("lf_close.rename");
+	  exit (1);
+	}
+    }
+  else
+    {
+      if (remove (file->tmpname) != 0)
+	{
+	  perror ("lf_close.unlink");
+	  exit (1);
+	}
+    }
+
+  free (file->tmpname);
+  free (file);
 }
 
 
-- 
2.39.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] sim: igen: drop move-if-changed usage
  2022-12-25  2:35 [PATCH] sim: igen: support in-place updates ourself Mike Frysinger
@ 2022-12-25  2:37 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2022-12-25  2:37 UTC (permalink / raw)
  To: gdb-patches

Now that igen itself has this logic, drop these custom build rules
to greatly simplify.
---
 sim/Makefile.in      |  90 +++++----------
 sim/mips/Makefile.in | 261 ++++++++++++++-----------------------------
 sim/mn10300/local.mk |  45 +++-----
 sim/ppc/Makefile.in  |  36 ++----
 sim/v850/local.mk    |  45 +++-----
 5 files changed, 155 insertions(+), 322 deletions(-)

diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index fa32aace282b..25b6c65bfeee 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -149,36 +149,21 @@ tmp-igen: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-i $(IGEN_INSN) \
 		-o $(IGEN_DC) \
 		-x \
-		-n icache.h    -hc tmp-icache.h \
-		-n icache.c    -c  tmp-icache.c \
-		-n semantics.h -hs tmp-semantics.h \
-		-n semantics.c -s  tmp-semantics.c \
-		-n idecode.h   -hd tmp-idecode.h \
-		-n idecode.c   -d  tmp-idecode.c \
-		-n model.h     -hm tmp-model.h \
-		-n model.c     -m  tmp-model.c \
-		-n support.h   -hf tmp-support.h \
-		-n support.c   -f  tmp-support.c \
-		-n itable.h    -ht tmp-itable.h \
-		-n itable.c    -t  tmp-itable.c \
-		-n engine.h    -he tmp-engine.h \
-		-n engine.c    -e  tmp-engine.c \
-		-n irun.c      -r  tmp-irun.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c support.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.h itable.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.c itable.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-engine.h engine.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-engine.c engine.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-irun.c irun.c
+		-n icache.h    -hc icache.h \
+		-n icache.c    -c  icache.c \
+		-n semantics.h -hs semantics.h \
+		-n semantics.c -s  semantics.c \
+		-n idecode.h   -hd idecode.h \
+		-n idecode.c   -d  idecode.c \
+		-n model.h     -hm model.h \
+		-n model.c     -m  model.c \
+		-n support.h   -hf support.h \
+		-n support.c   -f  support.c \
+		-n itable.h    -ht itable.h \
+		-n itable.c    -t  itable.c \
+		-n engine.h    -he engine.h \
+		-n engine.c    -e  engine.c \
+		-n irun.c      -r  irun.c
 	$(SILENCE) touch $@
 
 BUILT_SRC_FROM_M16 = \
@@ -221,27 +206,17 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-o $(M16_DC) \
 		-P m16_ \
 		-x \
-		-n m16_icache.h    -hc tmp-icache.h \
-		-n m16_icache.c    -c  tmp-icache.c \
-		-n m16_semantics.h -hs tmp-semantics.h \
-		-n m16_semantics.c -s  tmp-semantics.c \
-		-n m16_idecode.h   -hd tmp-idecode.h \
-		-n m16_idecode.c   -d  tmp-idecode.c \
-		-n m16_model.h     -hm tmp-model.h \
-		-n m16_model.c     -m  tmp-model.c \
-		-n m16_support.h   -hf tmp-support.h \
-		-n m16_support.c   -f  tmp-support.c \
+		-n m16_icache.h    -hc m16_icache.h \
+		-n m16_icache.c    -c  m16_icache.c \
+		-n m16_semantics.h -hs m16_semantics.h \
+		-n m16_semantics.c -s  m16_semantics.c \
+		-n m16_idecode.h   -hd m16_idecode.h \
+		-n m16_idecode.c   -d  m16_idecode.c \
+		-n m16_model.h     -hm m16_model.h \
+		-n m16_model.c     -m  m16_model.c \
+		-n m16_support.h   -hf m16_support.h \
+		-n m16_support.c   -f  m16_support.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h m16_icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c m16_icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h m16_idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c m16_idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h m16_semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c m16_semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h m16_model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c m16_model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h m16_support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c m16_support.c
 	$(ECHO_IGEN) $(IGEN_RUN) \
 		$(IGEN_TRACE) \
 		-I $(srcdir) \
@@ -256,27 +231,17 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-o $(IGEN_DC) \
 		-P m32_ \
 		-x \
-		-n m32_icache.h    -hc tmp-icache.h \
-		-n m32_icache.c    -c  tmp-icache.c \
-		-n m32_semantics.h -hs tmp-semantics.h \
-		-n m32_semantics.c -s  tmp-semantics.c \
-		-n m32_idecode.h   -hd tmp-idecode.h \
-		-n m32_idecode.c   -d  tmp-idecode.c \
-		-n m32_model.h     -hm tmp-model.h \
-		-n m32_model.c     -m  tmp-model.c \
-		-n m32_support.h   -hf tmp-support.h \
-		-n m32_support.c   -f  tmp-support.c \
+		-n m32_icache.h    -hc m32_icache.h \
+		-n m32_icache.c    -c  m32_icache.c \
+		-n m32_semantics.h -hs m32_semantics.h \
+		-n m32_semantics.c -s  m32_semantics.c \
+		-n m32_idecode.h   -hd m32_idecode.h \
+		-n m32_idecode.c   -d  m32_idecode.c \
+		-n m32_model.h     -hm m32_model.h \
+		-n m32_model.c     -m  m32_model.c \
+		-n m32_support.h   -hf m32_support.h \
+		-n m32_support.c   -f  m32_support.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h m32_icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c m32_icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h m32_idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c m32_idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h m32_semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c m32_semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h m32_model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c m32_model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h m32_support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c m32_support.c
 	$(ECHO_IGEN) $(IGEN_RUN) \
 		$(IGEN_TRACE) \
 		-I $(srcdir) \
@@ -287,11 +252,9 @@ tmp-m16: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-G gen-direct-access \
 		-G gen-zero-r0 \
 		-i $(IGEN_INSN) \
-		-n itable.h    -ht tmp-itable.h \
-		-n itable.c    -t  tmp-itable.c \
+		-n itable.h    -ht itable.h \
+		-n itable.c    -t  itable.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.h itable.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.c itable.c
 	$(SILENCE) touch $@
 
 BUILT_SRC_FROM_MICROMIPS = \
@@ -345,27 +308,17 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-o $(MICROMIPS16_DC) \
 		-P micromips16_ \
 		-x \
-		-n micromips16_icache.h    -hc tmp-icache.h \
-		-n micromips16_icache.c    -c  tmp-icache.c \
-		-n micromips16_semantics.h -hs tmp-semantics.h \
-		-n micromips16_semantics.c -s  tmp-semantics.c \
-		-n micromips16_idecode.h   -hd tmp-idecode.h \
-		-n micromips16_idecode.c   -d  tmp-idecode.c \
-		-n micromips16_model.h     -hm tmp-model.h \
-		-n micromips16_model.c     -m  tmp-model.c \
-		-n micromips16_support.h   -hf tmp-support.h \
-		-n micromips16_support.c   -f  tmp-support.c \
+		-n micromips16_icache.h    -hc micromips16_icache.h \
+		-n micromips16_icache.c    -c  micromips16_icache.c \
+		-n micromips16_semantics.h -hs micromips16_semantics.h \
+		-n micromips16_semantics.c -s  micromips16_semantics.c \
+		-n micromips16_idecode.h   -hd micromips16_idecode.h \
+		-n micromips16_idecode.c   -d  micromips16_idecode.c \
+		-n micromips16_model.h     -hm micromips16_model.h \
+		-n micromips16_model.c     -m  micromips16_model.c \
+		-n micromips16_support.h   -hf micromips16_support.h \
+		-n micromips16_support.c   -f  micromips16_support.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h micromips16_icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c micromips16_icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h micromips16_idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c micromips16_idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h micromips16_semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c micromips16_semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h micromips16_model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c micromips16_model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h micromips16_support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c micromips16_support.c
 	$(ECHO_IGEN) $(IGEN_RUN) \
 		$(IGEN_TRACE) \
 		-I $(srcdir) \
@@ -380,27 +333,17 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-o $(MICROMIPS32_DC) \
 		-P micromips32_ \
 		-x \
-		-n micromips32_icache.h    -hc tmp-icache.h \
-		-n micromips32_icache.c    -c  tmp-icache.c \
-		-n micromips32_semantics.h -hs tmp-semantics.h \
-		-n micromips32_semantics.c -s  tmp-semantics.c \
-		-n micromips32_idecode.h   -hd tmp-idecode.h \
-		-n micromips32_idecode.c   -d  tmp-idecode.c \
-		-n micromips32_model.h     -hm tmp-model.h \
-		-n micromips32_model.c     -m  tmp-model.c \
-		-n micromips32_support.h   -hf tmp-support.h \
-		-n micromips32_support.c   -f  tmp-support.c \
+		-n micromips32_icache.h    -hc micromips32_icache.h \
+		-n micromips32_icache.c    -c  micromips32_icache.c \
+		-n micromips32_semantics.h -hs micromips32_semantics.h \
+		-n micromips32_semantics.c -s  micromips32_semantics.c \
+		-n micromips32_idecode.h   -hd micromips32_idecode.h \
+		-n micromips32_idecode.c   -d  micromips32_idecode.c \
+		-n micromips32_model.h     -hm micromips32_model.h \
+		-n micromips32_model.c     -m  micromips32_model.c \
+		-n micromips32_support.h   -hf micromips32_support.h \
+		-n micromips32_support.c   -f  micromips32_support.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h micromips32_icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c micromips32_icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h micromips32_idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c micromips32_idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h micromips32_semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c micromips32_semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h micromips32_model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c micromips32_model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h micromips32_support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c micromips32_support.c
 	$(ECHO_IGEN) $(IGEN_RUN) \
 		$(IGEN_TRACE) \
 		-I $(srcdir) \
@@ -415,27 +358,17 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-o $(IGEN_DC) \
 		-P micromips_m32_ \
 		-x \
-		-n micromips_m32_icache.h    -hc tmp-icache.h \
-		-n micromips_m32_icache.c    -c  tmp-icache.c \
-		-n micromips_m32_semantics.h -hs tmp-semantics.h \
-		-n micromips_m32_semantics.c -s  tmp-semantics.c \
-		-n micromips_m32_idecode.h   -hd tmp-idecode.h \
-		-n micromips_m32_idecode.c   -d  tmp-idecode.c \
-		-n micromips_m32_model.h     -hm tmp-model.h \
-		-n micromips_m32_model.c     -m  tmp-model.c \
-		-n micromips_m32_support.h   -hf tmp-support.h \
-		-n micromips_m32_support.c   -f  tmp-support.c \
+		-n micromips_m32_icache.h    -hc micromips_m32_icache.h \
+		-n micromips_m32_icache.c    -c  micromips_m32_icache.c \
+		-n micromips_m32_semantics.h -hs micromips_m32_semantics.h \
+		-n micromips_m32_semantics.c -s  micromips_m32_semantics.c \
+		-n micromips_m32_idecode.h   -hd micromips_m32_idecode.h \
+		-n micromips_m32_idecode.c   -d  micromips_m32_idecode.c \
+		-n micromips_m32_model.h     -hm micromips_m32_model.h \
+		-n micromips_m32_model.c     -m  micromips_m32_model.c \
+		-n micromips_m32_support.h   -hf micromips_m32_support.h \
+		-n micromips_m32_support.c   -f  micromips_m32_support.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h micromips_m32_icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c micromips_m32_icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h micromips_m32_idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c micromips_m32_idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h micromips_m32_semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c micromips_m32_semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h micromips_m32_model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c micromips_m32_model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h micromips_m32_support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c micromips_m32_support.c
 	$(ECHO_IGEN) $(IGEN_RUN) \
 		$(IGEN_TRACE) \
 		-I $(srcdir) \
@@ -446,11 +379,9 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-G gen-direct-access \
 		-G gen-zero-r0 \
 		-i $(IGEN_INSN) \
-		-n itable.h    -ht tmp-itable.h \
-		-n itable.c    -t  tmp-itable.c \
+		-n itable.h    -ht itable.h \
+		-n itable.c    -t  itable.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.h itable.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.c itable.c
 	$(SILENCE) touch $@
 
 BUILT_SRC_FROM_MULTI = @sim_multi_src@
@@ -489,43 +420,19 @@ tmp-mach-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-i $(IGEN_INSN) \
 		-P $${p}_ \
 		-x \
-		-n $${p}_icache.h    -hc tmp-icache.h \
-		-n $${p}_icache.c    -c  tmp-icache.c \
-		-n $${p}_semantics.h -hs tmp-semantics.h \
-		-n $${p}_semantics.c -s  tmp-semantics.c \
-		-n $${p}_idecode.h   -hd tmp-idecode.h \
-		-n $${p}_idecode.c   -d  tmp-idecode.c \
-		-n $${p}_model.h     -hm tmp-model.h \
-		-n $${p}_model.c     -m  tmp-model.c \
-		-n $${p}_support.h   -hf tmp-support.h \
-		-n $${p}_support.c   -f  tmp-support.c \
-		-n $${p}_engine.h    -he tmp-engine.h \
-		-n $${p}_engine.c    -e  tmp-engine.c \
+		-n $${p}_icache.h    -hc $${p}_icache.h \
+		-n $${p}_icache.c    -c  $${p}_icache.c \
+		-n $${p}_semantics.h -hs $${p}_semantics.h \
+		-n $${p}_semantics.c -s  $${p}_semantics.c \
+		-n $${p}_idecode.h   -hd $${p}_idecode.h \
+		-n $${p}_idecode.c   -d  $${p}_idecode.c \
+		-n $${p}_model.h     -hm $${p}_model.h \
+		-n $${p}_model.c     -m  $${p}_model.c \
+		-n $${p}_support.h   -hf $${p}_support.h \
+		-n $${p}_support.c   -f  $${p}_support.c \
+		-n $${p}_engine.h    -he $${p}_engine.h \
+		-n $${p}_engine.c    -e  $${p}_engine.c \
 	  || exit; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-icache.h \
-						  $${p}_icache.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-icache.c \
-						  $${p}_icache.c ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-idecode.h \
-						  $${p}_idecode.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-idecode.c \
-						  $${p}_idecode.c ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-semantics.h \
-						  $${p}_semantics.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-semantics.c \
-						  $${p}_semantics.c ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-model.h \
-						  $${p}_model.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-model.c \
-						  $${p}_model.c ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-support.h \
-						  $${p}_support.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-support.c \
-						  $${p}_support.c ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-engine.h \
-						  $${p}_engine.h ; \
-	  $(SHELL) $(srcdir)/../../move-if-change tmp-engine.c \
-						  $${p}_engine.c ; \
 	done
 	$(SILENCE) touch $@
 tmp-itable-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
@@ -540,11 +447,9 @@ tmp-itable-multi: $(IGEN_INSN) $(IGEN_DC) $(IGEN) $(IGEN_INCLUDE)
 		-G gen-direct-access \
 		-G gen-zero-r0 \
 		-i $(IGEN_INSN) \
-		-n itable.h    -ht tmp-itable.h \
-		-n itable.c    -t  tmp-itable.c \
+		-n itable.h    -ht itable.h \
+		-n itable.c    -t  itable.c \
 		#
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.h itable.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.c itable.c
 	$(SILENCE) touch $@
 tmp-run-multi: $(srcdir)/m16run.c $(srcdir)/micromipsrun.c
 	for t in $(SIM_MULTI_IGEN_CONFIGS); do \
diff --git a/sim/mn10300/local.mk b/sim/mn10300/local.mk
index 70b442fe1a0d..cd897c58d74d 100644
--- a/sim/mn10300/local.mk
+++ b/sim/mn10300/local.mk
@@ -66,36 +66,21 @@ $(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
 		-i $(%C%_IGEN_INSN) \
 		-o $(%C%_IGEN_DC) \
 		-x \
-		-n icache.h    -hc %D%/tmp-icache.h \
-		-n icache.c    -c  %D%/tmp-icache.c \
-		-n semantics.h -hs %D%/tmp-semantics.h \
-		-n semantics.c -s  %D%/tmp-semantics.c \
-		-n idecode.h   -hd %D%/tmp-idecode.h \
-		-n idecode.c   -d  %D%/tmp-idecode.c \
-		-n model.h     -hm %D%/tmp-model.h \
-		-n model.c     -m  %D%/tmp-model.c \
-		-n support.h   -hf %D%/tmp-support.h \
-		-n support.c   -f  %D%/tmp-support.c \
-		-n itable.h    -ht %D%/tmp-itable.h \
-		-n itable.c    -t  %D%/tmp-itable.c \
-		-n engine.h    -he %D%/tmp-engine.h \
-		-n engine.c    -e  %D%/tmp-engine.c \
-		-n irun.c      -r  %D%/tmp-irun.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-icache.h %D%/icache.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-icache.c %D%/icache.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-idecode.h %D%/idecode.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-idecode.c %D%/idecode.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-semantics.h %D%/semantics.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-semantics.c %D%/semantics.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-model.h %D%/model.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-model.c %D%/model.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-support.h %D%/support.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-support.c %D%/support.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-itable.h %D%/itable.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-itable.c %D%/itable.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-engine.h %D%/engine.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-engine.c %D%/engine.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-irun.c %D%/irun.c
+		-n icache.h    -hc %D%/icache.h \
+		-n icache.c    -c  %D%/icache.c \
+		-n semantics.h -hs %D%/semantics.h \
+		-n semantics.c -s  %D%/semantics.c \
+		-n idecode.h   -hd %D%/idecode.h \
+		-n idecode.c   -d  %D%/idecode.c \
+		-n model.h     -hm %D%/model.h \
+		-n model.c     -m  %D%/model.c \
+		-n support.h   -hf %D%/support.h \
+		-n support.c   -f  %D%/support.c \
+		-n itable.h    -ht %D%/itable.h \
+		-n itable.c    -t  %D%/itable.c \
+		-n engine.h    -he %D%/engine.h \
+		-n engine.c    -e  %D%/engine.c \
+		-n irun.c      -r  %D%/irun.c
 	$(AM_V_at)touch $@
 
 MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 5f58ccf8b50b..f76c66254c07 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -601,30 +601,18 @@ tmp-igen: igen $(srcdir)/powerpc.igen $(srcdir)/altivec.igen $(srcdir)/e500.igen
 	$(ECHO_GEN) $(IGEN) $(IGEN_FLAGS) \
 		-o $(srcdir)/$(IGEN_OPCODE_RULES) \
 		-I $(srcdir) -i $(srcdir)/powerpc.igen \
-		-n icache.h    -hc tmp-icache.h \
-		-n icache.c    -c  tmp-icache.c \
-		-n semantics.h -hs tmp-semantics.h \
-		-n semantics.c -s  tmp-semantics.c \
-		-n idecode.h   -hd tmp-idecode.h \
-		-n idecode.c   -d  tmp-idecode.c \
-		-n itable.h    -ht tmp-itable.h \
-		-n itable.c    -t  tmp-itable.c \
-		-n model.h     -hm tmp-model.h \
-		-n model.c     -m  tmp-model.c \
-		-n support.h   -hf tmp-support.h \
-		-n support.c   -f  tmp-support.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.h icache.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-icache.c icache.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.h idecode.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-idecode.c idecode.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.h semantics.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-semantics.c semantics.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.h itable.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-itable.c itable.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.h model.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-model.c model.c
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.h support.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-support.c support.c
+		-n icache.h    -hc icache.h \
+		-n icache.c    -c  icache.c \
+		-n semantics.h -hs semantics.h \
+		-n semantics.c -s  semantics.c \
+		-n idecode.h   -hd idecode.h \
+		-n idecode.c   -d  idecode.c \
+		-n itable.h    -ht itable.h \
+		-n itable.c    -t  itable.c \
+		-n model.h     -hm model.h \
+		-n model.c     -m  model.c \
+		-n support.h   -hf support.h \
+		-n support.c   -f  support.c
 	$(SILENCE) touch $@
 
 # NOTE: Some versions of make don't handle files created as side-effects
diff --git a/sim/v850/local.mk b/sim/v850/local.mk
index f5d47882dcec..6e1a23c46d5d 100644
--- a/sim/v850/local.mk
+++ b/sim/v850/local.mk
@@ -60,36 +60,21 @@ $(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
 		-i $(%C%_IGEN_INSN) \
 		-o $(%C%_IGEN_DC) \
 		-x \
-		-n icache.h    -hc %D%/tmp-icache.h \
-		-n icache.c    -c  %D%/tmp-icache.c \
-		-n semantics.h -hs %D%/tmp-semantics.h \
-		-n semantics.c -s  %D%/tmp-semantics.c \
-		-n idecode.h   -hd %D%/tmp-idecode.h \
-		-n idecode.c   -d  %D%/tmp-idecode.c \
-		-n model.h     -hm %D%/tmp-model.h \
-		-n model.c     -m  %D%/tmp-model.c \
-		-n support.h   -hf %D%/tmp-support.h \
-		-n support.c   -f  %D%/tmp-support.c \
-		-n itable.h    -ht %D%/tmp-itable.h \
-		-n itable.c    -t  %D%/tmp-itable.c \
-		-n engine.h    -he %D%/tmp-engine.h \
-		-n engine.c    -e  %D%/tmp-engine.c \
-		-n irun.c      -r  %D%/tmp-irun.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-icache.h %D%/icache.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-icache.c %D%/icache.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-idecode.h %D%/idecode.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-idecode.c %D%/idecode.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-semantics.h %D%/semantics.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-semantics.c %D%/semantics.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-model.h %D%/model.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-model.c %D%/model.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-support.h %D%/support.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-support.c %D%/support.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-itable.h %D%/itable.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-itable.c %D%/itable.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-engine.h %D%/engine.h
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-engine.c %D%/engine.c
-	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/tmp-irun.c %D%/irun.c
+		-n icache.h    -hc %D%/icache.h \
+		-n icache.c    -c  %D%/icache.c \
+		-n semantics.h -hs %D%/semantics.h \
+		-n semantics.c -s  %D%/semantics.c \
+		-n idecode.h   -hd %D%/idecode.h \
+		-n idecode.c   -d  %D%/idecode.c \
+		-n model.h     -hm %D%/model.h \
+		-n model.c     -m  %D%/model.c \
+		-n support.h   -hf %D%/support.h \
+		-n support.c   -f  %D%/support.c \
+		-n itable.h    -ht %D%/itable.h \
+		-n itable.c    -t  %D%/itable.c \
+		-n engine.h    -he %D%/engine.h \
+		-n engine.c    -e  %D%/engine.c \
+		-n irun.c      -r  %D%/irun.c
 	$(AM_V_at)touch $@
 
 MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
-- 
2.39.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-25  2:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-25  2:35 [PATCH] sim: igen: support in-place updates ourself Mike Frysinger
2022-12-25  2:37 ` [PATCH] sim: igen: drop move-if-changed usage Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).