+ int o_pos, self_pos, e_pos;
+
+ int i;
+
+ init_firm (NULL);
+
+ set_opt_constant_folding(1);
+ set_opt_cse(1);
+ set_opt_dead_node_elimination(1);
+
+ /*** Make basic type information for primitive type int. ***/
+ prim_t_int = new_type_primitive(new_id_from_chars ("int", 3), mode_Is);
+
+ /*** Make type information for the class (PRIMA). ***/
+ /* The type of the class */
+ class_prima = new_type_class(new_id_from_chars ("PRIMA", 5));
+ /* We need type information for pointers to the class: */
+ class_p_ptr = new_type_pointer (new_id_from_chars("class_prima_ptr", 15),
+ class_prima);
+ /* An entity for the field (a). The entity constructor automatically adds
+ the entity as member of the owner. */
+ a_e = new_entity(class_prima, new_id_from_chars ("a", 1), prim_t_int);
+ /* An entity for the method set_a. But first we need type information
+ for the method. */
+ proc_set_a = new_type_method(new_id_from_chars("set_a", 5), 2, 0);
+ set_method_param_type(proc_set_a, 0, class_p_ptr);
+ set_method_param_type(proc_set_a, 1, prim_t_int);
+ proc_set_a_e = new_entity(class_prima, new_id_from_chars ("set_a", 5), proc_set_a);
+ /* An entity for the method c. Implicit argument "self" must be modeled
+ explicit! */
+ proc_c = new_type_method(new_id_from_chars("c", 1 ), 2, 1);
+ set_method_param_type(proc_c, 0, class_p_ptr);
+ set_method_param_type(proc_c, 1, prim_t_int);
+ set_method_res_type(proc_c, 0, prim_t_int);
+ proc_c_e = new_entity(class_prima, new_id_from_chars ("c", 1), proc_c);
+
+ /*** Now build procedure main. ***/
+ /** Type information for main. **/
+ printf("\nCreating an IR graph: OO_PROGRAM_EXAMPLE...\n");
+ /* Main is not modeled as part of an explicit class here. Therefore the
+ owner is the global type. */