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 - Opcodes and Formats
</TITLE>
7 <link href=
"suif1_25.html" rel=Next
>
8 <link href=
"suif1_23.html" rel=Previous
>
9 <link href=
"suif1_toc.html" rel=ToC
>
13 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_23.html">previous
</A>,
<A HREF=
"suif1_25.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.
17 <H3><A NAME=
"SEC24" HREF=
"suif1_toc.html#TOC24">Opcodes and Formats
</A></H3>
28 The
<CODE>opcode
</CODE> and
<CODE>set_opcode
</CODE> methods may be used to access
29 the opcode field in an instruction. These opcodes are members of the
30 <CODE>if_ops
</CODE> enumerated type. The internal names for the opcodes all
31 begin with
<CODE>io_
</CODE>, but that prefix is omitted in this documentation.
32 The
<CODE>if_ops_name
</CODE> function takes an opcode and returns a character
33 string holding the opcode name (without the
<CODE>io_
</CODE> prefix). This is
34 used by the library when it prints out instructions, but you may also
42 Each opcode is associated with a particular instruction format. The
43 formats are specified by members of the
<CODE>inst_format
</CODE> enumeration.
44 The
<CODE>format
</CODE> method may be used to retrieve the format for a
45 particular instruction. Alternatively, the
<CODE>which_format
</CODE> function
46 takes an opcode and returns its format without reference to any
47 particular instruction. Each format corresponds to a particular derived
53 <DT><CODE>inf_rrr
</CODE>
55 Three operand instructions use the
<CODE>in_rrr
</CODE> class.
57 <DT><CODE>inf_bj
</CODE>
59 Branch and jump instructions use the
<CODE>in_bj
</CODE> class.
61 <DT><CODE>inf_ldc
</CODE>
63 The load constant instruction uses the
<CODE>in_ldc
</CODE> class.
65 <DT><CODE>inf_cal
</CODE>
67 The call instruction uses the
<CODE>in_cal
</CODE> class.
69 <DT><CODE>inf_array
</CODE>
71 The array instruction uses the
<CODE>in_array
</CODE> class.
73 <DT><CODE>inf_mbr
</CODE>
75 The multi-way branch instruction uses the
<CODE>in_mbr
</CODE> class.
77 <DT><CODE>inf_lab
</CODE>
79 The label instruction uses the
<CODE>in_lab
</CODE> class.
81 <DT><CODE>inf_gen
</CODE>
83 Generic instructions use the
<CODE>in_gen
</CODE> class.
87 The
<CODE>format
</CODE> method is often used in
<CODE>switch
</CODE> statements for
88 dealing with different kinds of instructions. For example, the
89 following code computes the number of source operands in an instruction
90 (instead of using the
<CODE>num_srcs
</CODE> method):
96 switch (i-
>format()) {
106 in_cal *cali = (in_cal *)i;
107 n +=
1 + cali-
>num_args();
111 in_array *arri = (in_array *)i;
112 n +=
2 +
2 * arri-
>dims();
120 in_gen *geni = (in_gen *)i;
121 n += geni-
>num_srcs();
125 /* other formats (inf_ldc and inf_lab) have no source operands */
132 The opcodes and instruction formats are defined in the
<TT>`opcodes.h'
</TT>
133 and
<TT>`opcodes.cc'
</TT> files.
138 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_23.html">previous
</A>,
<A HREF=
"suif1_25.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.