diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0272ccae66..eac7bbfabc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2003-07-01 Nathan Sidwell + + * rtl.h (emit_line_note_after): Remove. + (emit_note_copy_after, emit_note_copy): New. + * emit-rtl.c (reorder_insns_with_line_notes): Replace + emit_line_note_after with emit_note_copy_after. + (emit_insn_after_with_line_notes): Likewise. + (emit_line_note_after): Kill. + (emit_note_copy_after): New. + (emit_note_copy): New. + * function.c (emit_return_into_block): Use emit_note_copy_after. + (thread_prologue_and_epilogue_insns): Likewise. + * integrate.c (expand_inline_function): Use emit_note_copy. + (copy_insn_list): Likewise. + * unroll.c (copy_loop_body): Likewise. + * cfglayout.c (duplicate_insn_chain): Likewise. + 2003-07-01 Nathan Sidwell * c-tree.h (define_label): Replace filename and lineno arguments diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 736d8887ec5..12cc255293d 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -1008,8 +1008,7 @@ duplicate_insn_chain (rtx from, rtx to) abort (); break; case NOTE_INSN_REPEATED_LINE_NUMBER: - emit_line_note (NOTE_SOURCE_FILE (insn), - NOTE_LINE_NUMBER (insn)); + emit_note_copy (insn); break; default: @@ -1017,8 +1016,7 @@ duplicate_insn_chain (rtx from, rtx to) abort (); /* It is possible that no_line_number is set and the note won't be emitted. */ - emit_line_note (NOTE_SOURCE_FILE (insn), - NOTE_LINE_NUMBER (insn)); + emit_note_copy (insn); } break; default: diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 17f68cf9806..c3f36fa9579 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3869,13 +3869,9 @@ reorder_insns_with_line_notes (rtx from, rtx to, rtx after) return; if (from_line) - emit_line_note_after (NOTE_SOURCE_FILE (from_line), - NOTE_LINE_NUMBER (from_line), - after); + emit_note_copy_after (from_line, after); if (after_line) - emit_line_note_after (NOTE_SOURCE_FILE (after_line), - NOTE_LINE_NUMBER (after_line), - to); + emit_note_copy_after (after_line, to); } /* Remove unnecessary notes from the instruction stream. */ @@ -4295,14 +4291,10 @@ emit_insn_after_with_line_notes (rtx x, rtx after, rtx from) rtx insn = emit_insn_after (x, after); if (from_line) - emit_line_note_after (NOTE_SOURCE_FILE (from_line), - NOTE_LINE_NUMBER (from_line), - after); + emit_note_copy_after (from_line, after); if (after_line) - emit_line_note_after (NOTE_SOURCE_FILE (after_line), - NOTE_LINE_NUMBER (after_line), - insn); + emit_note_copy_after (after_line, insn); } /* Make an insn of code JUMP_INSN with body X @@ -4428,16 +4420,14 @@ emit_note_after (int subtype, rtx after) return note; } -/* Emit a line note for FILE and LINE after the insn AFTER. */ +/* Emit a copy of note ORIG after the insn AFTER. */ rtx -emit_line_note_after (const char *file, int line, rtx after) +emit_note_copy_after (rtx orig, rtx after) { rtx note; - if (line < 0) - abort (); - if (no_line_numbers) + if (NOTE_LINE_NUMBER (orig) >= 0 && no_line_numbers) { cur_insn_uid++; return 0; @@ -4445,8 +4435,8 @@ emit_line_note_after (const char *file, int line, rtx after) note = rtx_alloc (NOTE); INSN_UID (note) = cur_insn_uid++; - NOTE_SOURCE_FILE (note) = file; - NOTE_LINE_NUMBER (note) = line; + NOTE_LINE_NUMBER (note) = NOTE_LINE_NUMBER (orig); + NOTE_DATA (note) = NOTE_DATA (orig); BLOCK_FOR_INSN (note) = NULL; add_insn_after (note, after); return note; @@ -4704,7 +4694,31 @@ emit_line_note (const char *file, int line) note = emit_note (line); NOTE_SOURCE_FILE (note) = file; + + return note; +} +/* Emit a copy of note ORIG. */ + +rtx +emit_note_copy (rtx orig) +{ + rtx note; + + if (NOTE_LINE_NUMBER (orig) >= 0 && no_line_numbers) + { + cur_insn_uid++; + return NULL_RTX; + } + + note = rtx_alloc (NOTE); + + INSN_UID (note) = cur_insn_uid++; + NOTE_DATA (note) = NOTE_DATA (orig); + NOTE_LINE_NUMBER (note) = NOTE_LINE_NUMBER (orig); + BLOCK_FOR_INSN (note) = NULL; + add_insn (note); + return note; } diff --git a/gcc/function.c b/gcc/function.c index b2caea9959c..074f9206c88 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -7412,8 +7412,7 @@ emit_return_into_block (bb, line_note) { emit_jump_insn_after (gen_return (), bb->end); if (line_note) - emit_line_note_after (NOTE_SOURCE_FILE (line_note), - NOTE_LINE_NUMBER (line_note), PREV_INSN (bb->end)); + emit_note_copy_after (line_note, PREV_INSN (bb->end)); } #endif /* HAVE_return */ @@ -7997,9 +7996,7 @@ epilogue_done: insn = PREV_INSN (insn)) if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) { - emit_line_note_after (NOTE_SOURCE_FILE (insn), - NOTE_LINE_NUMBER (insn), - prologue_end); + emit_note_copy_after (insn, prologue_end); break; } } diff --git a/gcc/integrate.c b/gcc/integrate.c index ab4af1823f1..622c1abfeda 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -924,8 +924,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, if (GET_CODE (parm_insns) == NOTE && NOTE_LINE_NUMBER (parm_insns) > 0) { - rtx note = emit_line_note (NOTE_SOURCE_FILE (parm_insns), - NOTE_LINE_NUMBER (parm_insns)); + rtx note = emit_note_copy (parm_insns); + if (note) RTX_INTEGRATED_P (note) = 1; } @@ -1682,18 +1682,16 @@ copy_insn_list (insns, map, static_chain_value) NOTE_INSN_DELETED notes aren't useful. */ - if (NOTE_LINE_NUMBER (insn) > 0) - copy = emit_line_note (NOTE_SOURCE_FILE (insn), - NOTE_LINE_NUMBER (insn)); - else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END + if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED) { - copy = emit_note (NOTE_LINE_NUMBER (insn)); - NOTE_DATA (copy) = NOTE_DATA (insn); - if ((NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG - || NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END) - && NOTE_BLOCK (insn)) + copy = emit_note_copy (insn); + if (!copy) + /*Copied a line note, but line numbering is off*/; + else if ((NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG + || NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END) + && NOTE_BLOCK (insn)) { tree *mapped_block_p; diff --git a/gcc/rtl.h b/gcc/rtl.h index bba530181ba..de76ec2fa32 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1528,14 +1528,15 @@ extern rtx emit_call_insn_after_setloc PARAMS ((rtx, rtx, int)); extern rtx emit_barrier_after PARAMS ((rtx)); extern rtx emit_label_after PARAMS ((rtx, rtx)); extern rtx emit_note_after PARAMS ((int, rtx)); -extern rtx emit_line_note_after PARAMS ((const char *, int, rtx)); +extern rtx emit_note_copy_after PARAMS ((rtx, rtx)); extern rtx emit_insn PARAMS ((rtx)); extern rtx emit_jump_insn PARAMS ((rtx)); extern rtx emit_call_insn PARAMS ((rtx)); extern rtx emit_label PARAMS ((rtx)); extern rtx emit_barrier PARAMS ((void)); -extern rtx emit_line_note PARAMS ((const char *, int)); extern rtx emit_note PARAMS ((int)); +extern rtx emit_note_copy PARAMS ((rtx)); +extern rtx emit_line_note PARAMS ((const char *, int)); extern rtx emit_line_note_force PARAMS ((const char *, int)); extern rtx make_insn_raw PARAMS ((rtx)); extern void add_function_usage_to PARAMS ((rtx, rtx)); diff --git a/gcc/unroll.c b/gcc/unroll.c index 84ace299e4e..b6e280dc819 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -2252,20 +2252,14 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, the associated rtl. We do not want to share the structure in this new block. */ - if (NOTE_LINE_NUMBER (insn) > 0) - copy = emit_line_note (NOTE_SOURCE_FILE (insn), - NOTE_LINE_NUMBER (insn)); - else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED + if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK && ((NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) || (last_iteration && unroll_type != UNROLL_COMPLETELY))) - { - copy = emit_note (NOTE_LINE_NUMBER (insn)); - NOTE_DATA (copy) = NOTE_DATA (insn); - } + copy = emit_note_copy (insn); else copy = 0; break; @@ -2310,18 +2304,12 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, instructions before the last insn in the loop, COPY_NOTES_FROM can be a NOTE_INSN_LOOP_CONT note if there is no VTOP note, as in a do .. while loop. */ - if (GET_CODE (insn) != NOTE) - /*NOP*/; - else if (NOTE_LINE_NUMBER (insn) > 0) - emit_line_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); - else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED + if (GET_CODE (insn) == NOTE + && ((NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP - && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) - { - rtx copy = emit_note (NOTE_LINE_NUMBER (insn)); - NOTE_DATA (copy) = NOTE_DATA (insn); - } + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT))) + emit_note_copy (insn); } }