public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: bpf: hoist cgen rules to top-level
@ 2023-01-03  1:33 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2023-01-03  1:33 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3abb19ad7e9b3f29e5fc359b1d613b3f686156e0

commit 3abb19ad7e9b3f29e5fc359b1d613b3f686156e0
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jan 1 21:00:12 2023 -0500

    sim: bpf: hoist cgen rules to top-level

Diff:
---
 sim/Makefile.in     | 27 ++++++++++++++++
 sim/bpf/Makefile.in | 90 -----------------------------------------------------
 sim/bpf/local.mk    | 40 ++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 90 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index b19c0c2986d..ca080973f4e 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -3489,6 +3489,33 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change bpf/mloop-be.cin bpf/mloop-be.c
 @SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_at)touch $@
 
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen: bpf/cgen-arch bpf/cgen-cpu bpf/cgen-defs-le bpf/cgen-defs-be bpf/cgen-decode-le bpf/cgen-decode-be
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-arch:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)mach=bpf cpu=bpfbf FLAGS="with-scache"; $(CGEN_GEN_ARCH)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/arch.h bpf/arch.c bpf/cpuall.h: @CGEN_MAINT@ bpf/cgen-arch
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-cpu:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf FLAGS="with-multiple-isa with-scache"; $(CGEN_GEN_CPU)
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_at)rm -f $(srcdir)/bpf/model.c
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cpu.h bpf/cpu.c bpf/model.c: @CGEN_MAINT@ bpf/cgen-cpu
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-defs-le:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le"; $(CGEN_GEN_DEFS)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/defs-le.h: @CGEN_MAINT@ bpf/cgen-defs-le
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-defs-be:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be"; $(CGEN_GEN_DEFS)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/defs-be.h: @CGEN_MAINT@ bpf/cgen-defs-be
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-decode-le:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/sem-le.c bpf/decode-le.c bpf/decode-le.h: @CGEN_MAINT@ bpf/cgen-decode-vle
+
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-decode-be:
+@SIM_ENABLE_ARCH_bpf_TRUE@	$(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/sem-be.c bpf/decode-be.c bpf/decode-be.h: @CGEN_MAINT@ bpf/cgen-decode-be
+
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_cr16_TRUE@cr16/gencode$(EXEEXT): $(cr16_gencode_OBJECTS) $(cr16_gencode_DEPENDENCIES) cr16/$(am__dirstamp)
 @SIM_ENABLE_ARCH_cr16_TRUE@	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(cr16_gencode_OBJECTS) $(cr16_gencode_LDADD)
diff --git a/sim/bpf/Makefile.in b/sim/bpf/Makefile.in
index 7a17de8d475..2732a0e6071 100644
--- a/sim/bpf/Makefile.in
+++ b/sim/bpf/Makefile.in
@@ -33,8 +33,6 @@ SIM_OBJS = \
 
 SIM_EXTRA_CFLAGS = -DWITH_TARGET_WORD_BITSIZE=64
 
-SIM_EXTRA_CLEAN = bpf-clean
-
 ## COMMON_POST_CONFIG_FRAG
 
 # Dependencies for binaries from CGEN generated source
@@ -61,91 +59,3 @@ sem-be.o: sem-be.c
 	$(POSTCOMPILE)
 
 arch = bpf
-
-CGEN_COMMON_DEPS = \
-	$(CGEN_READ_SCM) \
-	$(srcdir)/../../cpu/bpf.cpu \
-	$(srcdir)/../../cpu/bpf.opc \
-	Makefile
-
-stamp-arch: $(CGEN_COMMON_DEPS) $(CGEN_ARCH_SCM)
-	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) \
-		mach=bpf cpu=bpfbf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-scache"
-	$(SILENCE) touch $@
-$(srcdir)/arch.h $(srcdir)/arch.c $(srcdir)/cpuall.h: $(CGEN_MAINT) stamp-arch
-	@true
-
-stamp-cpu: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-	$(MAKE) cgen-cpu  $(CGEN_FLAGS_TO_PASS) \
-		isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-multiple-isa with-scache"
-	rm -f $(srcdir)/model.c
-	$(SILENCE) touch $@
-$(srcdir)/cpu.h $(srcdir)/cpu.c $(srcdir)/model.c: $(CGEN_MAINT) stamp-cpu
-	@true
-
-# We need to generate a group of files per ISA.
-# For eBPF little-endian:
-#    defs-le.h
-#    sem-le.c, decode-le.c, decode-le.h
-#    $(objdir)/mloop-le.c $(objdir)/eng-le.h
-# For eBPF big-endian:
-#    defs-be.h
-#    sem-be.c, decode-be.c, decode-be.h
-#    $(objdir)/mloop-be.c $(objdir)/eng-le.h
-#
-# The rules below take care of that.
-
-stamp-defs-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-	$(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \
-		isa=ebpfle cpu=bpfbf mach=bpf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-scache" \
-                SUFFIX="-le"
-	$(SILENCE) touch $@
-$(srcdir)/defs-le.h: $(CGEN_MAINT) stamp-defs-le
-	@true
-
-
-stamp-defs-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM)
-	$(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \
-		isa=ebpfbe cpu=bpfbf mach=bpf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-scache" \
-                SUFFIX="-be"
-	$(SILENCE) touch $@
-$(srcdir)/defs-be.h: $(CGEN_MAINT) stamp-defs-be
-	@true
-
-stamp-decode-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM)
-	$(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \
-		isa=ebpfle cpu=bpfbf mach=bpf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-scache" \
-                SUFFIX="-le" \
-		EXTRAFILES="$(CGEN_CPU_SEM)"
-	$(SILENCE) touch $@
-$(srcdir)/sem-le.c $(srcdir)/decode-le.c $(srcdir)/decode-le.h: \
-              $(CGEN_MAINT) stamp-decode-le
-	@true
-
-
-stamp-decode-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM)
-	$(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \
-		isa=ebpfbe cpu=bpfbf mach=bpf \
-		archfile=$(srcdir)/../../cpu/bpf.cpu \
-		FLAGS="with-scache" \
-                SUFFIX="-be" \
-		EXTRAFILES="$(CGEN_CPU_SEM)"
-	$(SILENCE) touch $@
-$(srcdir)/sem-be.c $(srcdir)/decode-be.c $(srcdir)/decode-be.h: \
-              $(CGEN_MAINT) stamp-decode-be
-	@true
-
-.PHONY = bpf-clean
-
-bpf-clean:
-	rm -f stamp-arch stamp-cpu stamp-decode stamp-defs
diff --git a/sim/bpf/local.mk b/sim/bpf/local.mk
index 7382f6163bc..7221dafa9b2 100644
--- a/sim/bpf/local.mk
+++ b/sim/bpf/local.mk
@@ -55,3 +55,43 @@ SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
 	$(AM_V_at)touch $@
 
 MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
+
+## Target that triggers all cgen targets that works when --disable-cgen-maint.
+%D%/cgen: %D%/cgen-arch %D%/cgen-cpu %D%/cgen-defs-le %D%/cgen-defs-be %D%/cgen-decode-le %D%/cgen-decode-be
+
+%D%/cgen-arch:
+	$(AM_V_GEN)mach=bpf cpu=bpfbf FLAGS="with-scache"; $(CGEN_GEN_ARCH)
+%D%/arch.h %D%/arch.c %D%/cpuall.h: @CGEN_MAINT@ %D%/cgen-arch
+
+%D%/cgen-cpu:
+	$(AM_V_GEN)isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf FLAGS="with-multiple-isa with-scache"; $(CGEN_GEN_CPU)
+	$(AM_V_at)rm -f $(srcdir)/%D%/model.c
+%D%/cpu.h %D%/cpu.c %D%/model.c: @CGEN_MAINT@ %D%/cgen-cpu
+
+## We need to generate a group of files per ISA.
+## For eBPF little-endian:
+##    defs-le.h
+##    sem-le.c, decode-le.c, decode-le.h
+##    $(objdir)/mloop-le.c $(objdir)/eng-le.h
+## For eBPF big-endian:
+##    defs-be.h
+##    sem-be.c, decode-be.c, decode-be.h
+##    $(objdir)/mloop-be.c $(objdir)/eng-le.h
+##
+## The rules below take care of that.
+
+%D%/cgen-defs-le:
+	$(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le"; $(CGEN_GEN_DEFS)
+%D%/defs-le.h: @CGEN_MAINT@ %D%/cgen-defs-le
+
+%D%/cgen-defs-be:
+	$(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be"; $(CGEN_GEN_DEFS)
+%D%/defs-be.h: @CGEN_MAINT@ %D%/cgen-defs-be
+
+%D%/cgen-decode-le:
+	$(AM_V_GEN)isa=ebpfle cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-le" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+%D%/sem-le.c %D%/decode-le.c %D%/decode-le.h: @CGEN_MAINT@ %D%/cgen-decode-vle
+
+%D%/cgen-decode-be:
+	$(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
+%D%/sem-be.c %D%/decode-be.c %D%/decode-be.h: @CGEN_MAINT@ %D%/cgen-decode-be

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-03  1:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03  1:33 [binutils-gdb] sim: bpf: hoist cgen rules to top-level Michael 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).