Go to the previous, next section.

Target Machine Parameters

The SUIF library includes a structure to record various parameters of the target machine. The back-end of the compiler may be either a code generator for a specific processor or the system's C compiler, using the SUIF-to-C translator. Thus, the target machine parameters include fields that deal both with hardware requirements and with details of the back-end C compiler. These parameters are stored in the target machine_params structure. The front-end is responsible for setting the target parameters, but they are then saved in the SUIF files and passed along to all subsequent passes of the compiler.

The first fields in the machine_params structure deal with the addressing in the underlying hardware. The is_big_endian field specifies the byte order, and the addressable_size field specifies the size in bits of the smallest addressable unit. Since most machines are byte-addressable, the addressable_size is usually set to eight.

Next, the sizes and alignments for various C types are specified. The possible C types are listed in the C_types enumeration:

C_char
C_short
C_int
C_long
C_longlong
C_float
C_double
C_longdouble
C_ptr

The size and align fields of the machine_params structure are arrays containing the size and alignment for each C type. Both are specified in bits (not bytes). Some C compilers require additional alignment restrictions for arrays and structures. The array_align and struct_align fields contain these alignment requirements in bits. Note that these do not replace the alignment restrictions for the components of an array or structure; the most restrictive alignments must always be maintained.

The remaining fields are only applicable to the back-end C compiler. The char_is_signed field specifies if the default char type is signed. This is just to allow the SUIF-to-C translator to avoid cluttering up the C code by explicitly putting signed or unsigned in every declaration of a char type. When two pointers are subtracted in C, the result type is implementation defined. The ptr_diff_type field in machine_params specifies the type produced by such pointer subtractions for use in SUIF-to-C.

Go to the previous, next section.