| 1 |
@c Copyright (C) 1988-2022 Free Software Foundation, Inc. |
| 2 |
@c This is part of the GCC manual. |
| 3 |
@c For copying conditions, see the file gcc.texi. |
| 4 |
|
| 5 |
@node Portability |
| 6 |
@chapter GCC and Portability |
| 7 |
@cindex portability |
| 8 |
@cindex GCC and portability |
| 9 |
|
| 10 |
GCC itself aims to be portable to any machine where @code{int} is at least |
| 11 |
a 32-bit type. It aims to target machines with a flat (non-segmented) byte |
| 12 |
addressed data address space (the code address space can be separate). |
| 13 |
Target ABIs may have 8, 16, 32 or 64-bit @code{int} type. @code{char} |
| 14 |
can be wider than 8 bits. |
| 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, ad-hoc parameters have been defined for machine descriptions. |
| 21 |
The purpose of portability is to reduce the total work needed on the |
| 22 |
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, not all possible cases have been |
| 34 |
addressed, but only the common ones or only the ones that have been |
| 35 |
encountered. As a result, a new target may require additional |
| 36 |
strategies. You will know |
| 37 |
if this happens because the compiler will call @code{abort}. Fortunately, |
| 38 |
the new strategies can be added in a machine-independent fashion, and will |
| 39 |
affect only the target machines that need them. |