Go to the previous, next section.


Types are used in two different places in Simple-SUIF. All Simple-SUIF instructions contain a field to specify the type of the result, although this field is not used if an instruction does not produce a value for the destination operand. Each variable symbol also has a type. Simple-SUIF types are represented by simple_type structures.

Each simple_type structure contains fields which specify the base type and the size in bits. The base types are:

Used to indicate that there is no value present.
Signed integers.
Unsigned integers.
Floating-point values.
Structures, unions, and arrays.

The SIGNED_TYPE, UNSIGNED_TYPE, FLOAT_TYPE, and ADDRESS_TYPE types are all considered to be scalar types.

Together, the base type and size constitute the only type information that is available in Simple-SUIF. The rest of the type information is recorded internally in the full SUIF type structures pointed to by the suif_type fields in the simple_type structures.

You cannot directly create new types or modify existing ones. Pointers to some commonly used types are declared in the Simple-SUIF library. Only use these predefined types or the types that are already present in a procedure. The get_ptr_type function may be used to find the type that is a pointer to another type. This may be needed to generate new memory accesses with the correct types.

Because a base type and size do not uniquely define a type, you must compare the addresses of two simple_type structures to determine whether or not they represent exactly the same type. However, many Simple-SUIF instructions only require that their operands have compatible, but not necessarily equivalent, types. Except for RECORD_TYPE types, two simple_type structures are compatible if their base types and sizes are equal.

Go to the previous, next section.