I think it is hardcoded in a special folder, for example. for sparc
http://www.google.com/codesearch#Yj7Hz1ZInUg/trunk/gcc-4.2.1/gcc/config/sparc/sparc.h
#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64) #define FASTEST_ALIGNMENT 64
...
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < FASTEST_ALIGNMENT) \ ? FASTEST_ALIGNMENT : (ALIGN)) #define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
and sparc.c in the same folder.
Some basic alignment rules are defined in gcc / tree.c, for example. for void:
/* We are not going to have real types in C with less than byte alignment, so we might as well not have any types that claim to have it. */ TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; TYPE_USER_ALIGN (void_type_node) = 0;
It will be compiled into gcc during the build process.
So, alignments are compiled by default, but they can be changed by manipulating objects like TREE from gcc code.
UPDATE: x86 config has the best comments:
#define BIGGEST_ALIGNMENT 128 #define ALIGN_MODE_128(MODE) \ ((MODE) == XFmode || SSE_REG_MODE_P (MODE)) ... #define BIGGEST_FIELD_ALIGNMENT 32 ... #define CONSTANT_ALIGNMENT(EXP, ALIGN) ix86_constant_alignment ((EXP), (ALIGN)) #define DATA_ALIGNMENT(TYPE, ALIGN) ix86_data_alignment ((TYPE), (ALIGN)) #define LOCAL_ALIGNMENT(TYPE, ALIGN) ix86_local_alignment ((TYPE), (ALIGN)) ... #define STRICT_ALIGNMENT 0
For arches of hands, mixes, sparks and others (which limits non-attached memory access), the required alignment of any machine command can be written in the arch.md file (for example, in sparc.md)