From b43af743b77a18e01e0e266f25c55510d8f08b35 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 13 Jan 2016 07:49:42 -0500 Subject: [PATCH] Move compiler optimization to the SoC Decisions on compiler optimizations were done on the architecture level, this does not scale and some SoCs will have different optimization levels or compiler options needed. Moving this to the SoC makes it easy to optimize differently when using the same CPU which we use to set the right optimization now on the architecture level. For IAMCU platforms, use the right architecture and tuning. -march=lakemont -mtune=lakemont -miamcu -msoft-float Change-Id: I0f77cffe7a139f8b2620935094437d0dfd160dfe Signed-off-by: Anas Nashif --- arch/arc/Makefile | 9 ++++----- arch/arc/soc/quark_se_ss/Makefile | 5 +++++ arch/arm/Makefile | 10 +++------- arch/arm/soc/fsl_frdm_k64f/Makefile | 6 ++++++ arch/arm/soc/ti_lm3s6965/Makefile | 5 +++++ arch/x86/Makefile | 7 ++----- arch/x86/soc/atom/Makefile | 4 ++++ arch/x86/soc/ia32/Makefile | 3 +++ arch/x86/soc/quark_d2000/Makefile | 4 ++++ arch/x86/soc/quark_se/Makefile | 4 ++++ arch/x86/soc/quark_x1000/Makefile | 3 +++ 11 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 arch/arc/soc/quark_se_ss/Makefile create mode 100644 arch/arm/soc/fsl_frdm_k64f/Makefile create mode 100644 arch/arm/soc/ti_lm3s6965/Makefile create mode 100644 arch/x86/soc/atom/Makefile create mode 100644 arch/x86/soc/ia32/Makefile create mode 100644 arch/x86/soc/quark_d2000/Makefile create mode 100644 arch/x86/soc/quark_se/Makefile create mode 100644 arch/x86/soc/quark_x1000/Makefile diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 77e95c2ce99..32a3e060df2 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -1,7 +1,6 @@ cflags-y += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,) -arch-$(CONFIG_LTO) = $(call cc-option,-flto,) -arch-$(CONFIG_CPU_ARCEM4) = $(call cc-option,-mARCv2EM) \ - $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) +cflags-$(CONFIG_LTO) = $(call cc-option,-flto,) -KBUILD_CFLAGS += $(arch-y) $(cflags-y) -KBUILD_AFLAGS += $(arch-y) +include $(srctree)/arch/$(ARCH)/soc/$(SOC_NAME)/Makefile + +KBUILD_CFLAGS += $(cflags-y) diff --git a/arch/arc/soc/quark_se_ss/Makefile b/arch/arc/soc/quark_se_ss/Makefile new file mode 100644 index 00000000000..517ed91b1d7 --- /dev/null +++ b/arch/arc/soc/quark_se_ss/Makefile @@ -0,0 +1,5 @@ + +KBUILD_CFLAGS += $(call cc-option,-mARCv2EM) \ + $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) + +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 9484210ca0e..b3e809621f5 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -1,14 +1,10 @@ KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) $(call cc-option,-fdata-sections,) -arch-$(CONFIG_CPU_CORTEX_M3) += $(call cc-option,-mthumb -mcpu=cortex-m3) \ - $(call cc-option,-mthumb -march=armv7-m) -arch-$(CONFIG_CPU_CORTEX_M4) += $(call cc-option,-mthumb -mcpu=cortex-m4) \ - $(call cc-option,-mthumb -march=armv7e-m) +include $(srctree)/arch/$(ARCH)/soc/$(SOC_NAME)/Makefile -cflags-$(CONFIG_LTO) = $(call cc-option,-flto,) +cflags-$(CONFIG_LTO) += $(call cc-option,-flto,) -KBUILD_CFLAGS += $(cflags-y) $(arch-y) -KBUILD_AFLAGS += $(arch-y) +KBUILD_CFLAGS += $(cflags-y) QEMU_CPU_TYPE_arm = cortex-m3 QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \ diff --git a/arch/arm/soc/fsl_frdm_k64f/Makefile b/arch/arm/soc/fsl_frdm_k64f/Makefile new file mode 100644 index 00000000000..2b8373057f1 --- /dev/null +++ b/arch/arm/soc/fsl_frdm_k64f/Makefile @@ -0,0 +1,6 @@ + + +KBUILD_CFLAGS += $(call cc-option,-mthumb -mcpu=cortex-m4) \ + $(call cc-option,-mthumb -march=armv7e-m) + +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/arm/soc/ti_lm3s6965/Makefile b/arch/arm/soc/ti_lm3s6965/Makefile new file mode 100644 index 00000000000..7646acefc89 --- /dev/null +++ b/arch/arm/soc/ti_lm3s6965/Makefile @@ -0,0 +1,5 @@ + +KBUILD_CFLAGS += $(call cc-option,-mthumb -mcpu=cortex-m3) \ + $(call cc-option,-mthumb -march=armv7-m) + +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index cb6920e37c1..96994cd90ac 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -20,12 +20,9 @@ ifneq ($(CONFIG_SSE_FP_MATH),y) cflags-y += -mno-sse endif -arch-$(CONFIG_CPU_ATOM) += $(call cc-option,-march=atom) \ - $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) -arch-$(CONFIG_CPU_MINUTEIA) += $(call cc-option,-march=pentium) +include $(srctree)/arch/$(ARCH)/soc/$(SOC_NAME)/Makefile -KBUILD_CFLAGS += $(cflags-y) $(arch-y) -KBUILD_AFLAGS += $(arch-y) +KBUILD_CFLAGS += $(cflags-y) QEMU_BIOS ?= /usr/share/qemu QEMU_CPU_TYPE_x86 = qemu32 diff --git a/arch/x86/soc/atom/Makefile b/arch/x86/soc/atom/Makefile new file mode 100644 index 00000000000..7e659bd40bf --- /dev/null +++ b/arch/x86/soc/atom/Makefile @@ -0,0 +1,4 @@ + + +KBUILD_CFLAGS += -march=atom $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/ia32/Makefile b/arch/x86/soc/ia32/Makefile new file mode 100644 index 00000000000..276930ecef2 --- /dev/null +++ b/arch/x86/soc/ia32/Makefile @@ -0,0 +1,3 @@ + +KBUILD_CFLAGS += $(call cc-option,-march=pentium) +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/quark_d2000/Makefile b/arch/x86/soc/quark_d2000/Makefile new file mode 100644 index 00000000000..56e432c1914 --- /dev/null +++ b/arch/x86/soc/quark_d2000/Makefile @@ -0,0 +1,4 @@ + + +KBUILD_CFLAGS += -march=lakemont -mtune=lakemont -miamcu -msoft-float +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/quark_se/Makefile b/arch/x86/soc/quark_se/Makefile new file mode 100644 index 00000000000..76972f63463 --- /dev/null +++ b/arch/x86/soc/quark_se/Makefile @@ -0,0 +1,4 @@ + + +KBUILD_CFLAGS += $(call cc-option,-march=lakemont -mtune=lakemont -miamcu -msoft-float, -march=pentium) +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/quark_x1000/Makefile b/arch/x86/soc/quark_x1000/Makefile new file mode 100644 index 00000000000..276930ecef2 --- /dev/null +++ b/arch/x86/soc/quark_x1000/Makefile @@ -0,0 +1,3 @@ + +KBUILD_CFLAGS += $(call cc-option,-march=pentium) +KBUILD_AFLAGS += $(KBUILD_CFLAGS)