Partial support for integer divisions in access vectors
[suif.git] / html / suif1_50.html
blob41773445a9863bbe3fab11b3d15d350d82894c29
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 - Numbering Types and Symbols</TITLE>
7 <link href="suif1_51.html" rel=Next>
8 <link href="suif1_49.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_49.html">previous</A>, <A HREF="suif1_51.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="SEC50" HREF="suif1_toc.html#TOC50">Numbering Types and Symbols</A></H2>
18 <P>
19 <A NAME="IDX320"></A>
20 <A NAME="IDX321"></A>
21 <A NAME="IDX322"></A>
22 <A NAME="IDX323"></A>
24 </P>
25 <P>
26 <A NAME="IDX324"></A>
27 <A NAME="IDX325"></A>
28 Every symbol and type is assigned an ID number that uniquely identifies
29 it within a particular context. These ID numbers should be used to
30 refer to symbols and types in annotations that will be written to the
31 output files and in other situations where pointers to the symbol and
32 type nodes cannot be used. The <CODE>sym_id</CODE> method retrieves the ID
33 number for a symbol, and the <CODE>type_id</CODE> method gets the number for a
34 type.
36 </P>
37 <P>
38 <A NAME="IDX326"></A>
39 For symbols and types within a procedure, the ID numbers are only unique
40 within that procedure. Similarly, the ID numbers for symbols and types
41 in a file symbol table are only unique within that file. Only in the
42 global symbol table are the ID numbers truly unique. This is
43 implemented by dividing the ID numbers into three ranges. Each range is
44 reserved for a particular level in the symbol table hierarchy. To make
45 it easier to read an ID number, the <CODE>print_id_number</CODE> function
46 prints it as a character to identify the range (<SAMP>`g'</SAMP> for global,
47 <SAMP>`f'</SAMP> for file, <SAMP>`p'</SAMP> for procedure) combined with the offset of
48 the number within that range.
50 </P>
51 <P>
52 <A NAME="IDX327"></A>
53 <A NAME="IDX328"></A>
54 The symbol and type ID numbers cannot be assigned individually, but the
55 symbol tables provide methods to set them. The <CODE>number_globals</CODE>
56 method is defined in the <CODE>global_symtab</CODE> class to number the
57 entries in global and file symbol tables, and the <CODE>number_locals</CODE>
58 method is defined in the <CODE>proc_symtab</CODE> class to number all of the
59 entries in the procedure symbol table and its descendents. These
60 methods only assign ID numbers to symbols and types that do not already
61 have numbers. These methods are called automatically before writing
62 things out to files, but they can also be called whenever you want to
63 assign numbers to new symbols and types.
65 </P>
66 <P>
67 <A NAME="IDX329"></A>
68 <A NAME="IDX330"></A>
69 The <CODE>clear_sym_id</CODE> symbol method and <CODE>clear_type_id</CODE> method
70 are provided to reset the ID numbers to zero manually, but as far as
71 the library itself is concerned, this is never necessary. The library
72 automatically changes ID numbers when necessary, such as when moving
73 from one symbol table to another.
75 </P>
77 <P><HR><P>
78 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_49.html">previous</A>, <A HREF="suif1_51.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
79 </BODY>
80 </HTML>