Go to the first, previous, next, last section, table of contents.


Initial Data Annotations

Variables that are not in the automatic storage class can be initialized by attaching annotations to their definitions (see section Variable Definitions). These annotations are very low-level. Each one specifies the initial value for a certain number of bits. Multiple annotations may be used, in which case their order is significant.

k_fill
This annotation indicates that the variable should be initialized with N bits filled with bit pattern V, where N is the first entry on the list and V is the second. The size must be a multiple of the byte size and the bit pattern must be one byte long. Currently, zero is the only bit pattern that is supported.
k_repeat_init
This is a generalized version of the fill annotation. The variable is initialized to R copies of N bits holding the value V, where R, N, and V are the first, second, and third entries on the immed list. The values that are currently supported are integers, floating point values, and symbolic addresses.
k_multi_init
This is another initial value annotation that is used to initialize character strings. The first entry on the list is the size in bits of each character. The rest of the entries on the immed list are integers that specify the characters in the string.

Despite the low-level nature of the initial data annotations, SUIF still requires that they correspond to the types of the variables. For example, character strings should only be used to initialize character arrays. Each value specified in one of these annotations must fit exactly into the corresponding variable, field, or array element. The only exception to this is that multiple fields or array elements may be initialized to zero with a single fill annotation.

For example, this structure

struct {
    int x[2];
    float fp;
    char string[7];
} sample;

might be initialized with the following annotations:

["fill": 64 0]
["repeat_init": 1 32 1.2000e+00]
["multi_init": 8 102 97 116 112 105 103 0]


Go to the first, previous, next, last section, table of contents.