+ if (flags & profile_with_locations) {
+ /* build the initializer for the locations */
+ rem = current_ir_graph;
+ current_ir_graph = get_const_code_irg();
+ ent = get_array_element_entity(loc_type);
+ set_entity_variability(ent_locations, variability_constant);
+ for (i = 0; i < n_blocks; ++i) {
+ compound_graph_path *path;
+ 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_Const(mode_Iu, 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_SymConst(sym, symconst_addr_ent);
+ } else {
+ n = new_Const(mode_P_data, get_mode_null(mode_P_data));
+ }
+ add_compound_ent_value_w_path(ent_locations, n, path);
+ }
+ pmap_destroy(wd.fname_map);
+ }
+ return gen_initializer_irg(ent_filename, bblock_id, bblock_counts, n_blocks);
+}
+
+static void
+profile_node_info(void *ctx, FILE *f, const ir_node *irn)
+{
+ (void) ctx;
+ if(is_Block(irn)) {
+ fprintf(f, "profiled execution count: %u\n", be_profile_get_block_execcount(irn));
+ }
+}
+
+static void
+register_vcg_hook(void)
+{
+ memset(&hook, 0, sizeof(hook));
+ hook.hook._hook_node_info = profile_node_info;
+ register_hook(hook_node_info, &hook);