+ /*-- a class type so that it can contain "inner" methods as in Pascal. --*/
+ res->frame_type = new_type_class(mangle(get_entity_ident(ent), frame_type_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->end_reg = res->end;
+ res->end_except = res->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->no_mem = new_ir_node(NULL, res, res->start_block, op_NoMem, mode_M, 0, NULL);
+
+ /* Proj results of start node */
+ projX = new_Proj (res->start, mode_X, pn_Start_X_initial_exec);
+ res->frame = new_Proj (res->start, mode_P_mach, pn_Start_P_frame_base);
+ res->globals = new_Proj (res->start, mode_P_mach, pn_Start_P_globals);
+ res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
+ res->args = new_Proj (res->start, mode_T, pn_Start_T_args);
+#ifdef DEBUG_libfirm
+ res->graph_nr = get_irp_new_node_nr();
+#endif
+ res->proj_args = NULL;
+
+ set_store(res->initial_mem);
+
+ add_immBlock_pred(res->start_block, projX);
+ /*
+ * The code generation needs it. leave it in now.
+ * Use of this edge is matter of discussion, unresolved. Also possible:
+ * add_immBlock_pred(res->start_block, res->start_block), but invalid typed.
+ */
+ mature_immBlock (res->current_block);
+
+ /*-- Make a block to start with --*/
+ first_block = new_immBlock();
+ add_immBlock_pred (first_block, projX);
+
+ res->method_execution_frequency = -1;
+
+ return res;
+}
+
+
+ir_graph *
+new_ir_graph (entity *ent, int n_loc)
+{
+ ir_graph *res = new_r_ir_graph (ent, n_loc);
+ add_irp_irg(res); /* remember this graph global. */
+ return res;
+}
+
+/* Make a rudimentary ir graph for the constant code.
+ Must look like a correct irg, spare everything else. */
+ir_graph *new_const_code_irg(void) {
+ ir_graph *res;
+ ir_node *projX;
+
+ res = alloc_graph();
+
+ /* inform statistics here, as blocks will be already build on this graph */
+ hook_new_graph(res, NULL);
+
+ current_ir_graph = res;
+ res->n_loc = 1; /* Only the memory. */
+ 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 = NULL;
+#endif
+ res->kind = k_ir_graph;
+ res->obst = xmalloc (sizeof(*res->obst));
+ obstack_init (res->obst);
+ res->extbb_obst = NULL;
+
+ res->phase_state = phase_building;
+ res->op_pin_state_pinned = op_pin_state_pinned;
+ res->extblk_state = ir_extblk_info_none;