1*ec02198aSmrg@c Copyright (C) 1988-2020 Free Software Foundation, Inc.
210d565efSmrg@c This is part of the GCC manual.
310d565efSmrg@c For copying conditions, see the file gcc.texi.
410d565efSmrg
510d565efSmrg@node Portability
610d565efSmrg@chapter GCC and Portability
710d565efSmrg@cindex portability
810d565efSmrg@cindex GCC and portability
910d565efSmrg
1010d565efSmrgGCC itself aims to be portable to any machine where @code{int} is at least
1110d565efSmrga 32-bit type.  It aims to target machines with a flat (non-segmented) byte
1210d565efSmrgaddressed data address space (the code address space can be separate).
1310d565efSmrgTarget ABIs may have 8, 16, 32 or 64-bit @code{int} type.  @code{char}
1410d565efSmrgcan be wider than 8 bits.
1510d565efSmrg
1610d565efSmrgGCC gets most of the information about the target machine from a machine
1710d565efSmrgdescription which gives an algebraic formula for each of the machine's
1810d565efSmrginstructions.  This is a very clean way to describe the target.  But when
1910d565efSmrgthe compiler needs information that is difficult to express in this
2010d565efSmrgfashion, ad-hoc parameters have been defined for machine descriptions.
2110d565efSmrgThe purpose of portability is to reduce the total work needed on the
2210d565efSmrgcompiler; it was not of interest for its own sake.
2310d565efSmrg
2410d565efSmrg@cindex endianness
2510d565efSmrg@cindex autoincrement addressing, availability
2610d565efSmrg@findex abort
2710d565efSmrgGCC does not contain machine dependent code, but it does contain code
2810d565efSmrgthat depends on machine parameters such as endianness (whether the most
2910d565efSmrgsignificant byte has the highest or lowest address of the bytes in a word)
3010d565efSmrgand the availability of autoincrement addressing.  In the RTL-generation
3110d565efSmrgpass, it is often necessary to have multiple strategies for generating code
3210d565efSmrgfor a particular kind of syntax tree, strategies that are usable for different
3310d565efSmrgcombinations of parameters.  Often, not all possible cases have been
3410d565efSmrgaddressed, but only the common ones or only the ones that have been
3510d565efSmrgencountered.  As a result, a new target may require additional
3610d565efSmrgstrategies.  You will know
3710d565efSmrgif this happens because the compiler will call @code{abort}.  Fortunately,
3810d565efSmrgthe new strategies can be added in a machine-independent fashion, and will
3910d565efSmrgaffect only the target machines that need them.
40