A DataType is an abstract class, whose subclasses are the different data types.
abstract DataType : Type
{
IInteger bit_size;
int bit_alignment;
};
| bit_size | Size of the data type in terms of bits. If the size is unknown the bit_size is set to undetermined. If the size is a non-constant expression as with some Fortran arrays, the bit_size is set to undetermined. |
| bit_alignment | Minimum alignment required for the address of a unit of storage of this type. |
concrete VoidType : DataType {};
abstract NumericType : DataType {};
concrete IntegerType : NumericType
{
bool is_signed;
};
| is_signed | indicates whether this is a signed integer |
concrete BooleanType : NumericType {};
concrete FloatingPointType : NumericType {};
concrete EnumeratedType : IntegerType
{
indexed_list<LString,IInteger> case;
};
| case | contains a tuple of a constant integer and its corresponding string. |
concrete PointerType : DataType
{
Type * reference reference_type;
};
| reference_type | shows the type that the pointer points to. The PointerType will not refer to a DataType directly. To refer to an unqualified DataType, the PointerType should have a reference to a QualifiedType that has no qualifications and refers to the underlying DataType. |
concrete ReferenceType : DataType
{
Type * reference reference_type;
};
| reference_type | shows the type that the pointer points to. A reference type like a pointer type except that reference arithmetic is not valid. |
concrete ArrayType : DataType
{
QualifiedType * reference element_type;
Expression * owner lower_bound;
Expression * owner upper_bound;
};
| element_type | the type of the elements which make up the array |
| lower_bound | the lower bound of the array. |
| upper_bound | the upper bound of the array. The number of elements is the upper_bound minus the lower_bound plus one. The lower_bound and/or the upper_bound may also be null, which means that the bounds of the array are unknown. Under many circumstances, the bounds are required to be fixed constants. For example, a static global variable with type that is an array type must have fixed constant upper and lower bounds. Under other circumstances one or both of the bounds may be unknown. |
concrete MultiDimArrayType : DataType
{
QualifiedType * reference element_type;
Vector<Expression * owner> lower_bounds;
Vector<Expression * owner> upper_bounds;
};
| element_type | the type of the elements which make up the array |
| lower_bounds | a vector containing the lower bounds of the array. |
| upper_bounds | a vector containing the upper bounds of the array. The number of elements in a particular dimension is the upper_bound minus the lower_bound plus one. The lower_bound and/or the upper_bound may also be null, which means that the bounds of the array are unknown. Under many circumstances, the bounds are required to be fixed constants. For example, a static global variable with type that is an array type must have fixed constant upper and lower bounds. Under other circumstances one or both of the bounds may be unknown. |
struct'' or
``union'' in C.
Like a ``struct'' or ``union'', a group consists of a number of
fields, each with a name and type. In a GroupType, though, the
fields are allowed to have arbitrary, potentially overlapping offsets
within the group. If
all the offsets are zero, it is the same as a union in C. If the
offsets are set so that the fields come one after the other and
don't overlap, it is the same as a struct in C.
concrete GroupType : DataType
{
bool is_complete build (false);
GroupSymbolTable * owner group_symbol_table
build (::create_group_symbol_table(get_suif_environment()));
};
| group_symbol_table | contains an entry for each field. |
| is_complete | is a boolean that tells whether or not all the fields are known. Sometimes only partial information is available about a group. An example of this is a forward declaration of a struct in C. If there is a forward declaration but no full declaration of the struct, in SUIF the struct will be represented as a GroupType for which is_complete is false. |
concrete StructType : GroupType {};
concrete UnionType : GroupType {};