Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp158366ybs; Tue, 26 May 2020 06:11:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCEu0faom2G5x8WK6PZzS525kCwZyWA/9tl39oUkQmeQdHy0ljrRA2ANzQNjUd3JxQ7XGu X-Received: by 2002:a17:906:3e02:: with SMTP id k2mr1108179eji.412.1590498716462; Tue, 26 May 2020 06:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590498716; cv=none; d=google.com; s=arc-20160816; b=FyGId8UMJGM+9pnCs6+xiL/rosYqIwRe8l5znOfMNq1oBZ+iHcMhU2j0hAVFoHY80h 4ymsSCZhflNqgO8b3/GTr0wUoAFw89XsFCwuDLXm2jGiK9n8Scw/zTlOSPQDf1j2J86m MG9VxOhEZ1eWx6BQn3ZIti+0ejwc5EA1CAugbJGCHP3uZqcB98NE7aq2RPRZro3+3RdM FP1iY3yjiLtY3r/84xUW0yGXiMdl52n//m7k20u+IR0+wI0dNNASez2wWp+jzQWzwaml p/16lYHEbCgrp45t0W1d9unMB/g2LLbzARV3uz8Tu7YyfS3BEGZzVb9yPVnsnQQqljru 9/IA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=mIdbxavok04+TKKVUbbzIeHuMzoZETrO8wGd76j+Sz8=; b=jzUC55WAFee1s0lCDcRLEegZesJX7I3LWcnRLvcWXVP9m7fv0WFmOttFPveEDa87UI b6vqSTU8XgClo2tb8Jd5zXW8x97rj+8B/JM8XwHONtzQ/+zioWk8p1ULUZ+BUTkMNwAF xdTMUDb2E7LL0SznmYa0W1f2Dc+5e0cS78qbTCABAAG59y9PcpKRwsn1VT+bJ6rxK1TB IUY4FEP+nDfnQ3U/B9hfkuBvzsjeKdqv0Fqw8P85R4Zt2kKOkXCXrA2OWTXMrgeWvBkO ciaNxdAjEHS5APupeh6JQuS2TEn87C86ucCA2M2kxVUrVscdmheju9DMJJVV1xj79F7B 34xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nxb2d5cY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 88si12554309edq.491.2020.05.26.06.11.33; Tue, 26 May 2020 06:11:56 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nxb2d5cY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389158AbgEZMil (ORCPT + 99 others); Tue, 26 May 2020 08:38:41 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:39428 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388497AbgEZMik (ORCPT ); Tue, 26 May 2020 08:38:40 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-07.nifty.com with ESMTP id 04QCcC2t029236; Tue, 26 May 2020 21:38:14 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 04QCcC2t029236 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590496695; bh=mIdbxavok04+TKKVUbbzIeHuMzoZETrO8wGd76j+Sz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxb2d5cYIcSoLep1eWb2d51KTjH7dV2pw6w3ci9BfxhEKySSG0wPanfrIMqcbtRpy WPOfNqpF6oxuMK4YQcRHRehioW+KnyooO4K8cHDo6kqTKDai6CGIkIwMACC7IDDOsn QqqelZvXT7nV9AYMEZtgIYsuaDs/bUw64oO4rgWQi1XzBgYUPIjNzeQzD7TFLE1XBN m0ojF6uVwBawgSBZGAzLlWvWBs+RZF2IyUJW+NxYKsvEKQwTd5E9sdwk+R2RJcLRk3 zrLfKfaE5w/9hyjQZ74zo0YVKAV21QylrBdecqFd89j+RU8NVVDsNtQ6w3efZI8Nhl 3IotbvE3ViiJQ== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] m68k: optimize cc-option calls for cpuflags-y Date: Tue, 26 May 2020 21:38:09 +0900 Message-Id: <20200526123810.301667-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526123810.301667-1-masahiroy@kernel.org> References: <20200526123810.301667-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) -- 2.25.1