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); }
void print_insn (char *buf, rtx x, int verbose) { char t[BUF_LEN]; rtx insn = x; switch (GET_CODE (x)) { case INSN: print_pattern (t, PATTERN (x), verbose); if (verbose) sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1), t); else sprintf (buf, "%-4d %s", INSN_UID (x), t); break; case JUMP_INSN: print_pattern (t, PATTERN (x), verbose); if (verbose) sprintf (buf, "%s: jump %s", (*current_sched_info->print_insn) (x, 1), t); else sprintf (buf, "%-4d %s", INSN_UID (x), t); break; case CALL_INSN: x = PATTERN (insn); if (GET_CODE (x) == PARALLEL) { x = XVECEXP (x, 0, 0); print_pattern (t, x, verbose); } else strcpy (t, "call <...>"); if (verbose) sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1), t); else sprintf (buf, "%-4d %s", INSN_UID (insn), t); break; case CODE_LABEL: sprintf (buf, "L%d:", INSN_UID (x)); break; case BARRIER: sprintf (buf, "i% 4d: barrier", INSN_UID (x)); break; case NOTE: if (NOTE_LINE_NUMBER (x) > 0) sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x), NOTE_SOURCE_FILE (x), NOTE_LINE_NUMBER (x)); else sprintf (buf, "%4d %s", INSN_UID (x), GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x))); break; default: if (verbose) { sprintf (buf, "Not an INSN at all\n"); debug_rtx (x); } else sprintf (buf, "i%-4d <What?>", INSN_UID (x)); } } /* print_insn */