In order to accommodate link-time optimization, some changes must be made to the internal representation used by GCC. In particular:

  1. Because the LTO front end can be used with input object files compiled with different programming languages, the meaning of all TREE constructs read in by the LTO reader must be language-independent.
  2. All use of RTL for global variables, function parameters, and so forth, must be delayed (or made redundant) until the compiler begins converting TREE to RTL.

Language-Independent Representation

It is no longer acceptable to have interpretation of TREE depend on front-end variables or front-end hooks. While, at least in theory, it is still acceptable to have the interpretation depend on some back-end variables or hooks, as a single back end will be used for all input object files, it is desirable to make the TREE representation complete. It is not true that all front-end hooks must be removed from GCC. Hooks that are used only during the construction of TREE, but are not required to interpret GIMPLE, may remain.

In the short term, interpretation dependencies on middle-end and back-end hooks (or variables) can be ignored. Instead, the LTO reader will assume that all middle-end and back-end options will have the same values during initial compilation (with -flto) and during link-time optimization.

C Front End Hooks

This section lists all C front end hooks, categorizing them as to whether or not they affect the interpretation of GIMPLE. The set of hooks defined by the C front end can be determined by looking at c-lang.c and c-objc-common.h.

All hooks defined by the C front end should be listed in either the first or second list below. All hooks were originally placed in the first list. If you determine that a particular hook does not affect the interpretation of GIMPLE, please move it to the second list, together with a rationale. If you completely eliminate a hook, then you may simply remove it from the list in which it is defined.

The C front end defines the following hooks which may affect interpretation of GIMPLE:

The C front end defines the following hooks which do not affect interpretation of GIMPLE:

Early RTL Generation

Because the compiler used to generate RTL after processing each statement, various parts of the compiler still generate RTL early in the compilation process. The LTO reader is not capable of restoring RTL information. Therefore, all RTL information will be discarded by the LTO writer. In theory, as long as equivalent RTL can be regenerated by the LTO reader (by, for example, invoking make_decl_rtl) the early generation of RTL need not be eliminated. However, it is desirable that the LTO writer be able to assert that all RTL fields it encounters are NULL_RTX, as that will eliminate any mismatches. In addition, early generation of RTL is wasteful.

None: LTO_Representation_Changes (last edited 2008-01-10 19:38:59 by localhost)