+ array_type = new_type_array(IDENT("__block_info_array"), 1, uint_type);
+ set_array_bounds_int(array_type, 0, 0, n_blocks);
+ set_type_size_bytes(array_type, n_blocks * get_mode_size_bytes(mode_Iu));
+ set_type_alignment_bytes(array_type, get_mode_size_bytes(mode_Iu));
+ set_type_state(array_type, layout_fixed);
+
+ character_type = new_type_primitive(IDENT("__char"), mode_Bs);
+ string_type = new_type_array(IDENT("__filename"), 1, character_type);
+ set_array_bounds_int(string_type, 0, 0, filename_len);
+ set_type_size_bytes(string_type, filename_len);
+ set_type_alignment_bytes(string_type, 1);
+ set_type_state(string_type, layout_fixed);
+
+ gtp = get_glob_type();
+
+ cur_ident = IDENT("__FIRMPROF__BLOCK_IDS");
+ bblock_id = new_entity(gtp, cur_ident, array_type);
+ set_entity_ld_ident(bblock_id, cur_ident);
+ set_entity_variability(bblock_id, variability_initialized);
+
+ cur_ident = IDENT("__FIRMPROF__BLOCK_COUNTS");
+ bblock_counts = new_entity(gtp, cur_ident, array_type);
+ set_entity_ld_ident(bblock_counts, cur_ident);
+ set_entity_variability(bblock_counts, variability_initialized);
+
+ cur_ident = IDENT("__FIRMPROF__FILE_NAME");
+ ent_filename = new_entity(gtp, cur_ident, string_type);
+ set_entity_ld_ident(ent_filename, cur_ident);
+
+ if (flags & profile_with_locations) {
+ loc_type = new_type_struct(IDENT("__location"));
+ loc_lineno = new_entity(loc_type, IDENT("lineno"), uint_type);
+ align_l = get_type_alignment_bytes(uint_type);
+ size = get_type_size_bytes(uint_type);
+ set_entity_offset(loc_lineno, 0);
+
+ charptr_type = new_type_pointer(IDENT("__charptr"), character_type, mode_P_data);
+ align_n = get_type_size_bytes(charptr_type);
+ set_type_alignment_bytes(charptr_type, align_n);
+ loc_name = new_entity(loc_type, IDENT("name"), charptr_type);
+ size = (size + align_n - 1) & -align_n;
+ set_entity_offset(loc_name, size);
+ size += align_n;
+
+ if (align_n > align_l)
+ align_l = align_n;
+ size = (size + align_l - 1) & -align_l;
+ set_type_size_bytes(loc_type, size);
+ set_type_state(loc_type, layout_fixed);
+
+ loc_type = new_type_array(IDENT("__locarray"), 1, loc_type);
+ set_array_bounds_int(string_type, 0, 0, n_blocks);
+
+ cur_ident = IDENT("__FIRMPROF__LOCATIONS");
+ ent_locations = new_entity(gtp, cur_ident, loc_type);
+ set_entity_ld_ident(ent_locations, cur_ident);