This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] MIPS: Align local variables like global variables


Aligning local string variables is important for some benchmarks when
an optimised strcmp function is available. ;)

Nigel


2007-09-26  Nigel Stephens  <nigel@mips.com>

	* config/mips/mips.h (LOCAL_ALIGNMENT): Define.


--- mips.h	(revision 128777)
+++ mips.h	(working copy)
@@ -1322,7 +1322,23 @@
 	|| TREE_CODE (TYPE) == UNION_TYPE				\
 	|| TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
 
+/* If defined, a C expression to compute the alignment for a local
+   variable.  TYPE is the data type, and ALIGN is the alignment that
+   the object would ordinarily have.  The value of this macro is used
+   instead of that alignment to align the object.
 
+   If this macro is not defined, then ALIGN is used.
+
+   One use of this macro is to increase alignment of medium-size data
+   to make it all fit in fewer cache lines.  We need this for the same
+   reason as DATA_ALIGNMENT, namely to cause character arrays to be
+   word-aligned so that `strcpy' calls that copy constants to
+   character arrays can be done inline, and 'strcmp' can be optimised
+   to use word loads. */
+
+#define LOCAL_ALIGNMENT(TYPE, ALIGN)				\
+  DATA_ALIGNMENT(TYPE, ALIGN)
+  
 #define PAD_VARARGS_DOWN \
   (FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]