The TYPE_VOID
, TYPE_INT
, TYPE_FLOAT
, and
TYPE_ENUM
operators define the base types. Whereas other kinds
of types are defined in terms of existing types, the base types stand
alone. The base_type
class is derived from type_node
to
hold the base types. It has only two fields: the size and a flag to
indicate whether integer and enumerated types are signed or unsigned.
The set_size
method sets the size of a base type in bits. Types
with a TYPE_VOID
operator should always have a size of zero.
Integer and floating-point types can have any sizes, although normally
the sizes are restricted by the target machine parameters (see section Target Machine Parameters). Other sizes may cause the code generator to fail.
For integer and enumerated types, the is_signed
method is used to
check the flag that indicates whether they are signed or unsigned. The
set_signed
method changes the value of the flag.
Besides the features that they share with the other base types, enumerated types have other fields and methods used to record the names and values of their members. See section Enumerated Types.