Go to the previous, next section.
The overall control structure of the compiler is in `toplev.c'. This file is responsible for initialization, decoding arguments, opening and closing files, and sequencing the passes.
The parsing pass is invoked only once, to parse the entire input. The RTL intermediate code for a function is generated as the function is parsed, a statement at a time. Each statement is read in as a syntax tree and then converted to RTL; then the storage for the tree for the statement is reclaimed. Storage for types (and the expressions for their sizes), declarations, and a representation of the binding contours and how they nest, remain until the function is finished being compiled; these are all needed to output the debugging information.
Each time the parsing pass reads a complete function definition or
top-level declaration, it calls either the function
rest_of_compilation
, or the function
rest_of_decl_compilation
in `toplev.c', which are
responsible for all further processing necessary, ending with output of
the assembler language. All other compiler passes run, in sequence,
within rest_of_compilation
. When that function returns from
compiling a function definition, the storage used for that function
definition's compilation is entirely freed, unless it is an inline
function
(see section An Inline Function is As Fast As a Macro).
Here is a list of all the passes of the compiler and their source files. Also included is a description of where debugging dumps can be requested with `-d' options.
The tree representation does not entirely follow C syntax, because it is intended to support other languages as well.
Language-specific data type analysis is also done in this pass, and every tree node that represents an expression has a data type attached. Variables are represented as declaration nodes.
Constant folding and some arithmetic simplifications are also done during this pass.
The language-independent source files for parsing are `stor-layout.c', `fold-const.c', and `tree.c'. There are also header files `tree.h' and `tree.def' which define the format of the tree representation.
The source files to parse C are `c-parse.in', `c-decl.c', `c-typeck.c', `c-aux-info.c', `c-convert.c', and `c-lang.c' along with header files `c-lex.h', and `c-tree.h'.
The source files for parsing C++ are `cp-parse.y', `cp-class.c', `cp-cvt.c', `cp-decl.c', `cp-decl2.c', `cp-dem.c', `cp-except.c',