Partial support for integer divisions in access vectors
[suif.git] / html / suif1_12.html
blobc584020c71c9fd26fb591028c4d501e8245f4f51
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 - ID Numbers</TITLE>
7 <link href="suif1_13.html" rel=Next>
8 <link href="suif1_11.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_11.html">previous</A>, <A HREF="suif1_13.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="SEC12" HREF="suif1_toc.html#TOC12">ID Numbers for Tree Nodes and Instructions</A></H3>
18 <P>
19 <A NAME="IDX27"></A>
20 <A NAME="IDX28"></A>
21 <A NAME="IDX29"></A>
22 <A NAME="IDX30"></A>
23 <A NAME="IDX31"></A>
25 </P>
26 <P>
27 <A NAME="IDX32"></A>
28 Within each procedure, the tree nodes and instructions are assigned
29 unique ID numbers. These numbers can be used to identify the nodes and
30 instructions internally and in annotations that are written to the
31 output files. The <CODE>number</CODE> method retrieves the ID numbers. It is
32 generally best to avoid using the numbers on <CODE>tree_instr</CODE> nodes,
33 because they are not written to the output files and the
34 <CODE>tree_instr</CODE> nodes are automatically rearranged when converting
35 between expression trees and flat lists of instructions. Instead, use
36 the ID numbers for the corresponding instructions.
38 </P>
39 <P>
40 <A NAME="IDX33"></A>
41 <A NAME="IDX34"></A>
42 <A NAME="IDX35"></A>
43 The <CODE>number_instrs</CODE> method in the <CODE>tree_proc</CODE> class assigns ID
44 numbers to tree nodes and instructions that do yet have numbers (i.e.
45 those that were created since the procedure was read in). This method
46 is called automatically before each procedure is written out, but you
47 may also call it whenever ID numbers are needed for new tree nodes or
48 instructions. The next unused ID number is recorded in the procedure
49 symbol table. In the <CODE>proc_symtab</CODE> class, the
50 <CODE>next_instr_num</CODE> method returns the next ID number and increments
51 the counter; the <CODE>instr_num</CODE> method returns the next number but
52 does not increment the counter. Since you can only assign new ID
53 numbers with the <CODE>number_instrs</CODE> method, you will rarely, if ever,
54 need to access this counter directly.
56 </P>
57 <P>
58 <A NAME="IDX36"></A>
59 <A NAME="IDX37"></A>
60 <A NAME="IDX38"></A>
61 In some circumstances, the tree node and instruction ID numbers must be
62 reset. The most common case is when moving code from one procedure to
63 another. Since the ID numbers are only unique within each procedure,
64 moving things between procedures is likely to create duplicate ID
65 numbers. To avoid this problem, the <CODE>tree_node</CODE>,
66 <CODE>tree_node_list</CODE>, and <CODE>instruction</CODE> classes provide
67 <CODE>clear_numbers</CODE> methods to reset the ID numbers. These methods
68 recursively descend the ASTs and expression trees to set all of the ID
69 numbers within the object and its children to zero.
71 </P>
73 <P><HR><P>
74 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_11.html">previous</A>, <A HREF="suif1_13.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
75 </BODY>
76 </HTML>