void insn_locators_initialize (void) { tree block = NULL; tree last_block = NULL; rtx insn, next; int loc = 0; int line_number = 0, last_line_number = 0; char *file_name = NULL, *last_file_name = NULL; prologue_locator = epilogue_locator = 0; VARRAY_INT_INIT (block_locators_locs, 32, "block_locators_locs"); VARRAY_TREE_INIT (block_locators_blocks, 32, "block_locators_blocks"); VARRAY_INT_INIT (line_locators_locs, 32, "line_locators_locs"); VARRAY_INT_INIT (line_locators_lines, 32, "line_locators_lines"); VARRAY_INT_INIT (file_locators_locs, 32, "file_locators_locs"); VARRAY_CHAR_PTR_INIT (file_locators_files, 32, "file_locators_files"); for (insn = get_insns (); insn; insn = next) { next = NEXT_INSN (insn); if ((active_insn_p (insn) && GET_CODE (PATTERN (insn)) != ADDR_VEC && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC) || !NEXT_INSN (insn) || (!prologue_locator && file_name)) { if (last_block != block) { loc++; VARRAY_PUSH_INT (block_locators_locs, loc); VARRAY_PUSH_TREE (block_locators_blocks, block); last_block = block; } if (last_line_number != line_number) { loc++; VARRAY_PUSH_INT (line_locators_locs, loc); VARRAY_PUSH_INT (line_locators_lines, line_number); last_line_number = line_number; } if (last_file_name != file_name) { loc++; VARRAY_PUSH_INT (file_locators_locs, loc); VARRAY_PUSH_CHAR_PTR (file_locators_files, file_name); last_file_name = file_name; } } if (!prologue_locator && file_name) prologue_locator = loc; if (!NEXT_INSN (insn)) epilogue_locator = loc; if (active_insn_p (insn)) INSN_LOCATOR (insn) = loc; else if (GET_CODE (insn) == NOTE) { switch (NOTE_LINE_NUMBER (insn)) { case NOTE_INSN_BLOCK_BEG: block = NOTE_BLOCK (insn); delete_insn (insn); break; case NOTE_INSN_BLOCK_END: block = BLOCK_SUPERCONTEXT (block); if (block && TREE_CODE (block) == FUNCTION_DECL) block = 0; delete_insn (insn); break; default: if (NOTE_LINE_NUMBER (insn) > 0) { line_number = NOTE_LINE_NUMBER (insn); file_name = (char *)NOTE_SOURCE_FILE (insn); } break; } } } /* Tag the blocks with a depth number so that change_scope can find the common parent easily. */ set_block_levels (DECL_INITIAL (cfun->decl), 0); }
unsigned int insn_locators_initialize (void) { tree block = NULL; tree last_block = NULL; rtx insn, next; int loc = 0; int line_number = 0, last_line_number = 0; const char *file_name = NULL, *last_file_name = NULL; prologue_locator = epilogue_locator = 0; block_locators_locs = VEC_alloc (int, heap, 32); block_locators_blocks = VEC_alloc (tree, gc, 32); line_locators_locs = VEC_alloc (int, heap, 32); line_locators_lines = VEC_alloc (int, heap, 32); file_locators_locs = VEC_alloc (int, heap, 32); VARRAY_CHAR_PTR_INIT (file_locators_files, 32, "file_locators_files"); for (insn = get_insns (); insn; insn = next) { int active = 0; next = NEXT_INSN (insn); if (NOTE_P (insn)) { gcc_assert (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_BEG && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END); if (NOTE_LINE_NUMBER (insn) > 0) { expanded_location xloc; NOTE_EXPANDED_LOCATION (xloc, insn); line_number = xloc.line; file_name = xloc.file; } } else active = (active_insn_p (insn) && GET_CODE (PATTERN (insn)) != ADDR_VEC && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC); check_block_change (insn, &block); if (active || !next || (!prologue_locator && file_name)) { if (last_block != block) { loc++; VEC_safe_push (int, heap, block_locators_locs, loc); VEC_safe_push (tree, gc, block_locators_blocks, block); last_block = block; } if (last_line_number != line_number) { loc++; VEC_safe_push (int, heap, line_locators_locs, loc); VEC_safe_push (int, heap, line_locators_lines, line_number); last_line_number = line_number; } if (last_file_name != file_name) { loc++; VEC_safe_push (int, heap, file_locators_locs, loc); VARRAY_PUSH_CHAR_PTR (file_locators_files, (char *) file_name); last_file_name = file_name; } if (!prologue_locator && file_name) prologue_locator = loc; if (!next) epilogue_locator = loc; if (active) INSN_LOCATOR (insn) = loc; } } /* Tag the blocks with a depth number so that change_scope can find the common parent easily. */ set_block_levels (DECL_INITIAL (cfun->decl), 0); free_block_changes (); return 0; }