|
}
A GNU Compiler Collection (unremarkably shortened to GCC) occurs as placed of programming language compilers produced by a GNU Project. These are free software distributed by the Free Software Foundation (FSF) under the GNU GPL and GNU LGPL, and occurs as key component of the GNU toolchain. These are a standard compiler for the open source Unix-like operating systems, and certain proprietary operating systems derived therefrom like Mac OS X.
Originally known as a GNU C Compiler, because it exclusively handled a C programming language, GCC was later touch compile C++, Fortran, Ada, and others.
Overview
GCC was originally written by Richard Stallman in 1987 as the compiler for the GNU Plan, sequentially to have a compiler available that was free software. Its development was closely shepherded per Free Software Foundation.
Within 1997, a class action of developers dissatisfied using a slow pace and closed nature of official GCC development formed a task known as EGCS (Experimental/Enhanced GNU Compiler System) which merged many experimental forks into a single design forked from either GCC. EGCS development later on proved sufficiently supplementary vital than GCC development & EGCS was at length "blessed" when a official version of GCC within April 1999.
GCC is currently maintained by the varied class action of coder from either in the world. It has been ported to additional sort of processors and operating systems than any other compiler.
Too when existence a official compiler of the Wildebeest formulas, including Linux-depending variants (GNU/Linux), GCC has been adopted as a independent compiler utilized to build & have more operating systems including a BSDs, Mac OS X, NeXTSTEP, and BeOS.
GCC is typically the compiler of selectiin for getting software system that is expected to execute on a overplus of devices. Differences withwithin native compilers lead to difficulties in getting code that might compile right in all the compilers & build scripts that may run all the platforms. By applying GCC, a equivalent parser is utilized for completely platforms, and so whenever a code compiles in a single, chances come high that it compiles in tons. Within a few legal actions GCC produces slower executables than more compilers, however existence loose package, and/or a expected for decreased development costs typically makes utilizing it worthwhile.
Languages
As of version 4.0.0 (released on April 20 2005), the standard compiler release includes front ends for:
Ada (GCC for Ada aka GNAT)
C
C++ (GCC for C++ aka G++)
Fortran (GCC for Fortran aka GFortran)
Java (GCC for Java aka GCJ)
Objective-C
The forepart for CHILL was previously involved, however has been dropped owing to the want of maintenance. A G77 front was come by favour of the fresh GFortran frontend that supports Fortran 95. Pascal, Modula-2, Modula-3, Mercury, VHDL, PL/I and Objective-C++ frontends also survive.
Architectures
GCC target processors (as of version 4.1) include:
Alpha
ARM
Blackfin
H8/300
System/370, System 390
x86 and AMD64
IA-64 "Itanium"
Motorola 68000
Motorola 88000
MIPS
PA-RISC
PDP-11
PowerPC
SuperH
SPARC
VAX
Renesas R8C/M16C/M32C families
MorphoSys family
Lesser-known target processors supported in the standard release keep close at hand involved A29K, ARC, Atmel AVR, C4x, CRIS, D30V, DSP16xx, FR-30, FR-V, Intel i960, IP2000, M32R, 68HC11, MCORE, MMIX, MN10200, MN10300, NS32K, ROMP, Stormy16, V850, and Xtensa. Extra processors, like a D10V, PDP-10, and Z8000, have been supported by GCC versions maintained one by one from either a FSF version.
Structure
GCC's external interface is typically standard for the Unix compiler. Users invoke the driver program known as gcc, which interprets command arguments, decides which language compilers to have for both input file, diarrhea a assembler on their output, and then even diarrhea a linker to produce the complete program.
Every of the language compilers occurs as separate program that will require inside source code & garden truck assembly language. the lot have a most common internal structure; a by the-language front end that parses the languages and produces an abstract syntax tree ("tree" for short), and the back end that converts the trees to GCC's Register Transfer Language (RTL), runs various compiler optimizations, then produces assembly language utilizing architecture-specific pattern matching originally based on an algorithmic program of Jack Davidson and Chris Fraser's.
100% of GCC is written withwithin C, although lot of the Ada frontend is written in Ada.
Front ends
Frontends vary internally, getting to make trees that may be handled per backend. the few parsers utilise a YACC-type grammar specification, & a others come hand-coded recursive descent parsers.
Until recently, a tree representation of the program was non fully independent of the processor existence targeted. Bewilderingly, the meaning of a tree was somewhat different for different language front-terminates, & front-ceases may provide their have tree codes.
Recently, ii recently forms of language-independent trees develop been introduced. These fresh tree formats come known as GENERIC and GIMPLE. Parsing is nowadays done by creating irregular language-dependent trees, & converting the children to GENERIC. A and so-alleged gimplifier so lowers this other complex form into a simpler SSA-based GIMPLE form which is the most common language for the heavy total of freshly right language- & architecture-independent spherical (work scope) optimizations.
Optimizatiin on trees doesn't typically healthy into what virtually all compiler developers would assume the front prevent project, when these are non language dependant & doesn't require parsing. GCC developers use given this a portion of a compiler a somewhat contradictory title the "middle end." These optimizations include dead code elimination, partial redundancy elimination, global value numbering, sparse conditional constant propagation, and scalar replacement of aggregates. Array dependence depending optimizations like automatic vectorization are currently existence developed.
Back end
A behavior of the GCC back prevent is partially specified by preprocessor macros and functions specific to a target architecture, e.g. to define a endianness, word size, and calling conventions. A front a portion of the back prevent utilizes these to help decide RTL generation, and so although GCC's RTL is nominally processor-independent, a initial sequence of abstract videos is already adapted to the target.
A precise placed of GCC optimizations varies from either release to release when it develops, however includes a standard algorithmic rule, like jump optimization, jump threading, common subexpression elimination, instruction scheduling, and so forth. A RTL optimizations come of less importance using a recent additiin of spherical SSA-depending optimizations on GIMPLE trees, as RTL optimizations keep around a great deal additional limited scope, & have less high-level data.
The "reloading" phase changes abstract (pseudo-) registers into real machine registers, applying information collected from either a system describing a target's instruction set. This occurs as somewhat complicated phase, because it must account for the vagaries of 100% of GCC's targets.
A final phase is somewhat anticlimactic, since a system to match were typically chosen when you took reloading, so a assembly code is just built by going substitutions of registers & addresses into a strings specifying the instructions.
Debbuging GCC programs
A primary convienence for debugging GCC code a GNU Debugger (gdb). Among sir thomas more specialised information come Valgrind for finding memory leaks.
|