All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] m68k: optimize cc-option calls for cpuflags-y
Date: Wed, 27 May 2020 22:55:47 +1000	[thread overview]
Message-ID: <c0dc228a-ab53-d2da-0211-c8597b3473df@linux-m68k.org> (raw)
In-Reply-To: <20200526123810.301667-3-masahiroy@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 <masahiroy@kernel.org>

Acked-by: Greg Ungerer <gerg@linux-m68k.org>

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)
> 

  reply	other threads:[~2020-05-27 12:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 12:38 [PATCH 1/4] m68k: add arch/m68k/Kbuild Masahiro Yamada
2020-05-26 12:38 ` [PATCH 2/4] m68k: descend to prom from arch/m68k/sun3 Masahiro Yamada
2020-06-29 17:46   ` Geert Uytterhoeven
2020-05-26 12:38 ` [PATCH 3/4] m68k: optimize cc-option calls for cpuflags-y Masahiro Yamada
2020-05-27 12:55   ` Greg Ungerer [this message]
2020-06-29 17:47   ` Geert Uytterhoeven
2020-05-26 12:38 ` [PATCH 4/4] m68k: pass -D options to KBUILD_CPPFLAGS instead of KBUILD_{A,C}FLAGS Masahiro Yamada
2020-05-27 13:00   ` Greg Ungerer
2020-06-29 17:47   ` Geert Uytterhoeven
2020-05-27 13:04 ` [PATCH 1/4] m68k: add arch/m68k/Kbuild Greg Ungerer
2020-06-29 17:35 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0dc228a-ab53-d2da-0211-c8597b3473df@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.