From f350d5a2d9e78951d8cbce009d1024ce89bf13d5 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 23 Feb 2006 09:17:48 +0000 Subject: Move -Os/-O2 first, add some gcc4 specific optimizations --- Rules.mak | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'Rules.mak') diff --git a/Rules.mak b/Rules.mak index 15f900fe6..a2234c8d9 100644 --- a/Rules.mak +++ b/Rules.mak @@ -121,6 +121,24 @@ check_ld=$(shell \ ARFLAGS:=cr OPTIMIZATION:= +# Use '-Os' optimization if available, else use -O2, allow Config to override +OPTIMIZATION+=$(call check_gcc,-Os,-O2) +# Use the gcc 3.4 -funit-at-a-time optimization when available +OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) + +GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1) +#GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2) + +ifeq ($(GCC_MAJOR_VER),4) +# shrinks code, results are from 4.0.2 +# 0.36% +OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,) +# 0.34% +OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,) +# 0.1% +OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,) +endif + PICFLAG:=-fPIC PIEFLAG_NAME:=-fPIE @@ -285,11 +303,6 @@ export ASNEEDED:=$(shell (LD_TMP=$(mktemp LD_XXXXXX) ; echo "GROUP ( AS_NEEDED ( endif endif -# Use '-Os' optimization if available, else use -O2, allow Config to override -OPTIMIZATION+=$(call check_gcc,-Os,-O2) -# Use the gcc 3.4 -funit-at-a-time optimization when available -OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) - # Add a bunch of extra pedantic annoyingly strict checks XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing ifeq ($(EXTRA_WARNINGS),y) @@ -372,8 +385,7 @@ ifeq ($(DOMULTI),y) # gcc-3.4.x supports it, but does not need and support --combine. though fails on many sources # gcc-4.0.x supports it, supports the --combine flag, but does not need it # gcc-4.1(200506xx) supports it, but needs the --combine flag, else libs are useless -GCC_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1) -ifeq ($(GCC_VER),3) +ifeq ($(GCC_MAJOR_VER),3) DOMULTI:=n else CFLAGS+=$(call check_gcc,--combine,) -- cgit v1.2.3