From patchwork Tue Jan 3 07:55:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 62595 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DF4D3881D30 for ; Tue, 3 Jan 2023 08:01:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DF4D3881D30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672732889; bh=a+vimR8dS1AuKdVDX7wV58AdUHUqTqoXi0bdAfaKKp8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Jn0OXlSfYR9O9BCGiTBiynTtf9okPf+Hlf4vZDj2y3FxQ6/XxpbtxQRRXcIaqte3W dU6RL3O1iW7QQiZDq4ECoxgGrrSCJ6+a/cuZIr8kjiMdk7TJ64pn/EaeuEbNswKT+3 vue34sM4wJH6NhD0v0O2BuX9T2K83Ub+22X8W7r8= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id D04703858C27 for ; Tue, 3 Jan 2023 07:57:01 +0000 (GMT) Received: by smtp.gentoo.org (Postfix, from userid 559) id 52479335D79; Tue, 3 Jan 2023 07:57:01 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 24/83] sim: mips: move libsim.a creation to top-level Date: Tue, 3 Jan 2023 02:55:06 -0500 Message-Id: <20230103075605.13606-25-vapier@gentoo.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103075605.13606-1-vapier@gentoo.org> References: <20230103075605.13606-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Mike Frysinger via Gdb-patches From: Mike Frysinger Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The objects are still compiled in the subdir, but the creation of the archive itself is in the top-level. This is a required step before we can move compilation itself up, and makes it easier to review. The downside is that each object compile is a recursive make instead of a single one. On my 4 core system, it adds ~100msec to the build per port, so it's not great, but it shouldn't be a big deal. This will go away of course once the top-level compiles objects. The mips code is a little more tricky than others because, for multi-run targets, it generates the list of sources & objects on the fly in the configure script. --- sim/Makefile.in | 261 +++++++++++++++++++++++++++--------------- sim/configure | 20 ++-- sim/mips/Makefile.in | 44 +------ sim/mips/acinclude.m4 | 20 ++-- sim/mips/local.mk | 59 ++++++++++ 5 files changed, 251 insertions(+), 153 deletions(-) diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in index eb20977c5cc6..c79a831dd782 100644 --- a/sim/mips/Makefile.in +++ b/sim/mips/Makefile.in @@ -3,51 +3,9 @@ ## COMMON_PRE_CONFIG_FRAG -SIM_MIPS_GEN = @SIM_MIPS_GEN@ -SIM_MIPS_MULTI_OBJ = @SIM_MIPS_MULTI_OBJ@ - arch = mips -# Object files created by various simulator generators. - - -SIM_SINGLE_OBJ = \ - support.o \ - itable.o \ - semantics.o \ - idecode.o \ - icache.o \ - engine.o \ - irun.o \ - - -SIM_M16_OBJ = \ - m16_support.o \ - m16_semantics.o \ - m16_idecode.o \ - m16_icache.o \ - \ - m32_support.o \ - m32_semantics.o \ - m32_idecode.o \ - m32_icache.o \ - \ - itable.o \ - m16run.o \ - -SIM_MULTI_OBJ = $(SIM_MIPS_MULTI_OBJ) \ - itable.o \ - multi-run.o \ - -SIM_OBJS = \ - interp.o \ - $(SIM_$(SIM_MIPS_GEN)_OBJ) \ - $(SIM_NEW_COMMON_OBJS) \ - cp1.o \ - mdmx.o \ - dsp.o \ - sim-main.o \ - sim-resume.o \ +SIM_LIBSIM = # List of flags to always pass to $(CC). SIM_EXTRA_CFLAGS = @SIM_MIPS_SUBTARGET@ diff --git a/sim/mips/acinclude.m4 b/sim/mips/acinclude.m4 index f2dd97f3dc44..58b55a2782b6 100644 --- a/sim/mips/acinclude.m4 +++ b/sim/mips/acinclude.m4 @@ -252,8 +252,8 @@ __EOF__ dnl The top-level function for the mips16 simulator is dnl in a file m16${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" m16${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" m16${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/m16${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/m16${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16"]) ], [*:*micromips32*:*], [dnl @@ -264,8 +264,8 @@ __EOF__ dnl The top-level function for the micromips simulator is dnl in a file micromips${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/micromips${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/micromips${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16,32"]) ], [*:*micromips64*:*], [dnl @@ -276,8 +276,8 @@ __EOF__ dnl The top-level function for the micromips simulator is dnl in a file micromips${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/micromips${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/micromips${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16,32,64"]) ], [ws=m32]) @@ -286,9 +286,9 @@ __EOF__ dnl and ${SIM_MIPS_MULTI_OBJ}. for w in ${ws}; do for base in engine icache idecode model semantics support; do - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.h"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" ${w}${name}_${base}.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/${w}${name}_${base}.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/${w}${name}_${base}.h"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/${w}${name}_${base}.o"]) done AS_VAR_APPEND([SIM_MIPS_MULTI_IGEN_CONFIGS], [" ${w}${c}"]) done @@ -320,7 +320,7 @@ __EOF__ __EOF__ ], [dnl dnl For clean-extra target. - SIM_MIPS_MULTI_SRC=doesnt-exist.c + SIM_MIPS_MULTI_SRC=mips/doesnt-exist.c SIM_MIPS_IGEN_ITABLE_FLAGS='$(SIM_MIPS_SINGLE_FLAGS)' AS_VAR_IF([SIM_MIPS_GEN], ["M16"], [AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [' $(SIM_MIPS_M16_FLAGS)'])]) ]) diff --git a/sim/mips/local.mk b/sim/mips/local.mk index 5a7b12c29a1e..f255ffca611f 100644 --- a/sim/mips/local.mk +++ b/sim/mips/local.mk @@ -16,6 +16,65 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . +%C%_GEN_OBJ = +if SIM_MIPS_GEN_MODE_SINGLE +%C%_GEN_OBJ += \ + %D%/support.o \ + %D%/itable.o \ + %D%/semantics.o \ + %D%/idecode.o \ + %D%/icache.o \ + %D%/engine.o \ + %D%/irun.o +endif +if SIM_MIPS_GEN_MODE_M16 +%C%_GEN_OBJ += \ + %D%/m16_support.o \ + %D%/m16_semantics.o \ + %D%/m16_idecode.o \ + %D%/m16_icache.o \ + \ + %D%/m32_support.o \ + %D%/m32_semantics.o \ + %D%/m32_idecode.o \ + %D%/m32_icache.o \ + \ + %D%/itable.o \ + %D%/m16run.o +endif +if SIM_MIPS_GEN_MODE_MULTI +%C%_GEN_OBJ += \ + $(SIM_MIPS_MULTI_OBJ) \ + %D%/itable.o \ + %D%/multi-run.o +endif +%C%_libsim_a_SOURCES = +%C%_libsim_a_LIBADD = \ + $(common_libcommon_a_OBJECTS) \ + %D%/interp.o \ + $(%C%_GEN_OBJ) \ + $(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \ + $(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \ + $(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \ + %D%/cp1.o \ + %D%/dsp.o \ + %D%/mdmx.o \ + %D%/modules.o \ + %D%/sim-main.o \ + %D%/sim-resume.o +## Workaround Automake bug where $(SIM_MIPS_MULTI_OBJ) isn't copied from LIBADD +## to DEPENDENCIES automatically. +EXTRA_mips_libsim_a_DEPENDENCIES = $(SIM_MIPS_MULTI_OBJ) +$(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h + +noinst_LIBRARIES += %D%/libsim.a + +%D%/%.o: %D%/%.c + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + +%D%/%.o: common/%.c + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + %C%_run_SOURCES = %C%_run_LDADD = \ %D%/nrun.o \