-/**
- contain "inner" methods as in Pascal. **/
- res->frame_type = new_type_class(mangle(get_entity_ident(ent),
- id_from_str(FRAME_TP_SUFFIX, strlen(FRAME_TP_SUFFIX))));
- /* Remove type from type list. Must be treated differently than other types. */
- remove_irp_type_from_list(res->frame_type);
-
- /** Nodes needed in every graph **/
- res->end_block = new_immBlock ();
- res->end = new_End ();
-
- res->start_block = new_immBlock ();
- res->start = new_Start ();
- res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
- res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
-
- /* Proj results of start node */
- projX = new_Proj (res->start, mode_X, pns_initial_exec);
- set_store (new_Proj (res->start, mode_M, pns_global_store));
- res->frame = new_Proj (res->start, mode_P, pns_frame_base);
- res->globals = new_Proj (res->start, mode_P, pns_globals);
- res->args = new_Proj (res->start, mode_T, pns_args);
+ res->n_loc = n_loc + 1; /* number of local variables that are never
+ dereferenced in this graph plus one for
+ the store. This is not the number of
+ parameters to the procedure! */
+
+ if (res->loc_descriptions) {
+ xfree(res->loc_descriptions);
+ res->loc_descriptions = NULL;
+ }
+}
+
+ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
+{
+ ir_graph *res;
+ ir_node *first_block;
+ ir_node *start, *start_block, *initial_mem, *projX;
+
+ res = alloc_graph();
+
+ /* inform statistics here, as blocks will be already build on this graph */
+ hook_new_graph(res, ent);
+
+ /*-- initialized for each graph. --*/
+ res->kind = k_ir_graph;
+ res->obst = XMALLOC(struct obstack);
+ obstack_init(res->obst);
+
+ res->phase_state = phase_building;
+ irg_set_nloc(res, n_loc);
+
+ /* descriptions will be allocated on demand */
+ res->loc_descriptions = NULL;
+
+ res->visited = 0; /* visited flag, for the ir walker */
+ res->block_visited = 0; /* visited flag, for the 'block'-walker */
+
+ res->last_node_idx = 0;
+
+ new_identities(res);
+ res->outs = NULL;
+
+ res->inline_property = irg_inline_any;
+ res->additional_properties = mtp_property_inherited; /* inherited from type */
+
+ res->irg_pinned_state = op_pin_state_pinned;
+ res->typeinfo_state = ir_typeinfo_none;
+ set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
+ res->callee_info_state = irg_callee_info_none;
+ res->class_cast_state = ir_class_casts_transitive;
+ res->fp_model = fp_model_precise;
+ res->mem_disambig_opt = aa_opt_inherited;
+
+ /*-- Type information for the procedure of the graph --*/
+ res->ent = ent;
+ set_entity_irg(ent, res);
+
+ /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
+ res->frame_type = new_type_frame();
+
+ /* the Anchor node must be created first */
+ res->anchor = new_r_Anchor(res);
+
+ /*-- Nodes needed in every graph --*/
+ set_irg_end_block(res, new_r_immBlock(res));
+ set_irg_end(res, new_r_End(res, 0, NULL));
+
+ start_block = new_r_Block_noopt(res, 0, NULL);
+ set_irg_start_block(res, start_block);
+ set_irg_no_mem (res, new_r_NoMem(res));
+ start = new_r_Start(res);
+ set_irg_start (res, start);
+
+ /* Proj results of start node */
+ projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
+ set_irg_initial_exec (res, projX);
+ set_irg_frame (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base));
+ set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args));
+ initial_mem = new_r_Proj(start, mode_M, pn_Start_M);
+ set_irg_initial_mem(res, initial_mem);
+
+ res->index = get_irp_new_irg_idx();