OSDN Git Service

* doc/gcc.texi: Move several chapters out to ...
[pf3gnuchains/gcc-fork.git] / gcc / doc / portability.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2 @c 1999, 2000, 2001 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @node Portability
7 @chapter GCC and Portability
8 @cindex portability
9 @cindex GCC and portability
10
11 The main goal of GCC was to make a good, fast compiler for machines in
12 the class that the GNU system aims to run on: 32-bit machines that address
13 8-bit bytes and have several general registers.  Elegance, theoretical
14 power and simplicity are only secondary.
15
16 GCC gets most of the information about the target machine from a machine
17 description which gives an algebraic formula for each of the machine's
18 instructions.  This is a very clean way to describe the target.  But when
19 the compiler needs information that is difficult to express in this
20 fashion, I have not hesitated to define an ad-hoc parameter to the machine
21 description.  The purpose of portability is to reduce the total work needed
22 on the compiler; it was not of interest for its own sake.
23
24 @cindex endianness
25 @cindex autoincrement addressing, availability
26 @findex abort
27 GCC does not contain machine dependent code, but it does contain code
28 that depends on machine parameters such as endianness (whether the most
29 significant byte has the highest or lowest address of the bytes in a word)
30 and the availability of autoincrement addressing.  In the RTL-generation
31 pass, it is often necessary to have multiple strategies for generating code
32 for a particular kind of syntax tree, strategies that are usable for different
33 combinations of parameters.  Often I have not tried to address all possible
34 cases, but only the common ones or only the ones that I have encountered.
35 As a result, a new target may require additional strategies.  You will know
36 if this happens because the compiler will call @code{abort}.  Fortunately,
37 the new strategies can be added in a machine-independent fashion, and will
38 affect only the target machines that need them.