Partial support for integer divisions in access vectors
[suif.git] / html / suif1_64.html
blob47b6dcf09e82934fb8c122c571cb960935c9f617
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 - Function Types</TITLE>
7 <link href="suif1_65.html" rel=Next>
8 <link href="suif1_63.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_63.html">previous</A>, <A HREF="suif1_65.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="SEC64" HREF="suif1_toc.html#TOC64">Function Types</A></H2>
18 <P>
19 <A NAME="IDX456"></A>
20 <A NAME="IDX457"></A>
22 </P>
23 <P>
24 <A NAME="IDX458"></A>
25 <A NAME="IDX459"></A>
26 <A NAME="IDX460"></A>
27 The <CODE>TYPE_FUNC</CODE> operator is used with the <CODE>func_type</CODE> derived
28 type class to describe the types of SUIF procedures. A function type
29 includes the type of the return value and optionally the types of the
30 arguments as well. The <CODE>return_type</CODE> and <CODE>set_return_type</CODE>
31 methods access the return type field. The type system itself places no
32 restrictions on the return types, but the SUIF call and return
33 instructions do. See section <A HREF="suif1_35.html#SEC35">Call Instructions</A>
35 </P>
36 <P>
37 <A NAME="IDX461"></A>
38 <A NAME="IDX462"></A>
39 <A NAME="IDX463"></A>
40 <A NAME="IDX464"></A>
41 Most of the complexity of function types involves the arguments.
42 Pointers to the argument types are stored in a dynamically-allocated
43 array. The number of arguments, and thus the size of the array, is
44 stored in a field that can be accessed with the <CODE>num_args</CODE> and
45 <CODE>set_num_args</CODE> methods. The number of arguments can be changed at
46 any time; if necessary the argument array will be reallocated. The type
47 of a particular argument can be retrieved with the <CODE>arg_type</CODE>
48 method and set with the <CODE>set_arg_type</CODE> method. The arguments are
49 numbered beginning with zero.
51 </P>
52 <P>
53 Argument types are under the same restrictions as result types of
54 instructions (see section <A HREF="suif1_26.html#SEC26">Result Types</A>) -- they must be object types with
55 known, non-zero size.
57 </P>
58 <P>
59 <A NAME="IDX465"></A>
60 <A NAME="IDX466"></A>
61 <A NAME="IDX467"></A>
62 Since functions can be declared in C without complete prototypes, a
63 function type may not be able to include any information about the
64 arguments. This is indicated in a SUIF function type by the result of
65 the <CODE>args_known</CODE> method. This flag can be set with the
66 <CODE>set_args_known</CODE> and <CODE>set_args_unknown</CODE> methods. Setting
67 <CODE>args_known</CODE> FALSE sets the argument count to zero and the
68 <CODE>has_varargs</CODE> flag to FALSE. Conversely, setting the argument
69 count to a non-zero value or the <CODE>has_varargs</CODE> flag to TRUE sets
70 the <CODE>args_known</CODE> flag to TRUE.
72 </P>
73 <P>
74 <A NAME="IDX468"></A>
75 <A NAME="IDX469"></A>
76 Some functions in C and other languages have a variable number of
77 arguments. The SUIF function types support this by keeping a flag to
78 indicate if there may be additional arguments besides the ones that are
79 explicitly listed. The <CODE>has_varargs</CODE> and <CODE>set_varargs</CODE>
80 methods access this flag. Note that the <CODE>has_varargs</CODE> flag should
81 not be used if nothing else is known about the arguments.
83 </P>
85 <P><HR><P>
86 <p>Go to the <A HREF="suif1_1.html">first</A>, <A HREF="suif1_63.html">previous</A>, <A HREF="suif1_65.html">next</A>, <A HREF="suif1_113.html">last</A> section, <A HREF="suif1_toc.html">table of contents</A>.
87 </BODY>
88 </HTML>