Eliminate another warning.
[suif.git] / html / suif1_58.html
blob8b9d3a950d0d1042953d6fdc3034069b1a9407a0
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 - Variable Definitions</TITLE>
7 <link href="suif1_59.html" rel=Next>
8 <link href="suif1_57.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_57.html">previous</A>, <A HREF="suif1_59.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="SEC58" HREF="suif1_toc.html#TOC58">Variable Definitions</A></H3>
18 <P>
19 <A NAME="IDX405"></A>
21 </P>
22 <P>
23 <A NAME="IDX406"></A>
24 <A NAME="IDX407"></A>
25 <A NAME="IDX408"></A>
26 Variable definitions are used to allocate storage for variables that are
27 not on the stack. These variable definitions are implemented by the
28 <CODE>var_def</CODE> class, which is defined in the <TT>`vardef.h'</TT> and
29 <TT>`vardef.cc'</TT> files. Each variable definition contains a field with
30 a pointer to the corresponding variable. The <CODE>variable</CODE> and
31 <CODE>set_variable</CODE> methods access this field.
33 </P>
34 <P>
35 The effects of a variable definition depend on the kind of variable.
36 Without separate variable definitions, the symbols for global variables
37 are merely declarations of external symbols. Adding a definition for a
38 global variable changes it from a declaration to an actual definition.
39 The local variables in a procedure or nested scope are allocated on the
40 stack by default. Adding a definition for a local variable makes it
41 static. Similarly, if you remove a definition of a local variable, it
42 reverts to being allocated on the stack. Because of their special
43 status, register variables cannot have definitions. Sub-variables are
44 also not allowed to have their own definitions.
46 </P>
47 <P>
48 The location of a <CODE>var_def</CODE> identifies the place where the variable
49 is defined. For most variables, the <CODE>var_def</CODE> will be in the same
50 symbol table as the variable. However, variables in the global symbol
51 table must be defined in exactly one of the source files. Thus, the
52 <CODE>var_def</CODE> for a variable in the global symbol table must be in one
53 of the file symbol tables.
55 </P>
56 <P>
57 <A NAME="IDX409"></A>
58 <A NAME="IDX410"></A>
59 Besides identifying the location of the definition, a <CODE>var_def</CODE>
60 also specifies the alignment restriction for the variable's storage.
61 The <CODE>alignment</CODE> method retrieves the size of the alignment unit in
62 bits, and the <CODE>set_alignment</CODE> method sets the alignment unit size.
63 The alignment unit should be at least as big as the smallest addressable
64 unit for the target architecture.
66 </P>
67 <P>
68 The initial data for a static variable can be specified by attaching
69 annotations to the variable definition. These annotations are optional.
70 If omitted, the initial data is assumed to be all zeros. The initial
71 data annotations are described elsewhere in this manual. See section <A HREF="suif1_75.html#SEC75">Initial Data Annotations</A>.
73 </P>
74 <P>
75 <A NAME="IDX411"></A>
76 Variable definitions are printed out as part of each symbol table. The
77 <CODE>print</CODE> method is used for this. You may also use this method for
78 debugging. The optional <CODE>depth</CODE> parameter specifies the
79 indentation level for the output.
81 </P>
83 <P><HR><P>
84 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_57.html">previous</A>, <A HREF="suif1_59.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
85 </BODY>
86 </HTML>