This is the mail archive of the gcc@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]

Re: gcc@gcc.gnu.org


Hi Frank,

On Sat, 25 Aug 2001, Frank Klemm wrote:
>How to avoid the silly string alignment:
>
>char  string1 [] = "Hello";
>char  string2 [] = "world";
>
>Hex dump of the binary:
>
>	H e l l o . . . . . . . . . . .
>	. . . . . . . . . . . . . . . . 
>	w o r l d . . . . . . . . . . .
>	. . . . . . . . . . . . . . . . 

on the Hitachi SH series I did the following
changes to get better string alignment

Hartmut

*** sh.h.orig	Tue Jan  9 11:25:22 2001
--- sh.h	Wed Jan 10 01:32:11 2001
***************
*** 366,372 ****
  /* Make strings word-aligned so strcpy from constants will be faster.  */
  #define CONSTANT_ALIGNMENT(EXP, ALIGN)	\
    ((TREE_CODE (EXP) == STRING_CST	\
!     && (ALIGN) < FASTEST_ALIGNMENT)	\
      ? FASTEST_ALIGNMENT : (ALIGN))
  
  #ifndef MAX_OFILE_ALIGNMENT
--- 366,373 ----
  /* Make strings word-aligned so strcpy from constants will be faster.  */
  #define CONSTANT_ALIGNMENT(EXP, ALIGN)	\
    ((TREE_CODE (EXP) == STRING_CST	\
!     && (ALIGN) < FASTEST_ALIGNMENT 	\
!     && !TARGET_SMALLCODE)		\
      ? FASTEST_ALIGNMENT : (ALIGN))
  
  #ifndef MAX_OFILE_ALIGNMENT
***************
*** 377,382 ****
--- 378,384 ----
  #define DATA_ALIGNMENT(TYPE, ALIGN)		\
    (TREE_CODE (TYPE) == ARRAY_TYPE		\
     && TYPE_MODE (TREE_TYPE (TYPE)) == QImode	\
+    && !TARGET_SMALLCODE			\
     && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
  
  /* Number of bits which any structure or union's size must be a


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