Go to the previous, next section.

The File Level

SUIF is designed to support interprocedural analysis and optimization with separate compilation. At the root of the hierarchy for a SUIF program is a file set containing a list of the files being compiled. See section The File Set. Each entry within the file set is a file set entry that contains the input and output streams for a particular file. See section File Set Entries.

The file level of the SUIF hierarchy also contains the global symbol tables. The file set contains the global symbol table that is shared across all of the files. This shared symbol table is the key to supporting interprocedural analysis. References to a global symbol or type from different files can point to the same entry in the shared global symbol table, making it easy to determine that they refer to the same entity. Each file set entry also contains its own symbol table for things declared privately within that file.

Lower levels of the SUIF hierarchy can be reached through the global symbol tables. Besides the types and variables, the global symbol tables contain symbols for the procedures. The procedure bodies can be accessed through these procedure symbols. If the body of a procedure is contained in one of the input files, the corresponding procedure symbol automatically records a pointer to the input file and provides a method to read the body into memory. The procedure symbol also has other methods to write the body to an output file and to flush the body from memory. Many SUIF programs need to process all the procedures. This can be done by searching through the global symbol tables for the procedure symbols. However since this is such a common task, the file set entries include procedure iterators to step through all the procedures.

For passes that work on one file at a time, the file set is not worth much, but it is very helpful for interprocedural passes. Without it, they would have to combine all the code into one big file. While that may not be an unreasonable solution, SUIF file sets provide the benefits of separate compilation with only a moderate increase in complexity.

Go to the previous, next section.