Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp904905ybm; Wed, 27 May 2020 10:46:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeQfqvYLrFfdtnb0xywPWJlyhZ/IsW31In8hK9Yb/OYgiH/mwzKbsxqkWjtCsRMAeioJwi X-Received: by 2002:a17:906:2810:: with SMTP id r16mr1110742ejc.434.1590601605774; Wed, 27 May 2020 10:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590601605; cv=none; d=google.com; s=arc-20160816; b=B2pQmLqraDbERVWoNUOWU+ro24TIgDUY+K5pww+gX9CL+vez07G0rH/klmS1gMgDBL y3xEDoU2YqxKyGvyhh85PVKvp+QcdfDgol7ZQ0ZUBL/RA/GawUK6BvG4dR6sFwqExUtc eQp6BifEbGFBl376Bd8Tp+lmHrf2j4dorUgmllpFx/cvOwVyqQ7IeqzcSlI4LQQuSOkj DAr1HwNAAZ+hoGIABtJqylR9rbbOQG2Bls6DTeT+qkK9eOY16atLsk1auJ1jpNb041Mi koAoXVT0vfzFDiR5QUUJQ0uw+djZZHZNdGJEhs9BweMjLMN/suKScbI7rD6I6thcEkai B9JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=srXBwg5NUTLl7EpR8wbbKftfltAIBE6x22QHi6Zcc08=; b=OxSPm8Xq9ts9+HngQeh2pnO9zUquG/cwUVPg9nuV+LdrVv1Yo7IbWyhHME9Zc8bpMp +8W28gfKcI32fANp8ebF/f19Xv2Yi5ypgiF7EkR2uRrYgy0wkib9/rROLCNP9LcaCNKh 7xw2Ooymvw7mmZJcknCZcESChibrSYGql+VkV5tRt+x/6LALe3HOBlHeBR8wB+XH/bZ4 xPxD6UwCueNk8SA1/ZUf9zTqKAUuiJLKHAbKcujgJ5jyuuLTiB0dgdEMw2C5JWC9Z+EO 2y1ovr+W3uNfd92v7US91KK5Z3gRTdgl3AlrNpi2do4Ye//oLi+JH0EF1jdGgMEEefFB yJYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si2094209edq.553.2020.05.27.10.46.23; Wed, 27 May 2020 10:46:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730169AbgE0Mzw (ORCPT + 99 others); Wed, 27 May 2020 08:55:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730142AbgE0Mzw (ORCPT ); Wed, 27 May 2020 08:55:52 -0400 Received: from [192.168.0.106] (193-116-100-240.tpgi.com.au [193.116.100.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8C7E2084C; Wed, 27 May 2020 12:55:50 +0000 (UTC) Subject: Re: [PATCH 3/4] m68k: optimize cc-option calls for cpuflags-y To: Masahiro Yamada , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Cc: linux-kernel@vger.kernel.org References: <20200526123810.301667-1-masahiroy@kernel.org> <20200526123810.301667-3-masahiroy@kernel.org> From: Greg Ungerer Message-ID: Date: Wed, 27 May 2020 22:55:47 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200526123810.301667-3-masahiroy@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/5/20 10:38 pm, Masahiro Yamada wrote: > arch/m68k/Makefile computes lots of unneeded cc-option calls. > > For example, if CONFIG_M5441x is not defined, there is not point in > evaluating the following compiler flag. > > cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e) > > The result is set to cpuflags-, then thrown away. > > The right hand side of ':=' is immediately expanded. Hence, all of the > 16 calls for cc-option are evaluated. This is expensive since cc-option > invokes the compiler. This occurs even if you are not attempting to > build anything, like 'make ARCH=m68k help'. > > Use '=' to expand the value _lazily_. The evaluation for cc-option is > delayed until $(cpuflags-y) is expanded. So, the cc-option test happens > just once at most. > > This commit mimics tune-y of arch/arm/Makefile. > > Signed-off-by: Masahiro Yamada Acked-by: Greg Ungerer Regards Greg > --- > > arch/m68k/Makefile | 45 ++++++++++++++++++++++++--------------------- > 1 file changed, 24 insertions(+), 21 deletions(-) > > diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile > index 88d4d8bbecd6..ae6e29da3a3e 100644 > --- a/arch/m68k/Makefile > +++ b/arch/m68k/Makefile > @@ -32,30 +32,33 @@ endif > # compiler cpu type flag. > # > ifndef CONFIG_M68040 > -cpuflags-$(CONFIG_M68060) := -m68060 > +cpuflags-$(CONFIG_M68060) = -m68060 > endif > ifndef CONFIG_M68060 > -cpuflags-$(CONFIG_M68040) := -m68040 > +cpuflags-$(CONFIG_M68040) = -m68040 > endif > -cpuflags-$(CONFIG_M68030) := > -cpuflags-$(CONFIG_M68020) := > -cpuflags-$(CONFIG_M68000) := -m68000 > -cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e) > -cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200) > -cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200) > -cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307) > -cpuflags-$(CONFIG_M537x) := $(call cc-option,-mcpu=537x,-m5307) > -cpuflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200) > -cpuflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307) > -cpuflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307) > -cpuflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307) > -cpuflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307) > -cpuflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307) > -cpuflags-$(CONFIG_M525x) := $(call cc-option,-mcpu=5253,-m5200) > -cpuflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200) > -cpuflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200) > -cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200) > -cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200) > +cpuflags-$(CONFIG_M68030) = > +cpuflags-$(CONFIG_M68020) = > +cpuflags-$(CONFIG_M68000) = -m68000 > +cpuflags-$(CONFIG_M5441x) = $(call cc-option,-mcpu=54455,-mcfv4e) > +cpuflags-$(CONFIG_M54xx) = $(call cc-option,-mcpu=5475,-m5200) > +cpuflags-$(CONFIG_M5407) = $(call cc-option,-mcpu=5407,-m5200) > +cpuflags-$(CONFIG_M532x) = $(call cc-option,-mcpu=532x,-m5307) > +cpuflags-$(CONFIG_M537x) = $(call cc-option,-mcpu=537x,-m5307) > +cpuflags-$(CONFIG_M5307) = $(call cc-option,-mcpu=5307,-m5200) > +cpuflags-$(CONFIG_M528x) = $(call cc-option,-mcpu=528x,-m5307) > +cpuflags-$(CONFIG_M5275) = $(call cc-option,-mcpu=5275,-m5307) > +cpuflags-$(CONFIG_M5272) = $(call cc-option,-mcpu=5272,-m5307) > +cpuflags-$(CONFIG_M5271) = $(call cc-option,-mcpu=5271,-m5307) > +cpuflags-$(CONFIG_M523x) = $(call cc-option,-mcpu=523x,-m5307) > +cpuflags-$(CONFIG_M525x) = $(call cc-option,-mcpu=5253,-m5200) > +cpuflags-$(CONFIG_M5249) = $(call cc-option,-mcpu=5249,-m5200) > +cpuflags-$(CONFIG_M520x) = $(call cc-option,-mcpu=5208,-m5200) > +cpuflags-$(CONFIG_M5206e) = $(call cc-option,-mcpu=5206e,-m5200) > +cpuflags-$(CONFIG_M5206) = $(call cc-option,-mcpu=5206,-m5200) > + > +# Evaluate tune cc-option calls now > +cpuflags-y := $(cpuflags-y) > > KBUILD_AFLAGS += $(cpuflags-y) > KBUILD_CFLAGS += $(cpuflags-y) >