GNU Compiler Collection - Structure

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:

    What is the most rigorous law of our being? Growth. No smallest atom of our moral, mental, or physical structure can stand still a year. It grows—it must grow; nothing can prevent it.
    Mark Twain [Samuel Langhorne Clemens] (1835–1910)

    When a house is tottering to its fall,
    The strain lies heaviest on the weakest part,
    One tiny crack throughout the structure spreads,
    And its own weight soon brings it toppling down.
    Ovid (Publius Ovidius Naso)

    Vashtar: So it’s finished. A structure to house one man and the greatest treasure of all time.
    Senta: And a structure that will last for all time.
    Vashtar: Only history will tell that.
    Senta: Sire, will he not be remembered?
    Vashtar: Yes, he’ll be remembered. The pyramid’ll keep his memory alive. In that he built better than he knew.
    William Faulkner (1897–1962)