Structure
GCC's external interface is generally standard for a UNIX compiler. Users invoke a driver program named gcc
, which interprets command arguments, decides which language compilers to use for each input file, runs the assembler on their output, and then possibly runs the linker to produce a complete executable binary.
Each of the language compilers is a separate program that inputs source code and outputs machine code. All have a common internal structure. A per-language front end parses the source code in that language and produces an abstract syntax tree ("tree" for short).
These are, if necessary, converted to the middle-end's input representation, called GENERIC form; the middle-end then gradually transforms the program towards its final form. Compiler optimizations and static code analysis techniques (such as FORTIFY_SOURCE, a compiler directive that attempts to discover some buffer overflows) are applied to the code. These work on multiple representations, mostly the architecture-independent GIMPLE representation and the architecture-dependent RTL representation. Finally, machine code is produced using architecture-specific pattern matching originally based on an algorithm of Jack Davidson and Chris Fraser.
GCC is written primarily in C except for parts of the Ada front end. The distribution includes the standard libraries for Ada, C++, and Java whose code is mostly written in those languages. On some platforms, the distribution also includes a low-level runtime library, libgcc, written in a combination of machine-independent C and processor-specific machine code, designed primarily to handle arithmetic operations that the target processor cannot perform directly.
In May 2010, the GCC steering committee decided to allow use of a C++ compiler to compile GCC. The compiler will be written in C plus a subset of features from C++. In particular, this was decided so that GCC's developers could use the "destructors" and "generics" features of C++.
In August 2012, the GCC steering committee announced that GCC now uses C++ as its implementation language. This means that to build GCC from sources, a C++ compiler is required that understands C++ 2003. For more details on the rationale and specific changes, please refer to the C++ conversion page.
Read more about this topic: GNU Compiler Collection
Famous quotes containing the word structure:
“Slumism is the pent-up anger of people living on the outside of affluence. Slumism is decay of structure and deterioration of the human spirit. Slumism is a virus which spreads through the body politic. As other isms, it breeds disorder and demagoguery and hate.”
—Hubert H. Humphrey (19111978)
“... the structure of a page of good prose is, analyzed logically, not something frozen but the vibrating of a bridge, which changes with every step one takes on it.”
—Robert Musil (18801942)
“Communism is a proposition to structure the world more reasonably, a proposition for changing the world. As such, we have to analyze it and, if we deem it reasonable, act upon it.”
—Friedrich Dürrenmatt (19211990)