190075Sobrien@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2132718Skan@c 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
390075Sobrien@c This is part of the GCC manual.
490075Sobrien@c For copying conditions, see the file gcc.texi.
590075Sobrien
690075Sobrien@node Portability
790075Sobrien@chapter GCC and Portability
890075Sobrien@cindex portability
990075Sobrien@cindex GCC and portability
1090075Sobrien
11119256SkanGCC itself aims to be portable to any machine where @code{int} is at least
12119256Skana 32-bit type.  It aims to target machines with a flat (non-segmented) byte
13119256Skanaddressed data address space (the code address space can be separate).
14169689SkanTarget ABIs may have 8, 16, 32 or 64-bit @code{int} type.  @code{char}
15119256Skancan be wider than 8 bits.
1690075Sobrien
1790075SobrienGCC gets most of the information about the target machine from a machine
1890075Sobriendescription which gives an algebraic formula for each of the machine's
1990075Sobrieninstructions.  This is a very clean way to describe the target.  But when
2090075Sobrienthe compiler needs information that is difficult to express in this
21132718Skanfashion, ad-hoc parameters have been defined for machine descriptions.
22132718SkanThe purpose of portability is to reduce the total work needed on the
23132718Skancompiler; it was not of interest for its own sake.
2490075Sobrien
2590075Sobrien@cindex endianness
2690075Sobrien@cindex autoincrement addressing, availability
2790075Sobrien@findex abort
2890075SobrienGCC does not contain machine dependent code, but it does contain code
2990075Sobrienthat depends on machine parameters such as endianness (whether the most
3090075Sobriensignificant byte has the highest or lowest address of the bytes in a word)
3190075Sobrienand the availability of autoincrement addressing.  In the RTL-generation
3290075Sobrienpass, it is often necessary to have multiple strategies for generating code
3390075Sobrienfor a particular kind of syntax tree, strategies that are usable for different
34132718Skancombinations of parameters.  Often, not all possible cases have been
35132718Skanaddressed, but only the common ones or only the ones that have been
36132718Skanencountered.  As a result, a new target may require additional
37132718Skanstrategies.  You will know
3890075Sobrienif this happens because the compiler will call @code{abort}.  Fortunately,
3990075Sobrienthe new strategies can be added in a machine-independent fashion, and will
4090075Sobrienaffect only the target machines that need them.
41