1 |
711 |
jeremybenn |
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2 |
|
|
@c 1999, 2000, 2001, 2002, 2004 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 |
|
|
GCC itself aims to be portable to any machine where @code{int} is at least
|
12 |
|
|
a 32-bit type. It aims to target machines with a flat (non-segmented) byte
|
13 |
|
|
addressed data address space (the code address space can be separate).
|
14 |
|
|
Target ABIs may have 8, 16, 32 or 64-bit @code{int} type. @code{char}
|
15 |
|
|
can be wider than 8 bits.
|
16 |
|
|
|
17 |
|
|
GCC gets most of the information about the target machine from a machine
|
18 |
|
|
description which gives an algebraic formula for each of the machine's
|
19 |
|
|
instructions. This is a very clean way to describe the target. But when
|
20 |
|
|
the compiler needs information that is difficult to express in this
|
21 |
|
|
fashion, ad-hoc parameters have been defined for machine descriptions.
|
22 |
|
|
The purpose of portability is to reduce the total work needed on the
|
23 |
|
|
compiler; it was not of interest for its own sake.
|
24 |
|
|
|
25 |
|
|
@cindex endianness
|
26 |
|
|
@cindex autoincrement addressing, availability
|
27 |
|
|
@findex abort
|
28 |
|
|
GCC does not contain machine dependent code, but it does contain code
|
29 |
|
|
that depends on machine parameters such as endianness (whether the most
|
30 |
|
|
significant byte has the highest or lowest address of the bytes in a word)
|
31 |
|
|
and the availability of autoincrement addressing. In the RTL-generation
|
32 |
|
|
pass, it is often necessary to have multiple strategies for generating code
|
33 |
|
|
for a particular kind of syntax tree, strategies that are usable for different
|
34 |
|
|
combinations of parameters. Often, not all possible cases have been
|
35 |
|
|
addressed, but only the common ones or only the ones that have been
|
36 |
|
|
encountered. As a result, a new target may require additional
|
37 |
|
|
strategies. You will know
|
38 |
|
|
if this happens because the compiler will call @code{abort}. Fortunately,
|
39 |
|
|
the new strategies can be added in a machine-independent fashion, and will
|
40 |
|
|
affect only the target machines that need them.
|