sim: ppc: unify igen filter_filename implementations
authorMike Frysinger <vapier@gentoo.org>
Mon, 1 Jan 2024 21:44:50 +0000 (16:44 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 1 Jan 2024 22:06:50 +0000 (17:06 -0500)
Now that both igen implementations are in the top-level, we can unify
the filter_filename implementation between them since they're the same
(literally the same code).

sim/Makefile.in
sim/ppc/Makefile.in
sim/ppc/filter_filename.c [deleted file]
sim/ppc/filter_filename.h [deleted file]
sim/ppc/filter_host.c [deleted file]
sim/ppc/local.mk
sim/ppc/misc.h

index d6d2c13..cc00ca0 100644 (file)
@@ -805,11 +805,11 @@ or1k_libsim_a_AR = $(AR) $(ARFLAGS)
 or1k_libsim_a_OBJECTS = $(am_or1k_libsim_a_OBJECTS) \
        $(nodist_or1k_libsim_a_OBJECTS)
 ppc_libigen_a_AR = $(AR) $(ARFLAGS)
-ppc_libigen_a_LIBADD =
+@SIM_ENABLE_ARCH_ppc_TRUE@ppc_libigen_a_DEPENDENCIES =  \
+@SIM_ENABLE_ARCH_ppc_TRUE@     igen/filter_host.o
 @SIM_ENABLE_ARCH_ppc_TRUE@am_ppc_libigen_a_OBJECTS =  \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/table.$(OBJEXT) ppc/lf.$(OBJEXT) \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/misc.$(OBJEXT) \
-@SIM_ENABLE_ARCH_ppc_TRUE@     ppc/filter_host.$(OBJEXT) \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/ld-decode.$(OBJEXT) \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/ld-cache.$(OBJEXT) \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/filter.$(OBJEXT) \
@@ -2909,7 +2909,6 @@ testsuite_common_CPPFLAGS = \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/table.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/lf.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/misc.c \
-@SIM_ENABLE_ARCH_ppc_TRUE@     ppc/filter_host.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/ld-decode.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/ld-cache.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/filter.c \
@@ -2921,6 +2920,7 @@ testsuite_common_CPPFLAGS = \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/gen-idecode.c \
 @SIM_ENABLE_ARCH_ppc_TRUE@     ppc/gen-support.c
 
+@SIM_ENABLE_ARCH_ppc_TRUE@ppc_libigen_a_LIBADD = igen/filter_host.o
 @SIM_ENABLE_ARCH_ppc_TRUE@ppc_igen_SOURCES = ppc/igen.c
 @SIM_ENABLE_ARCH_ppc_TRUE@ppc_igen_LDADD = ppc/libigen.a
 @SIM_ENABLE_ARCH_ppc_TRUE@PPC_IGEN = ppc/igen$(EXEEXT)
@@ -3628,8 +3628,6 @@ ppc/$(DEPDIR)/$(am__dirstamp):
 ppc/table.$(OBJEXT): ppc/$(am__dirstamp) ppc/$(DEPDIR)/$(am__dirstamp)
 ppc/lf.$(OBJEXT): ppc/$(am__dirstamp) ppc/$(DEPDIR)/$(am__dirstamp)
 ppc/misc.$(OBJEXT): ppc/$(am__dirstamp) ppc/$(DEPDIR)/$(am__dirstamp)
-ppc/filter_host.$(OBJEXT): ppc/$(am__dirstamp) \
-       ppc/$(DEPDIR)/$(am__dirstamp)
 ppc/ld-decode.$(OBJEXT): ppc/$(am__dirstamp) \
        ppc/$(DEPDIR)/$(am__dirstamp)
 ppc/ld-cache.$(OBJEXT): ppc/$(am__dirstamp) \
@@ -4088,7 +4086,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@msp430/$(DEPDIR)/modules.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@or1k/$(DEPDIR)/modules.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ppc/$(DEPDIR)/filter.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@ppc/$(DEPDIR)/filter_host.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ppc/$(DEPDIR)/gen-icache.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ppc/$(DEPDIR)/gen-idecode.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ppc/$(DEPDIR)/gen-itable.Po@am__quote@
@@ -5761,7 +5758,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_ppc_TRUE@     $(AM_V_CCLD)$(LINK_FOR_BUILD) $(ppc_igen_OBJECTS) $(ppc_igen_LDADD)
 
 @SIM_ENABLE_ARCH_ppc_TRUE@$(ppc_libigen_a_OBJECTS) $(ppc_igen_OBJECTS): ppc/%.o: ppc/%.c
-@SIM_ENABLE_ARCH_ppc_TRUE@     $(AM_V_CC)$(COMPILE_FOR_BUILD) -c $< -o $@
+@SIM_ENABLE_ARCH_ppc_TRUE@     $(AM_V_CC)$(COMPILE_FOR_BUILD) -I$(srcdir)/igen -I$(srcdir)/ppc -c $< -o $@
 
 @SIM_ENABLE_ARCH_ppc_TRUE@ppc/%-main.o: ppc/%.c
 @SIM_ENABLE_ARCH_ppc_TRUE@     $(AM_V_CC)$(COMPILE_FOR_BUILD) -DMAIN -c $< -o $@
index b8e7fbf..fc9e324 100644 (file)
@@ -409,8 +409,7 @@ BUILT_SRC_WO_CONFIG = \
        model.h model.c \
        support.h support.c \
        pk.h \
-       hw.h hw.c \
-       filter_host.c
+       hw.h hw.c
 
 BUILT_SRC = \
        $(BUILT_SRC_WO_CONFIG) \
diff --git a/sim/ppc/filter_filename.c b/sim/ppc/filter_filename.c
deleted file mode 100644 (file)
index fb2457c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*  This file is part of the program psim.
-
-    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, see <http://www.gnu.org/licenses/>.
-    */
-
-#include "filter_filename.h"
-
-/* Shorten traces by eliminating the directory component to filenames.  */
-extern const char *
-filter_filename (const char *filename)
-{
-  const char *p = filename;
-  const char *last = filename;
-  int ch;
-
-  while ((ch = *p++) != '\0' && ch != ':')
-    if (ch == '/')
-      last = p;
-
-  return last;
-}
diff --git a/sim/ppc/filter_filename.h b/sim/ppc/filter_filename.h
deleted file mode 100644 (file)
index 5c42e28..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*  This file is part of the program psim.
-
-    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, see <http://www.gnu.org/licenses/>.
-    */
-
-#ifndef _FILTER_FILENAME_H
-#define _FILTER_FILENAME_H
-
-/* Remove directory part from filename */
-extern const char *
-filter_filename(const char *filename);
-#endif
diff --git a/sim/ppc/filter_host.c b/sim/ppc/filter_host.c
deleted file mode 100644 (file)
index 87d9bbc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Shim to share files between build & host programs.
-
-   Copyright (C) 2024 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-#include "filter_filename.c"
index 9156422..c72668c 100644 (file)
@@ -48,7 +48,6 @@ EXTRA_LIBRARIES += %D%/libigen.a
        %D%/table.c \
        %D%/lf.c \
        %D%/misc.c \
-       %D%/filter_host.c \
        %D%/ld-decode.c \
        %D%/ld-cache.c \
        %D%/filter.c \
@@ -59,6 +58,7 @@ EXTRA_LIBRARIES += %D%/libigen.a
        %D%/gen-semantics.c \
        %D%/gen-idecode.c \
        %D%/gen-support.c
+%C%_libigen_a_LIBADD = igen/filter_host.o
 
 %C%_igen_SOURCES = %D%/igen.c
 %C%_igen_LDADD = %D%/libigen.a
@@ -78,7 +78,7 @@ SIM_ALL_RECURSIVE_DEPS += $(PPC_IGEN)
        $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_igen_OBJECTS) $(%C%_igen_LDADD)
 
 $(%C%_libigen_a_OBJECTS) $(%C%_igen_OBJECTS): %D%/%.o: %D%/%.c
-       $(AM_V_CC)$(COMPILE_FOR_BUILD) -c $< -o $@
+       $(AM_V_CC)$(COMPILE_FOR_BUILD) -I$(srcdir)/igen -I$(srcdir)/%D% -c $< -o $@
 
 ## Build some of the files in standalone mode for developers of igen itself.
 %D%/%-main.o: %D%/%.c
index a9e97a0..0073467 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 
 #include "ansidecl.h"
-#include "filter_filename.h"
+#include "filter_host.h"
 
 extern void error (const char *msg, ...)
   ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);