public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/submitted 1/3] sim: ppc: hoist igen execution to top-level
@ 2024-01-02  7:25 Mike Frysinger
  2024-01-02  7:25 ` [PATCH/submitted 2/3] sim: ppc: hoist hw.[ch] creation " Mike Frysinger
  2024-01-02  7:25 ` [PATCH/submitted 3/3] sim: ppc: hoist pk.h " Mike Frysinger
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2024-01-02  7:25 UTC (permalink / raw)
  To: gdb-patches

Invoke ppc's igen from the top-level like we do for all other ports.
---
 sim/Makefile.in       | 113 ++++++++++++++++++++++++++++++++----------
 sim/arch-subdir.mk.in |   2 +
 sim/ppc/Makefile.in   |  63 +----------------------
 sim/ppc/local.mk      |  63 ++++++++++++++++++++++-
 4 files changed, 153 insertions(+), 88 deletions(-)

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index afa1103a2f11..c3da955668a6 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -64,3 +64,5 @@ MAINT = ; @true
 SIM_INLINE = @SIM_INLINE@
 
 SIM_HW_CFLAGS = @SIM_HW_CFLAGS@
+
+PPC_IGEN_FLAGS = $(ppc_IGEN_FLAGS)
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 220e4b8e728b..5717ddc885ed 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -86,29 +86,6 @@ NOWARN_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(INCLUDES) $(SIM_FP
 
 LIBS = $(COMMON_LIBS) @LIBS@ $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
 
-IGEN_OPCODE_RULES = @sim_ppc_opcode@
-IGEN_DECODE_MECHANISM = @sim_ppc_decode_mechanism@
-IGEN_DUPLICATE = @sim_ppc_dup@
-IGEN_JUMP = @sim_ppc_jump@
-IGEN_FILTER = @sim_ppc_filter@
-IGEN_ICACHE = @sim_ppc_icache@
-IGEN_SMP = @sim_ppc_igen_smp@
-IGEN_LINE_NR = @sim_ppc_line_nr@
-
-IGEN_FLAGS = \
-	$(IGEN_DECODE_MECHANISM) \
-	$(IGEN_DUPLICATE) \
-	$(IGEN_JUMP) \
-	$(IGEN_FILTER) \
-	$(IGEN_ICACHE) \
-	$(IGEN_SMP) \
-	$(IGEN_LINE_NR)
-
-# igen leaks memory, and therefore makes AddressSanitizer unhappy.  Disable
-# leak detection while running it.
-
-IGEN = ASAN_OPTIONS=detect_leaks=0 ./igen
-
 .NOEXPORT:
 MAKEOVERRIDES=
 
@@ -268,9 +245,6 @@ IDECODE_EXPRESSION_H = \
 IDECODE_FIELDS_H = \
 	idecode_fields.h
 
-IGEN_H = \
-	igen.h
-
 INLINE_H = \
 	inline.h
 
@@ -388,13 +362,6 @@ INLINE = \
 	inline.c
 
 BUILT_SRC_WO_CONFIG = \
-	icache.h icache.c \
-	support.h support.c \
-	idecode.h idecode.c \
-	semantics.h semantics.c \
-	itable.h itable.c \
-	model.h model.c \
-	support.h support.c \
 	pk.h \
 	hw.h hw.c
 
@@ -489,7 +456,7 @@ PACKAGE_SRC = pk_disklabel.c
 PACKAGE_OBJ = $(PACKAGE_SRC:.c=.o)
 
 
-$(TARGETLIB): tmp-igen tmp-hw defines.h $(LIB_OBJ) $(GDB_OBJ)
+$(TARGETLIB): tmp-hw defines.h $(LIB_OBJ) $(GDB_OBJ)
 	$(ECHO_AR) $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
 	$(ECHO_RANLIB) $(RANLIB) $(TARGETLIB)
 
@@ -560,33 +527,7 @@ sim-fpu.o: $(srcdir)/../common/sim-fpu.c
 
 # Rebuild options whenever something changes so the date/time is up to date.
 options.o: options.c $(CPU_H) $(OPTIONS_H) $(DEFINES_H) $(BASICS_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) ../config.status Makefile
-	$(ECHO_CC) $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_ppc_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' $(srcdir)/options.c
-
-#
-# Rules to create the built c source code files
-#
-
-tmp-igen: igen $(srcdir)/powerpc.igen $(srcdir)/altivec.igen $(srcdir)/e500.igen $(IGEN_OPCODE_RULES) $(srcroot)/move-if-change
-	$(ECHO_GEN) $(IGEN) $(IGEN_FLAGS) \
-		-o $(srcdir)/$(IGEN_OPCODE_RULES) \
-		-I $(srcdir) -i $(srcdir)/powerpc.igen \
-		-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 $@
-
-$(TARGETLIB): tmp-igen
-itable.h itable.c icache.h icache.c idecode.h idecode.c semantics.h semantics.c model.h model.c support.h support.c: tmp-igen
-
+	$(ECHO_CC) $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_ppc_opcode@"' '-DIGEN_FLAGS="$(ppc_IGEN_FLAGS)"' $(srcdir)/options.c
 
 # real hardware
 hw.c hw.h: tmp-hw; @true
diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
index e2d6197f5dd2..8b5a16567fe7 100644
--- a/sim/ppc/local.mk
+++ b/sim/ppc/local.mk
@@ -74,9 +74,68 @@ EXTRA_LIBRARIES += %D%/libigen.a
 %C%_igen_SOURCES = %D%/igen.c
 %C%_igen_LDADD = %D%/libigen.a
 
+# igen leaks memory, and therefore makes AddressSanitizer unhappy.  Disable
+# leak detection while running it.
 PPC_IGEN = %D%/igen$(EXEEXT)
+PPC_IGEN_RUN = ASAN_OPTIONS=detect_leaks=0 $(PPC_IGEN) $(%C%_IGEN_FLAGS)
+
+%C%_IGEN_FLAGS = \
+	@sim_ppc_decode_mechanism@ \
+	@sim_ppc_dup@ \
+	@sim_ppc_jump@ \
+	@sim_ppc_filter@ \
+	@sim_ppc_icache@ \
+	@sim_ppc_igen_smp@ \
+	@sim_ppc_line_nr@
+
+## List all generated headers to help Automake dependency tracking.
+BUILT_SOURCES += \
+	%D%/icache.h \
+	%D%/idecode.h \
+	%D%/semantics.h \
+	%D%/model.h \
+	%D%/support.h \
+	%D%/itable.h
+%C%_BUILT_SRC_FROM_IGEN = \
+	%D%/icache.h \
+	%D%/icache.c \
+	%D%/idecode.h \
+	%D%/idecode.c \
+	%D%/semantics.h \
+	%D%/semantics.c \
+	%D%/model.h \
+	%D%/model.c \
+	%D%/support.h \
+	%D%/support.c \
+	%D%/itable.h \
+	%D%/itable.c
+%C%_BUILD_OUTPUTS = \
+	$(%C%_BUILT_SRC_FROM_IGEN) \
+	%D%/stamp-igen
+
+SIM_ALL_RECURSIVE_DEPS += %D%/stamp-igen
+$(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
+
+%C%_IGEN_OPCODE_RULES = %D%/@sim_ppc_opcode@
+%D%/stamp-igen: %D%/powerpc.igen %D%/altivec.igen %D%/e500.igen $(%C%_IGEN_OPCODE_RULES) $(PPC_IGEN)
+	$(AM_V_GEN)$(PPC_IGEN_RUN) \
+		-o $(srcdir)/$(%C%_IGEN_OPCODE_RULES) \
+		-I $(srcdir)/%D% -i $(srcdir)/%D%/powerpc.igen \
+		-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 itable.h    -ht %D%/itable.h \
+		-n itable.c    -t  %D%/itable.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
+	$(AM_V_at)touch $@
 
-SIM_ALL_RECURSIVE_DEPS += $(PPC_IGEN)
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
 
 ## These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 %D%/libigen.a: $(%C%_libigen_a_OBJECTS) $(%C%_libigen_a_DEPENDENCIES) $(EXTRA_%C%_libigen_a_DEPENDENCIES) %D%/$(am__dirstamp)
@@ -116,5 +175,7 @@ $(%C%_libigen_a_OBJECTS) $(%C%_igen_OBJECTS): %D%/%.o: %D%/%.c
 EXTRA_PROGRAMS += $(%C%_IGEN_TOOLS)
 MOSTLYCLEANFILES += $(%C%_IGEN_TOOLS) %D%/libigen.a
 
+IGEN_OPCODE_RULES = @sim_ppc_opcode@
+
 %C%docdir = $(docdir)/%C%
 %C%doc_DATA = %D%/BUGS %D%/INSTALL %D%/README %D%/RUN
-- 
2.43.0


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

end of thread, other threads:[~2024-01-02  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02  7:25 [PATCH/submitted 1/3] sim: ppc: hoist igen execution to top-level Mike Frysinger
2024-01-02  7:25 ` [PATCH/submitted 2/3] sim: ppc: hoist hw.[ch] creation " Mike Frysinger
2024-01-02  7:25 ` [PATCH/submitted 3/3] sim: ppc: hoist pk.h " 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).