- ir_graph *irg = get_irp_irg(i);
- ir_node *endbb = get_irg_end_block(irg);
- int i;
- fix_env env;
-
- /* generate a symbolic constant pointing to the count array */
- sym.entity_p = bblock_counts;
- wd.symconst = new_r_SymConst(irg, mode_P_data, sym, symconst_addr_ent);
-
- irg_block_walk_graph(irg, block_id_walker, NULL, &wd);
- env.end_block = get_irg_end_block(irg);
- irg_block_walk_graph(irg, fix_ssa, NULL, &env);
- for (i = get_Block_n_cfgpreds(endbb) - 1; i >= 0; --i) {
- ir_node *node = skip_Proj(get_Block_cfgpred(endbb, i));
- ir_node *bb = get_Block_cfgpred_block(endbb, i);
- ir_node *sync;
- ir_node *ins[2];
-
- switch (get_irn_opcode(node)) {
- case iro_Return:
- ins[0] = (ir_node*)get_irn_link(bb);
- ins[1] = get_Return_mem(node);
- sync = new_r_Sync(bb, 2, ins);
- set_Return_mem(node, sync);
- break;
- case iro_Raise:
- ins[0] = (ir_node*)get_irn_link(bb);
- ins[1] = get_Raise_mem(node);
- sync = new_r_Sync(bb, 2, ins);
- set_Raise_mem(node, sync);
- break;
- default:
- /* a fragile's op exception. There should be another path to End,
- so ignore it */
- assert(is_fragile_op(node) && "unexpected End control flow predecessor");
- }
- }
- }
- set_array_entity_values(bblock_id, tarval_array, n_blocks);
-
- if (flags & profile_with_locations) {
- ir_graph *irg = get_const_code_irg();
- /* build the initializer for the locations */
- ent = get_array_element_entity(loc_type);
- set_entity_linkage(ent_locations, IR_LINKAGE_CONSTANT);
- for (i = 0; i < n_blocks; ++i) {
- compound_graph_path *path;
- ir_tarval *tv;
- ir_node *n;
-
- /* lineno */
- path = new_compound_graph_path(loc_type, 2);
- set_compound_graph_path_array_index(path, 0, i);
- set_compound_graph_path_node(path, 0, ent);
- set_compound_graph_path_node(path, 1, loc_lineno);
- tv = new_tarval_from_long(wd.locs[i].lineno, mode_Iu);
- add_compound_ent_value_w_path(ent_locations, new_r_Const(irg, tv), path);
-
- /* name */
- path = new_compound_graph_path(loc_type, 2);
- set_compound_graph_path_array_index(path, 0, i);
- set_compound_graph_path_node(path, 0, ent);
- set_compound_graph_path_node(path, 1, loc_name);
- if (wd.locs[i].fname) {
- sym.entity_p = wd.locs[i].fname;
- n = new_r_SymConst(irg, mode_P_data, sym, symconst_addr_ent);
- } else {
- n = new_r_Const(irg, get_mode_null(mode_P_data));
- }
- add_compound_ent_value_w_path(ent_locations, n, path);
- }
- pmap_destroy(wd.fname_map);