GNU Info

Info Node: (g77-295.info)Two-pass Design

(g77-295.info)Two-pass Design


Next: Challenges Posed Prev: Philosophy of Code Generation Up: Front End
Enter node , (file) or (file)node

Two-pass Design
===============

   The FFE does not tell the GBE anything about a program unit until
after the last statement in that unit has been parsed.  (A program unit
is a Fortran concept that corresponds, in the C world, mostly closely
to functions definitions in ISO C.  That is, a program unit in Fortran
is like a top-level function in C.  Nested functions, found among the
extensions offered by GNU C, correspond roughly to Fortran's statement
functions.)

   So, while parsing the code in a program unit, the FFE saves up all
the information on statements, expressions, names, and so on, until it
has seen the last statement.

   At that point, the FFE revisits the saved information (in what
amounts to a second "pass" over the program unit) to perform the actual
translation of the program unit into GBEL, ultimating in the generation
of assembly code for it.

   Some lookahead is performed during this second pass, so the FFE
could be viewed as a "two-plus-pass" design.

Two-pass Code
Why Two Passes

automatically generated by info2www version 1.2.2.9