Partial support for integer divisions in access vectors
[suif.git] / html / suif1_20.html
blobaad4cd6b0c8b51c4aaf7ac4b7d9518b63dc0310b
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 - Tree Node Lists</TITLE>
7 <link href="suif1_21.html" rel=Next>
8 <link href="suif1_19.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_19.html">previous</A>, <A HREF="suif1_21.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="SEC20" HREF="suif1_toc.html#TOC20">Tree Node Lists</A></H2>
18 <P>
19 <A NAME="IDX118"></A>
21 </P>
22 <P>
23 <A NAME="IDX119"></A>
24 <A NAME="IDX120"></A>
25 <A NAME="IDX121"></A>
26 A <CODE>tree_node_list</CODE> is a doubly-linked list of tree nodes, derived
27 from the <CODE>dlist</CODE> class. See section <A HREF="suif1_95.html#SEC95">Doubly-Linked Lists</A>. Most nodes in
28 an AST have their children recorded in tree node lists. For example,
29 the body of a block node is a tree node list. Besides the standard list
30 features, each tree node list includes a back-pointer to its parent tree
31 node. These pointers are maintained automatically by the SUIF library
32 and can be accessed using the <CODE>parent</CODE> method. In addition, each
33 node on a tree node list contains pointers back to the list and the list
34 element. See section <A HREF="suif1_13.html#SEC13">Other Features Shared by All Tree Nodes</A>. These pointers are set by the
35 <CODE>set_elem</CODE> method (see section <A HREF="suif1_92.html#SEC92">Generic Lists</A>) which is automatically
36 called every time an element is added to the list.
38 </P>
39 <P>
40 <A NAME="IDX122"></A>
41 <A NAME="IDX123"></A>
42 <A NAME="IDX124"></A>
43 <A NAME="IDX125"></A>
44 In a <CODE>tree_for</CODE> node, the lower bound, upper bound, and step value
45 are usually treated as operands; however, the operands are actually
46 stored as tree node lists. See section <A HREF="suif1_17.html#SEC17">For Nodes</A>. Each of these lists is
47 required to contain a single expression with a dummy copy instruction at
48 the root. The destination of the dummy copy must be a null operand.
49 The <CODE>tree_node_list</CODE> class includes several methods to handle these
50 special lists. The <CODE>is_op</CODE> method checks if the list consists of a
51 single copy instruction with a null destination. The <CODE>op</CODE> method
52 retrieves the operand stored in the list. If after converting the list
53 to expression tree form, the <CODE>is_op</CODE> method returns <CODE>TRUE</CODE>,
54 the <CODE>op</CODE> method returns the source operand of the dummy copy
55 instruction; otherwise, an error occurs. The <CODE>set_op</CODE> method is
56 used to set the contents of the tree node list to a dummy copy
57 instruction with the specified operand as its source. The list must
58 either be empty or already contain the dummy copy. Finally, the
59 <CODE>op_is_intconst</CODE> method checks if the operand in the tree node list
60 is a constant integer, and if so, returns the value.
62 </P>
63 <P>
64 <A NAME="IDX126"></A>
65 <A NAME="IDX127"></A>
66 Tree node lists can easily be printed out as text. The <CODE>print</CODE>
67 method simply iterates through the list and calls the <CODE>print</CODE>
68 method for each tree node. The optional <CODE>depth</CODE> parameter
69 specifies the indentation level to be used. A separate method is used
70 to print tree node lists that hold <CODE>tree_for</CODE> operands. If the
71 <CODE>is_op</CODE> method for one of these lists returns <CODE>TRUE</CODE>, the
72 <CODE>print_expr</CODE> method prints the operand directly. Otherwise, it
73 prints the list as usual.
75 </P>
77 <P><HR><P>
78 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_19.html">previous</A>, <A HREF="suif1_21.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
79 </BODY>
80 </HTML>