[PATCH] ARM: don't overalign strings when optimizing for size

Richard Earnshaw Richard.Earnshaw@buzzard.freeserve.co.uk
Fri Nov 17 01:18:00 GMT 2006


When we are optimizing for space, we don't want to waste it on padding 
that isn't mandated by the ABI.  This patch removes such over-alignment of 
strings, which normally has a small performance benefit, but costs us 
dearly in terms of padding.  On ARM this change is worth about 0.6% on 
CSiBE.  On Thumb it's more like 0.8%.

Tested on an arm-eabi cross and installed on mainline.

2006-11-16  Richard Earnshaw  <rearnsha@arm.com>

	* arm.h (CONSTANT_ALIGNMENT): Don't over-align strings when
	optimizing for size.


-------------- next part --------------
*** gcc/config/arm/arm.h	(revision 115198)
--- gcc/config/arm/arm.h	(revision 115199)
*************** extern int arm_cpp_interwork;
*** 479,484 ****
--- 479,485 ----
  
  #define CONSTANT_ALIGNMENT(EXP, ALIGN)				\
     ((TREE_CODE (EXP) == STRING_CST				\
+      && !optimize_size						\
       && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR)	\
      ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))
  


More information about the Gcc-patches mailing list