From c4c919dbe03dbb4992e73d1f903de79d19811c20 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: I458afca5feb9be5de8dcae559d6dcac3c6d6a2a7 Signed-off-by: Anas Nashif --- arch/arc/Makefile | 12 ++++++------ arch/arc/soc/quark_se_ss/Makefile | 7 +++++++ arch/arm/Makefile | 12 ++++-------- arch/arm/soc/atmel_sam3/Makefile | 6 ++++-- arch/arm/soc/fsl_frdm_k64f/Makefile | 8 ++++++++ arch/arm/soc/ti_lm3s6965/Makefile | 7 +++++++ arch/x86/Makefile | 9 +++------ arch/x86/soc/atom/Makefile | 6 ++++++ arch/x86/soc/ia32/Makefile | 4 ++++ arch/x86/soc/quark_d2000/Makefile | 7 +++++++ arch/x86/soc/quark_se/Makefile | 7 +++++++ arch/x86/soc/quark_x1000/Makefile | 4 ++++ 12 files changed, 67 insertions(+), 22 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 d9a8976ab3f..09ae0460cd5 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -1,8 +1,8 @@ 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,) + +include $(srctree)/arch/$(ARCH)/soc/$(SOC_NAME)/Makefile + +KBUILD_CFLAGS += $(cflags-y) +KBUILD_CXXFLAGS += $(cflags-y) -KBUILD_CFLAGS += $(arch-y) $(cflags-y) -KBUILD_CXXFLAGS += $(arch-y) $(cflags-y) -KBUILD_AFLAGS += $(arch-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..ee18aeb466b --- /dev/null +++ b/arch/arc/soc/quark_se_ss/Makefile @@ -0,0 +1,7 @@ + +arch-cflags = $(call cc-option,-mARCv2EM) \ + $(call cc-option,-mav2em,) $(call cc-option,-mno-sdata) + +KBUILD_AFLAGS += $(arch-cflags) +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e717d7b3c76..8a8ef40eac9 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -1,15 +1,11 @@ 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_CXXFLAGS += $(cflags-y) $(arch-y) -KBUILD_AFLAGS += $(arch-y) +KBUILD_CFLAGS += $(cflags-y) +KBUILD_CXXFLAGS += $(cflags-y) QEMU_CPU_TYPE_arm = cortex-m3 QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \ diff --git a/arch/arm/soc/atmel_sam3/Makefile b/arch/arm/soc/atmel_sam3/Makefile index 7646acefc89..e7d49489052 100644 --- a/arch/arm/soc/atmel_sam3/Makefile +++ b/arch/arm/soc/atmel_sam3/Makefile @@ -1,5 +1,7 @@ -KBUILD_CFLAGS += $(call cc-option,-mthumb -mcpu=cortex-m3) \ +arch-cflags += $(call cc-option,-mthumb -mcpu=cortex-m3) \ $(call cc-option,-mthumb -march=armv7-m) -KBUILD_AFLAGS += $(KBUILD_CFLAGS) +KBUILD_AFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +KBUILD_CFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/fsl_frdm_k64f/Makefile b/arch/arm/soc/fsl_frdm_k64f/Makefile new file mode 100644 index 00000000000..5ebdf2eba72 --- /dev/null +++ b/arch/arm/soc/fsl_frdm_k64f/Makefile @@ -0,0 +1,8 @@ + + +arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m4) \ + $(call cc-option,-mthumb -march=armv7e-m) + +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +KBUILD_AFLAGS += $(arch-cflags) diff --git a/arch/arm/soc/ti_lm3s6965/Makefile b/arch/arm/soc/ti_lm3s6965/Makefile new file mode 100644 index 00000000000..670a9815b22 --- /dev/null +++ b/arch/arm/soc/ti_lm3s6965/Makefile @@ -0,0 +1,7 @@ + +arch-cflags = $(call cc-option,-mthumb -mcpu=cortex-m3) \ + $(call cc-option,-mthumb -march=armv7-m) + +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +KBUILD_AFLAGS += $(arch-cflags) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 5c1f49550f2..0007c8d18c4 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -20,13 +20,10 @@ 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_CXXFLAGS += $(cflags-y) $(arch-y) -KBUILD_AFLAGS += $(arch-y) +KBUILD_CXXFLAGS += $(cflags-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..ef5df42d1e7 --- /dev/null +++ b/arch/x86/soc/atom/Makefile @@ -0,0 +1,6 @@ + +arch-cflags = -march=atom $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) + +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +KBUILD_AFLAGS += $(KBUILD_CFLAGS) diff --git a/arch/x86/soc/ia32/Makefile b/arch/x86/soc/ia32/Makefile new file mode 100644 index 00000000000..0b23a2dd91d --- /dev/null +++ b/arch/x86/soc/ia32/Makefile @@ -0,0 +1,4 @@ + +KBUILD_CFLAGS += $(call cc-option,-march=pentium) +KBUILD_CXXFLAGS += $(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..b2aa75c5986 --- /dev/null +++ b/arch/x86/soc/quark_d2000/Makefile @@ -0,0 +1,7 @@ + + +arch-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -miamcu -msoft-float, -march=pentium) + +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +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..b2aa75c5986 --- /dev/null +++ b/arch/x86/soc/quark_se/Makefile @@ -0,0 +1,7 @@ + + +arch-cflags = $(call cc-option,-march=lakemont -mtune=lakemont -miamcu -msoft-float, -march=pentium) + +KBUILD_CFLAGS += $(arch-cflags) +KBUILD_CXXFLAGS += $(arch-cflags) +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..0b23a2dd91d --- /dev/null +++ b/arch/x86/soc/quark_x1000/Makefile @@ -0,0 +1,4 @@ + +KBUILD_CFLAGS += $(call cc-option,-march=pentium) +KBUILD_CXXFLAGS += $(call cc-option,-march=pentium) +KBUILD_AFLAGS += $(KBUILD_CFLAGS)