aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-06-08 21:35:54 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2003-06-08 19:35:54 +0000
commit0435312e3890ead4503ac3d1c83afc556b39dc39 (patch)
tree852a6d09fbb544c05a647e6acf28fdbf9741a19d /gcc/final.c
parent5d39821d113805e918072e3bb6c91a28a6f66188 (diff)
downloadgcc-0435312e3890ead4503ac3d1c83afc556b39dc39.zip
gcc-0435312e3890ead4503ac3d1c83afc556b39dc39.tar.gz
gcc-0435312e3890ead4503ac3d1c83afc556b39dc39.tar.bz2
cfglayout.c (insn_scope): New static function
* cfglayout.c (insn_scope): New static function (block_locators_*, line_locators*, file_locators*): New static varrays. (scope_to_insns_initialize): Use them. (insn_line, insn_file): New functions. (scope_to_insns_finalize): Use insn_scope. (prologue_locator, epilogue_locator): New global variables. * emit-rt.c (try_split, make_insn_raw, make_jump_insn_raw, make_call_insn_raw, emit_copy_of_insn_after): Use locators. (emit_insn_after_scope, emit_insn_before_scope emit_jump_insn_after_scope, emit_jump_insn_before_scope emit_call_insn_after_scope, emit_call_insn_before_scope): Rename to... (emit_insn_after_setloc, emit_insn_before_setloc emit_jump_insn_after_setloc, emit_jump_insn_before_setloc emit_call_insn_after_setloc, emit_call_insn_before_setloc): ... these; use locators. * final.c (notice_source_line): Use locators. (final_start_function): Set initial source file and line. (final_scan_insn): Use locators. * ifcvt.c (noce_try_store_flag, noce_try_store_flag_constants, noce_try_addcc, noce_try_store_flag_mask, noce_try_cmove, noce_try_cmove_arith, noce_try_minmax, noce_try_abs, noce_process_if_block, find_cond_trap): Likewise. * integrate.c (copy_insn_list): Likewise. * jump.c (duplicate_loop_exit_test): LIkewise. * print-rtl.c (print_rtx): Print locators. * recog.c (peephole2_optimize): Likewise. * rtl.h (INSN_SCOPE): Remove. (emit_insn_after_scope, emit_insn_before_scope emit_jump_insn_after_scope, emit_jump_insn_before_scope emit_call_insn_after_scope, emit_call_insn_before_scope): Rename to... (emit_insn_after_setloc, emit_insn_before_setloc emit_jump_insn_after_setloc, emit_jump_insn_before_setloc emit_call_insn_after_setloc, emit_call_insn_before_setloc): ... these; (insn_file, insn_line, prologue_locator, epilogue_locator): Declare. * unroll.c (copy_loop_body): Use locators. * function.c (set_insn_locators): New function. (thread_prologue_and_epilogue_insns): Set the locators accordingly. From-SVN: r67637
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c79
1 files changed, 23 insertions, 56 deletions
diff --git a/gcc/final.c b/gcc/final.c
index ab7a635..dae455d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -205,7 +205,7 @@ static int asm_insn_count PARAMS ((rtx));
#endif
static void profile_function PARAMS ((FILE *));
static void profile_after_prologue PARAMS ((FILE *));
-static void notice_source_line PARAMS ((rtx));
+static bool notice_source_line PARAMS ((rtx));
static rtx walk_alter_subreg PARAMS ((rtx *));
static void output_asm_name PARAMS ((void));
static void output_alternate_entry_point PARAMS ((FILE *, rtx));
@@ -1338,7 +1338,7 @@ asm_insn_count (body)
void
final_start_function (first, file, optimize)
- rtx first;
+ rtx first ATTRIBUTE_UNUSED;
FILE *file;
int optimize ATTRIBUTE_UNUSED;
{
@@ -1359,8 +1359,8 @@ final_start_function (first, file, optimize)
}
#endif
- if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
- notice_source_line (first);
+ last_linenum = 0;
+ last_filename = 0;
high_block_linenum = high_function_linenum = last_linenum;
(*debug_hooks->begin_prologue) (last_linenum, last_filename);
@@ -1392,7 +1392,7 @@ final_start_function (first, file, optimize)
if (write_symbols)
{
remove_unnecessary_notes ();
- scope_to_insns_finalize ();
+ reemit_insn_block_notes ();
number_blocks (current_function_decl);
/* We never actually put out begin/end notes for the top-level
block in the function. But, conceptually, that block is
@@ -1821,51 +1821,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
default:
if (NOTE_LINE_NUMBER (insn) <= 0)
abort ();
-
- /* This note is a line-number. */
- {
- rtx note;
- int note_after = 0;
-
- /* If there is anything real after this note, output it.
- If another line note follows, omit this one. */
- for (note = NEXT_INSN (insn); note; note = NEXT_INSN (note))
- {
- if (GET_CODE (note) != NOTE && GET_CODE (note) != CODE_LABEL)
- break;
-
- /* These types of notes can be significant
- so make sure the preceding line number stays. */
- else if (GET_CODE (note) == NOTE
- && (NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_BEG
- || NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_END
- || NOTE_LINE_NUMBER (note) == NOTE_INSN_FUNCTION_BEG))
- break;
- else if (GET_CODE (note) == NOTE && NOTE_LINE_NUMBER (note) > 0)
- {
- /* Another line note follows; we can delete this note
- if no intervening line numbers have notes elsewhere. */
- int num;
- for (num = NOTE_LINE_NUMBER (insn) + 1;
- num < NOTE_LINE_NUMBER (note);
- num++)
- if (line_note_exists[num])
- break;
-
- if (num >= NOTE_LINE_NUMBER (note))
- note_after = 1;
- break;
- }
- }
-
- /* Output this line note if it is the first or the last line
- note in a row. */
- if (!note_after)
- {
- notice_source_line (insn);
- (*debug_hooks->source_line) (last_linenum, last_filename);
- }
- }
break;
}
break;
@@ -2091,6 +2046,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
break;
}
+ /* Output this line note if it is the first or the last line
+ note in a row. */
+ if (notice_source_line (insn))
+ {
+ (*debug_hooks->source_line) (last_linenum, last_filename);
+ }
if (GET_CODE (body) == ASM_INPUT)
{
@@ -2561,16 +2522,22 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
/* Output debugging info to the assembler file FILE
based on the NOTE-insn INSN, assumed to be a line number. */
-static void
+static bool
notice_source_line (insn)
rtx insn;
{
- const char *filename = NOTE_SOURCE_FILE (insn);
+ const char *filename = insn_file (insn);
+ int linenum = insn_line (insn);
- last_filename = filename;
- last_linenum = NOTE_LINE_NUMBER (insn);
- high_block_linenum = MAX (last_linenum, high_block_linenum);
- high_function_linenum = MAX (last_linenum, high_function_linenum);
+ if (filename && (filename != last_filename || last_linenum != linenum))
+ {
+ last_filename = filename;
+ last_linenum = linenum;
+ high_block_linenum = MAX (last_linenum, high_block_linenum);
+ high_function_linenum = MAX (last_linenum, high_function_linenum);
+ return true;
+ }
+ return false;
}
/* For each operand in INSN, simplify (subreg (reg)) so that it refers