-ir_graph *
-new_r_ir_graph (ir_entity *ent, int n_loc)
-{
- ir_graph *res;
- ir_node *first_block;
- ir_node *end, *start, *start_block, *initial_mem, *projX;
-
- res = alloc_graph();
- res->kind = k_ir_graph;
-
- //edges_init_graph_kind(res, EDGE_KIND_NORMAL);
- //edges_init_graph_kind(res, EDGE_KIND_BLOCK);
-
- /* initialize the idx->node map. */
- res->idx_irn_map = NEW_ARR_F(ir_node *, INITIAL_IDX_IRN_MAP_SIZE);
- memset(res->idx_irn_map, 0, INITIAL_IDX_IRN_MAP_SIZE * sizeof(res->idx_irn_map[0]));
-
- /* inform statistics here, as blocks will be already build on this graph */
- hook_new_graph(res, ent);
-
- current_ir_graph = res;
-
- /*-- initialized for each graph. --*/
- if (get_opt_precise_exc_context()) {
- res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
- dereferenced in this graph plus one for
- the store plus one for links to fragile
- operations. n_loc is not the number of
- parameters to the procedure! */
- }
- else {
- 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! */
- }
-
- /* 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 */
-
-#if USE_EXPLICIT_PHI_IN_STACK
- res->Phi_in_stack = new_Phi_in_stack(); /* A stack needed for automatic Phi
- generation */
-#endif
- res->kind = k_ir_graph;
- res->obst = xmalloc (sizeof(*res->obst));
- obstack_init(res->obst);
- res->extbb_obst = NULL;
-
- res->last_node_idx = 0;
-
- res->value_table = new_identities (); /* value table for global value
- numbering for optimizing use in
- iropt.c */
- res->outs = NULL;
-
- res->inline_property = irg_inline_any;
- res->additional_properties = mtp_property_inherited; /* inherited from type */
-
- res->phase_state = phase_building;
- res->irg_pinned_state = op_pin_state_pinned;
- res->outs_state = outs_none;
- res->dom_state = dom_none;
- res->pdom_state = dom_none;
- 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->loopinfo_state = loopinfo_none;
- res->class_cast_state = ir_class_casts_transitive;
- res->extblk_state = ir_extblk_info_none;
- res->execfreq_state = exec_freq_none;
- res->fp_model = fp_model_precise;
- res->adr_taken_state = ir_address_taken_not_computed;
- 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(mangle(get_entity_ident(ent), frame_type_suffix));
-
- /*-- Nodes needed in every graph --*/
- set_irg_end_block (res, new_immBlock());
- end = new_End();
- set_irg_end (res, end);
- set_irg_end_reg (res, end);
- set_irg_end_except(res, end);
-
- start_block = new_immBlock();
- set_irg_start_block(res, start_block);
- set_irg_bad (res, new_ir_node(NULL, res, start_block, op_Bad, mode_T, 0, NULL));
- set_irg_no_mem (res, new_ir_node(NULL, res, start_block, op_NoMem, mode_M, 0, NULL));
- start = new_Start();
- set_irg_start (res, start);
-
- /* Proj results of start node */
- projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
- set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
- set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
- set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
- set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
- set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
- initial_mem = new_Proj(start, mode_M, pn_Start_M);
- set_irg_initial_mem(res, initial_mem);
-
- add_immBlock_pred(start_block, projX);
- set_store(initial_mem);