Eliminate another warning.
[suif.git] / html / suif1_42.html
blobbff61980c8cff968cce1a235d0b28dc08b3b497e
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.54
4 from suif1.texi on 28 April 1999 -->
6 <TITLE>The SUIF Version 1 Library - Global Symbol Table</TITLE>
7 <link href="suif1_43.html" rel=Next>
8 <link href="suif1_41.html" rel=Previous>
9 <link href="suif1_toc.html" rel=ToC>
11 </HEAD>
12 <BODY>
13 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_41.html">previous</A>, <A HREF="suif1_43.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
14 <P><HR><P>
17 <H3><A NAME="SEC42" HREF="suif1_toc.html#TOC42">The Global Symbol Table</A></H3>
18 <P>
19 <A NAME="IDX265"></A>
20 <A NAME="IDX266"></A>
22 </P>
23 <P>
24 The global symbol table is at the top of the symbol table hierarchy and
25 corresponds to the outermost global scope. It contains objects that are
26 visible across source files (i.e. shared types and global symbols with
27 external linkage). For this reason, it is associated with the
28 <CODE>file_set</CODE> object. See section <A HREF="suif1_8.html#SEC8">The File Set</A>.
30 </P>
31 <P>
32 The advantage of using a shared global symbol table appears when
33 performing interprocedural analyses and transformations. Without a
34 common symbol table, it can be quite a burden to deal with references to
35 symbols that are defined in some files but not in others. Even trying
36 to determine which symbols from different files correspond to the same
37 objects is difficult. In essence, each interprocedural pass would need
38 to do the work of a linker! The shared global symbol table avoids all
39 of these problems and makes interprocedural optimization relatively
40 easy.
42 </P>
43 <P>
44 Along with the benefits of the global symbol table come a few
45 difficulties. Sharing the global symbol table across files makes it
46 difficult to support separate compilation. Each file must contain a
47 copy of the global symbol table, and if these files are manipulated
48 individually, their copies of the global symbol table will not be
49 consistent. Thus, before a group of files can be combined in a SUIF
50 file set, their global symbol tables must be "linked" together using
51 the SUIF linker pass. Whether this is preferable to just combining all
52 of the source files into one big SUIF file is debatable.
54 </P>
55 <P>
56 <A NAME="IDX267"></A>
57 The <CODE>global_symtab</CODE> class is used to represent the global symbol
58 table. It is also used as the base class for file symbol tables.
59 Because procedure symbols may only be entered in global and file symbol
60 tables, this class contains the methods to deal with them. The
61 <CODE>new_proc</CODE> method creates a new procedure symbol and enters it in
62 the table (see section <A HREF="suif1_48.html#SEC48">Creating New Entries</A>), and the <CODE>lookup_proc</CODE>
63 method searches for an existing procedure symbol (see section <A HREF="suif1_47.html#SEC47">Lookup Methods</A>). The <CODE>number_globals</CODE> method in this class handles the
64 task of assigning ID numbers to the symbols and types in global and file
65 symbol tables (see section <A HREF="suif1_50.html#SEC50">Numbering Types and Symbols</A>).
67 </P>
69 <P><HR><P>
70 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_41.html">previous</A>, <A HREF="suif1_43.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
71 </BODY>
72 </HTML>