Go to the previous, next section.

Defining New Variables

The builder provides a new_sym() function to create new SUIF variables. In order to create a variable, the type of the variable is specified by using either the SUIF type_node structure or the builder const_type enum. The const_type enum can be used only to define a few basic types (cst_int, cst_double, cst_float, cst_char, cst_str). The name of the new variable can be optionally specified. If no name is specified, a unique name is allocated by the builder. The function get_sym() can be used to directly obtain the SUIF structure (sym_node) of a builder-created variable. See section Defining Variables and Generating New Type Definitions for detailed information on defining new variables.
        block v1(block::new_sym(cst_int, "v1"));
        var_sym * symv1 = (var_sym *)v1.get_sym();
        block v2(block::new_sym(v1->type(), "v2"));







Note: In the current implementation all the variables that are created are local variables of the current procedure. There is no way to create global variables or variables within inner scopes in this release.

Lables

A label symbol can be created using the new_label() command.

Go to the previous, next section.