some files aren't too happy in a library
[suif.git] / html / suif1_5.html
blobe3c95661090d6beb55a5f44149942328781f678f
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 - Symbolic Information</TITLE>
7 <link href="suif1_6.html" rel=Next>
8 <link href="suif1_4.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_4.html">previous</A>, <A HREF="suif1_6.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 <H2><A NAME="SEC5" HREF="suif1_toc.html#TOC5">Symbolic Information</A></H2>
19 <P>
20 SUIF includes detailed symbolic information. Symbols and types are
21 defined in nested scopes corresponding to the block structure of the
22 program. A symbol table is attached to each element of the main SUIF
23 hierarchy that defines a new scope. Symbols record information about
24 variables, labels, and procedures. The SUIF type system is similar to C
25 but also has some support for Fortran and other languages.
27 </P>
28 <P>
29 The symbol tables (see section <A HREF="suif1_40.html#SEC40">Symbol Tables</A>) are defined in a tree
30 structure that forms a hierarchy parallel to the main SUIF hierarchy.
31 Each table records a pointer to its parent and keeps a list of its
32 children. The global symbol table at the root is attached to the file
33 set and is shared across all the files. Its children are the file
34 symbol tables attached to the file set entries. The procedure symbol
35 tables for the AST procedure nodes are in the next level down, followed
36 by the block symbol tables for block nodes within the ASTs. The block
37 symbol tables may be nested to any level.
39 </P>
40 <P>
41 Each symbol table contains a list of symbols (see section <A HREF="suif1_51.html#SEC51">Symbols</A>) that are
42 defined within the corresponding scope. There are three different kinds
43 of symbols: variables, labels, and procedures. Symbols are identified
44 by name or ID number. The ID numbers are assigned automatically and
45 should always be unique within a particular scope. Each symbol also has
46 a set of flags to record various attributes.
48 </P>
49 <P>
50 Variable symbols (see section <A HREF="suif1_55.html#SEC55">Variable Symbols</A>) may be declared in any
51 scope. A variable symbol contains a pointer to the type for the
52 variable. The type determines the amount of storage used to hold the
53 variable as well as the interpretation of its contents. Some additional
54 flags are used for variable symbols. These flags identify variables
55 that are formal parameters of the procedure and variables that have
56 their addresses taken. Another flag is used to identify variables that
57 represent machine registers. For variables that are not allocated on
58 the stack, a separate <STRONG>variable definition</STRONG> (see section <A HREF="suif1_58.html#SEC58">Variable Definitions</A>) must be entered in the symbol table. A variable
59 definition records the alignment restriction for the variable's storage
60 and its initial contents.
62 </P>
63 <P>
64 Label symbols (see section <A HREF="suif1_54.html#SEC54">Label Symbols</A>) can only be declared within
65 procedures. The position of a label in the code is marked with a
66 special instruction.
68 </P>
69 <P>
70 Procedure symbols (see section <A HREF="suif1_53.html#SEC53">Procedure Symbols</A>) can only be declared in
71 the global and file scopes. A procedure symbol contains a pointer to
72 the AST for the body of the procedure if it exists. It also provides
73 methods to read the body from an input file, write it to an output file,
74 and flush it from memory. The procedure symbol also has a pointer to the
75 type for the procedure.
77 </P>
78 <P>
79 The SUIF type system (see section <A HREF="suif1_59.html#SEC59">Types</A>) is quite powerful. It can
80 represent most, if not all, high-level types for C programs and for many
81 other languages. The types are implemented with various kinds of type
82 nodes. Each type node contains an operator that specifies the kind of
83 node. Some of the type operators define base types that stand alone,
84 while other operators refer to other types nodes. For example, a type
85 node with the <CODE>TYPE_INT</CODE> operator defines a new integer type. A
86 node with the <CODE>TYPE_PTR</CODE> operator can then refer to the integer
87 type node to create a type for pointers to integers. Operators are
88 available for integers, floating-point types, pointers, arrays,
89 functions, structures, unions, and enumerations. Each type has a
90 particular size. For some types, such as integers, the size can be set
91 directly, but for others it is determined automatically.
93 </P>
95 <P><HR><P>
96 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_4.html">previous</A>, <A HREF="suif1_6.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
97 </BODY>
98 </HTML>