113687Swosch@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
213687Swosch@c 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
313687Swosch@c This is part of the GCC manual.
450477Speter@c For copying conditions, see the file gcc.texi.
513687Swosch
613687Swosch@node Portability
778047Sache@chapter GCC and Portability
878047Sache@cindex portability
913687Swosch@cindex GCC and portability
1078047Sache
1115714SacheGCC itself aims to be portable to any machine where @code{int} is at least
1213687Swoscha 32-bit type.  It aims to target machines with a flat (non-segmented) byte
1313687Swoschaddressed data address space (the code address space can be separate).
1413687SwoschTarget ABIs may have 8, 16, 32 or 64-bit @code{int} type.  @code{char}
1513687Swoschcan be wider than 8 bits.
1613687Swosch
17120931SgrogGCC gets most of the information about the target machine from a machine
1813687Swoschdescription which gives an algebraic formula for each of the machine's
19157788Sbruefferinstructions.  This is a very clean way to describe the target.  But when
2013687Swoschthe compiler needs information that is difficult to express in this
2113687Swoschfashion, ad-hoc parameters have been defined for machine descriptions.
2213687SwoschThe purpose of portability is to reduce the total work needed on the
2313687Swoschcompiler; it was not of interest for its own sake.
24120931Sgrog
2513687Swosch@cindex endianness
26157876Sbrueffer@cindex autoincrement addressing, availability
27157876Sbrueffer@findex abort
28120931SgrogGCC does not contain machine dependent code, but it does contain code
29157876Sbruefferthat depends on machine parameters such as endianness (whether the most
30157876Sbrueffersignificant byte has the highest or lowest address of the bytes in a word)
31157876Sbruefferand the availability of autoincrement addressing.  In the RTL-generation
32162910Smaximpass, it is often necessary to have multiple strategies for generating code
33120931Sgrogfor a particular kind of syntax tree, strategies that are usable for different
34157876Sbrueffercombinations of parameters.  Often, not all possible cases have been
35157876Sbruefferaddressed, but only the common ones or only the ones that have been
36157876Sbruefferencountered.  As a result, a new target may require additional
37157876Sbruefferstrategies.  You will know
38120931Sgrogif this happens because the compiler will call @code{abort}.  Fortunately,
3913687Swoschthe new strategies can be added in a machine-independent fashion, and will
4013687Swoschaffect only the target machines that need them.
41162909Smaxim