+ symconst_symbol sym;
+ ir_entity **free_methods;
+ int arr_len;
+
+ int o_pos, self_pos, e_pos;
+
+ int i;
+
+ init_firm(NULL);
+
+ set_opt_constant_folding(1);
+ set_opt_cse(1);
+
+ /*** Make basic ir_type information for primitive ir_type int. ***/
+ prim_t_int = new_type_primitive(new_id_from_chars("int", 3), mode_Is);
+
+ /*** Make ir_type information for the class (PRIMA). ***/
+ /* The ir_type of the class */
+ class_prima = new_type_class(new_id_from_chars("PRIMA", 5));
+ /* We need ir_type information for pointers to the class: */
+ class_p_ptr = new_type_pointer(new_id_from_chars("class_prima_ptr", 15),
+ class_prima, mode_P);
+ /* An ir_entity for the field (a). The ir_entity constructor automatically adds
+ the ir_entity as member of the owner. */
+ a_e = new_entity(class_prima, new_id_from_chars("a", 1), prim_t_int);
+ /* An ir_entity for the method set_a. But first we need ir_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 ir_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 ir_type. */