snoot: immed_and_type_for_C_intconst: properly parse "0"
[suif.git] / html / suif1_78.html
blob1cf10a4be6646c949c09006a2fab4f1d62477dd6
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 - Miscellaneous Annotes</TITLE>
7 <link href="suif1_79.html" rel=Next>
8 <link href="suif1_77.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_77.html">previous</A>, <A HREF="suif1_79.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="SEC78" HREF="suif1_toc.html#TOC78">Miscellaneous Annotations</A></H3>
18 <P>
19 <A NAME="IDX573"></A>
20 <A NAME="IDX574"></A>
21 <A NAME="IDX575"></A>
22 <A NAME="IDX576"></A>
24 </P>
25 <P>
26 The SUIF library defines a few other annotations to record various
27 attributes of SUIF programs. These are straightforward except for the
28 <CODE>fields</CODE> annotation which is described here in more detail.
30 </P>
31 <DL COMPACT>
33 <DT><CODE>k_line</CODE>
34 <DD>
35 <A NAME="IDX577"></A>
36 This annotation records line numbers from the source code to be used
37 when debugging the object code. It is usually attached to a <CODE>mrk</CODE>
38 instruction. The first list entry is the integer line number and the
39 second is the character string for the file name.
41 <DT><CODE>k_history</CODE>
42 <DD>
43 <A NAME="IDX578"></A>
44 As each SUIF pass runs, the library automatically records the
45 command-line for the pass as an annotation on the file set entries.
46 These <CODE>history</CODE> annotations allow you to see how a particular SUIF
47 file was generated.
49 <DT><CODE>k_enable_exceptions</CODE>
50 <DD>
51 <A NAME="IDX579"></A>
52 This annotation is attached to a <CODE>proc_symtab</CODE> to indicate which
53 run-time exceptions should be detected within that procedure. The
54 entries on the <CODE>immed</CODE> list are character strings. The system
55 currently recognizes <CODE>"int_divide-by-0"</CODE> and <CODE>"int_overflow"</CODE>.
56 IEEE floating point exceptions need to be added.
58 <DT><CODE>k_reg_num</CODE>
59 <DD>
60 <A NAME="IDX580"></A>
61 This annotation is attached to variables that represent machine
62 registers to record the register numbers. It has one immediate value
63 which is the integer register number. The meaning of the register
64 numbers are machine-dependent.
66 <DT><CODE>k_fields</CODE>
67 <DD>
68 <A NAME="IDX581"></A>
69 A field within a structure or union variable is specified in SUIF by a
70 constant offset and a base address. That is all that is needed to
71 generate code. However, if the offset is zero or if the variable is a
72 union, that information is not sufficient to determine the field. The
73 <CODE>fields</CODE> annotation may be used to provide the field names that
74 were used in the original source code. The <CODE>immed</CODE> list for one of
75 these annotations contains the names of the fields being accessed.
76 (There may be multiple field names because of nested structures or
77 unions.)
78 </DL>
80 <P>
81 The <CODE>fields</CODE> annotation is somewhat more complicated than the
82 others. The difficulty is in defining where this annotation should be
83 used. Intuitively, the <CODE>fields</CODE> annotation should be placed on
84 the first instruction that produces a pointer to the field. There are
85 basically three different situations to consider.
87 </P>
88 <P>
89 In the simplest case, a field can be addressed directly with an
90 <CODE>ldc</CODE> instruction (see section <A HREF="suif1_34.html#SEC34">Load Constant Instructions</A>). Since that
91 produces a pointer to the field, a <CODE>fields</CODE> annotation may be
92 placed on the <CODE>ldc</CODE> instruction. Of course, the entries on the
93 annotation must be valid field names for the variable that is addressed.
95 </P>
96 <P>
97 To access a field of a structure or union variable that is referenced by
98 a pointer, the constant offset must be included with an explicit
99 <CODE>add</CODE> instruction. Since the result of
100 the addition is a pointer to the field, the <CODE>fields</CODE> annotation
101 should be placed on the <CODE>add</CODE> instruction. Note that if the field
102 offset is zero, the <CODE>add</CODE> instruction may be replaced by a
103 <CODE>cvt</CODE> instruction. The same rule applies: the <CODE>cvt</CODE>
104 instruction gets the <CODE>fields</CODE> annotation because it produces a
105 pointer to the field.
107 </P>
109 For arrays of structures or unions, an <CODE>array</CODE> instruction
110 (see section <A HREF="suif1_36.html#SEC36">Array Instructions</A>) may include a constant offset for a field
111 within the array element being addressed, so this is another type of
112 instruction that may include a <CODE>fields</CODE> annotation. The entries on
113 the <CODE>fields</CODE> annotation must be valid fields within the array
114 element type.
116 </P>
118 <P><HR><P>
119 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_77.html">previous</A>, <A HREF="suif1_79.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
120 </BODY>
121 </HTML>