Commit fd3acbb3 by Nathan Sidwell

function.h (struct emit_status): Remove x_last_linenum, x_last_filename.

	* function.h (struct emit_status): Remove x_last_linenum,
	x_last_filename. Add x_last_location.
	* rtl.h: #include "input.h".
	(NOTE_DATA): New.
	* cfglayout.c (duplicate_insn_chain): Use emit_line_note for line
	number notes.
	* emit-rtl.c (last_linenum, last_filename): Remove.
	(last_location): New.
	(emit_line_note_after): LINE must always be >= 0.
	(emit_line_note): Likewise. Check not duplicate here...
	(emit_note): ... rather than here.
	(emit_line_note_force, force_next_line_note, init_emit): Adjust.
	* integrate.c (expand_inline_function): Use emit_line_note for
	line number notes.
	(copy_insn_list): Likewise.
	* unroll.c (copy_loop_body): Likewise.
	* Makefile.in (RTL_H): Add input.h.

From-SVN: r68002
parent 695a94b3
2003-06-15 Nathan Sidwell <nathan@codesourcery.com>
* function.h (struct emit_status): Remove x_last_linenum,
x_last_filename. Add x_last_location.
* rtl.h: #include "input.h".
(NOTE_DATA): New.
* cfglayout.c (duplicate_insn_chain): Use emit_line_note for line
number notes.
* emit-rtl.c (last_linenum, last_filename): Remove.
(last_location): New.
(emit_line_note_after): LINE must always be >= 0.
(emit_line_note): Likewise. Check not duplicate here...
(emit_note): ... rather than here.
(emit_line_note_force, force_next_line_note, init_emit): Adjust.
* integrate.c (expand_inline_function): Use emit_line_note for
line number notes.
(copy_insn_list): Likewise.
* unroll.c (copy_loop_body): Likewise.
* Makefile.in (RTL_H): Add input.h.
2003-06-16 Richard Sandiford <rsandifo@redhat.com> 2003-06-16 Richard Sandiford <rsandifo@redhat.com>
* optabs.c (emit_libcall_block): Don't hoist insns past a label. * optabs.c (emit_libcall_block): Don't hoist insns past a label.
...@@ -86,8 +106,7 @@ ...@@ -86,8 +106,7 @@
* c.opt: Specify languages. * c.opt: Specify languages.
* opts.h: Remove languages. * opts.h: Remove languages.
* opts.sh: Recognise front-end defined languages. * opts.sh: Recognise front-end defined languages.
doc: * doc/sourcebuild.texi: Update.
* sourcebuild.texi: Update.
2003-06-15 Andreas Jaeger <aj@suse.de> 2003-06-15 Andreas Jaeger <aj@suse.de>
......
...@@ -631,7 +631,7 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H) ...@@ -631,7 +631,7 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h $(HOOKS_H) TARGET_DEF_H = target-def.h $(HOOKS_H)
MACHMODE_H = machmode.h machmode.def @extra_modes_file@ MACHMODE_H = machmode.h machmode.def @extra_modes_file@
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H)
RTL_H = $(RTL_BASE_H) genrtl.h RTL_H = $(RTL_BASE_H) genrtl.h input.h
PARAMS_H = params.h params.def PARAMS_H = params.h params.def
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \ TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \
input.h input.h
......
...@@ -1023,7 +1023,8 @@ duplicate_insn_chain (from, to) ...@@ -1023,7 +1023,8 @@ duplicate_insn_chain (from, to)
abort (); abort ();
break; break;
case NOTE_INSN_REPEATED_LINE_NUMBER: case NOTE_INSN_REPEATED_LINE_NUMBER:
emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); emit_line_note (NOTE_SOURCE_FILE (insn),
NOTE_LINE_NUMBER (insn));
break; break;
default: default:
...@@ -1031,7 +1032,8 @@ duplicate_insn_chain (from, to) ...@@ -1031,7 +1032,8 @@ duplicate_insn_chain (from, to)
abort (); abort ();
/* It is possible that no_line_number is set and the note /* It is possible that no_line_number is set and the note
won't be emitted. */ won't be emitted. */
emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); emit_line_note (NOTE_SOURCE_FILE (insn),
NOTE_LINE_NUMBER (insn));
} }
break; break;
default: default:
......
...@@ -170,8 +170,7 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def))) ...@@ -170,8 +170,7 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
#define first_insn (cfun->emit->x_first_insn) #define first_insn (cfun->emit->x_first_insn)
#define last_insn (cfun->emit->x_last_insn) #define last_insn (cfun->emit->x_last_insn)
#define cur_insn_uid (cfun->emit->x_cur_insn_uid) #define cur_insn_uid (cfun->emit->x_cur_insn_uid)
#define last_linenum (cfun->emit->x_last_linenum) #define last_location (cfun->emit->x_last_location)
#define last_filename (cfun->emit->x_last_filename)
#define first_label_num (cfun->emit->x_first_label_num) #define first_label_num (cfun->emit->x_first_label_num)
static rtx make_jump_insn_raw PARAMS ((rtx)); static rtx make_jump_insn_raw PARAMS ((rtx));
...@@ -4636,7 +4635,9 @@ emit_line_note_after (file, line, after) ...@@ -4636,7 +4635,9 @@ emit_line_note_after (file, line, after)
{ {
rtx note; rtx note;
if (no_line_numbers && line > 0) if (line < 0)
abort ();
if (no_line_numbers)
{ {
cur_insn_uid++; cur_insn_uid++;
return 0; return 0;
...@@ -4896,12 +4897,22 @@ emit_line_note (file, line) ...@@ -4896,12 +4897,22 @@ emit_line_note (file, line)
const char *file; const char *file;
int line; int line;
{ {
if (line < 0)
abort ();
set_file_and_line_for_stmt (file, line); set_file_and_line_for_stmt (file, line);
#if 0 if (file && last_location.file && !strcmp (file, last_location.file)
&& line == last_location.line)
return NULL_RTX;
last_location.file = file;
last_location.line = line;
if (no_line_numbers) if (no_line_numbers)
return 0; {
#endif cur_insn_uid++;
return NULL_RTX;
}
return emit_note (file, line); return emit_note (file, line);
} }
...@@ -4918,21 +4929,6 @@ emit_note (file, line) ...@@ -4918,21 +4929,6 @@ emit_note (file, line)
{ {
rtx note; rtx note;
if (line > 0)
{
if (file && last_filename && !strcmp (file, last_filename)
&& line == last_linenum)
return 0;
last_filename = file;
last_linenum = line;
}
if (no_line_numbers && line > 0)
{
cur_insn_uid++;
return 0;
}
note = rtx_alloc (NOTE); note = rtx_alloc (NOTE);
INSN_UID (note) = cur_insn_uid++; INSN_UID (note) = cur_insn_uid++;
NOTE_SOURCE_FILE (note) = file; NOTE_SOURCE_FILE (note) = file;
...@@ -4949,7 +4945,7 @@ emit_line_note_force (file, line) ...@@ -4949,7 +4945,7 @@ emit_line_note_force (file, line)
const char *file; const char *file;
int line; int line;
{ {
last_linenum = -1; last_location.line = -1;
return emit_line_note (file, line); return emit_line_note (file, line);
} }
...@@ -4959,7 +4955,7 @@ emit_line_note_force (file, line) ...@@ -4959,7 +4955,7 @@ emit_line_note_force (file, line)
void void
force_next_line_note () force_next_line_note ()
{ {
last_linenum = -1; last_location.line = -1;
} }
/* Place a note of KIND on insn INSN with DATUM as the datum. If a /* Place a note of KIND on insn INSN with DATUM as the datum. If a
...@@ -5438,8 +5434,8 @@ init_emit () ...@@ -5438,8 +5434,8 @@ init_emit ()
seq_rtl_expr = NULL; seq_rtl_expr = NULL;
cur_insn_uid = 1; cur_insn_uid = 1;
reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
last_linenum = 0; last_location.line = 0;
last_filename = 0; last_location.file = 0;
first_label_num = label_num; first_label_num = label_num;
last_label_num = 0; last_label_num = 0;
seq_stack = NULL; seq_stack = NULL;
......
...@@ -83,10 +83,9 @@ struct emit_status GTY(()) ...@@ -83,10 +83,9 @@ struct emit_status GTY(())
Reset to 1 for each function compiled. */ Reset to 1 for each function compiled. */
int x_cur_insn_uid; int x_cur_insn_uid;
/* Line number and source file of the last line-number NOTE emitted. /* Location the last line-number NOTE emitted.
This is used to avoid generating duplicates. */ This is used to avoid generating duplicates. */
int x_last_linenum; location_t x_last_location;
const char *x_last_filename;
/* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx
vectors. Since these vectors are needed during the expansion phase when vectors. Since these vectors are needed during the expansion phase when
......
...@@ -925,8 +925,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, ...@@ -925,8 +925,8 @@ expand_inline_function (fndecl, parms, target, ignore, type,
if (GET_CODE (parm_insns) == NOTE if (GET_CODE (parm_insns) == NOTE
&& NOTE_LINE_NUMBER (parm_insns) > 0) && NOTE_LINE_NUMBER (parm_insns) > 0)
{ {
rtx note = emit_note (NOTE_SOURCE_FILE (parm_insns), rtx note = emit_line_note (NOTE_SOURCE_FILE (parm_insns),
NOTE_LINE_NUMBER (parm_insns)); NOTE_LINE_NUMBER (parm_insns));
if (note) if (note)
RTX_INTEGRATED_P (note) = 1; RTX_INTEGRATED_P (note) = 1;
} }
...@@ -1017,8 +1017,8 @@ expand_inline_function (fndecl, parms, target, ignore, type, ...@@ -1017,8 +1017,8 @@ expand_inline_function (fndecl, parms, target, ignore, type,
&& ! (GET_CODE (XEXP (loc, 0)) == REG && ! (GET_CODE (XEXP (loc, 0)) == REG
&& REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)) && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER))
{ {
rtx note = emit_note (DECL_SOURCE_FILE (formal), rtx note = emit_line_note (DECL_SOURCE_FILE (formal),
DECL_SOURCE_LINE (formal)); DECL_SOURCE_LINE (formal));
if (note) if (note)
RTX_INTEGRATED_P (note) = 1; RTX_INTEGRATED_P (note) = 1;
...@@ -1305,7 +1305,7 @@ expand_inline_function (fndecl, parms, target, ignore, type, ...@@ -1305,7 +1305,7 @@ expand_inline_function (fndecl, parms, target, ignore, type,
This line number note is still needed for debugging though, so we can't This line number note is still needed for debugging though, so we can't
delete it. */ delete it. */
if (flag_test_coverage) if (flag_test_coverage)
emit_note (0, NOTE_INSN_REPEATED_LINE_NUMBER); emit_note (NULL, NOTE_INSN_REPEATED_LINE_NUMBER);
emit_line_note (input_filename, input_line); emit_line_note (input_filename, input_line);
...@@ -1683,15 +1683,17 @@ copy_insn_list (insns, map, static_chain_value) ...@@ -1683,15 +1683,17 @@ copy_insn_list (insns, map, static_chain_value)
NOTE_INSN_DELETED notes aren't useful. */ NOTE_INSN_DELETED notes aren't useful. */
if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END 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
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED) && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED)
{ {
copy = emit_note (NOTE_SOURCE_FILE (insn), copy = emit_note (NULL, NOTE_LINE_NUMBER (insn));
NOTE_LINE_NUMBER (insn)); NOTE_DATA (copy) = NOTE_DATA (insn);
if (copy if ((NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG
&& (NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG || NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END)
|| NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END)
&& NOTE_BLOCK (insn)) && NOTE_BLOCK (insn))
{ {
tree *mapped_block_p; tree *mapped_block_p;
...@@ -1708,8 +1710,7 @@ copy_insn_list (insns, map, static_chain_value) ...@@ -1708,8 +1710,7 @@ copy_insn_list (insns, map, static_chain_value)
else else
NOTE_BLOCK (copy) = *mapped_block_p; NOTE_BLOCK (copy) = *mapped_block_p;
} }
else if (copy else if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE)
&& NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE)
NOTE_EXPECTED_VALUE (copy) NOTE_EXPECTED_VALUE (copy)
= copy_rtx_and_substitute (NOTE_EXPECTED_VALUE (insn), = copy_rtx_and_substitute (NOTE_EXPECTED_VALUE (insn),
map, 0); map, 0);
......
...@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
struct function; struct function;
#include "machmode.h" #include "machmode.h"
#include "input.h"
#undef FFS /* Some systems predefine this symbol; don't let it interfere. */ #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
#undef FLOAT /* Likewise. */ #undef FLOAT /* Likewise. */
...@@ -782,6 +783,8 @@ extern const char * const reg_note_name[]; ...@@ -782,6 +783,8 @@ extern const char * const reg_note_name[];
between ints and pointers if we use a different macro for the block number.) between ints and pointers if we use a different macro for the block number.)
*/ */
/* Opaque data. */
#define NOTE_DATA(INSN) XCINT (INSN, 4, NOTE)
#define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE) #define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE)
#define NOTE_BLOCK(INSN) XCTREE (INSN, 4, NOTE) #define NOTE_BLOCK(INSN) XCTREE (INSN, 4, NOTE)
#define NOTE_EH_HANDLER(INSN) XCINT (INSN, 4, NOTE) #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 4, NOTE)
...@@ -1511,6 +1514,7 @@ extern rtx assign_stack_temp PARAMS ((enum machine_mode, ...@@ -1511,6 +1514,7 @@ extern rtx assign_stack_temp PARAMS ((enum machine_mode,
extern rtx assign_stack_temp_for_type PARAMS ((enum machine_mode, extern rtx assign_stack_temp_for_type PARAMS ((enum machine_mode,
HOST_WIDE_INT, int, tree)); HOST_WIDE_INT, int, tree));
extern rtx assign_temp PARAMS ((tree, int, int, int)); extern rtx assign_temp PARAMS ((tree, int, int, int));
/* In emit-rtl.c */ /* In emit-rtl.c */
extern rtx emit_insn_before PARAMS ((rtx, rtx)); extern rtx emit_insn_before PARAMS ((rtx, rtx));
extern rtx emit_insn_before_setloc PARAMS ((rtx, rtx, int)); extern rtx emit_insn_before_setloc PARAMS ((rtx, rtx, int));
......
...@@ -2263,14 +2263,20 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, ...@@ -2263,14 +2263,20 @@ 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 the associated rtl. We do not want to share the structure in
this new block. */ this new block. */
if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED if (NOTE_LINE_NUMBER (insn) > 0)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL copy = emit_line_note (NOTE_SOURCE_FILE (insn),
&& 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_SOURCE_FILE (insn),
NOTE_LINE_NUMBER (insn)); NOTE_LINE_NUMBER (insn));
else 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 (NULL, NOTE_LINE_NUMBER (insn));
NOTE_DATA (copy) = NOTE_DATA (insn);
}
else else
copy = 0; copy = 0;
break; break;
...@@ -2315,12 +2321,18 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, ...@@ -2315,12 +2321,18 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
instructions before the last insn in the loop, COPY_NOTES_FROM 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, can be a NOTE_INSN_LOOP_CONT note if there is no VTOP note,
as in a do .. while loop. */ as in a do .. while loop. */
if (GET_CODE (insn) == NOTE if (GET_CODE (insn) != NOTE)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED /*NOP*/;
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK else if (NOTE_LINE_NUMBER (insn) > 0)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP emit_line_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_CONT) else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED
emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn)); && 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 (NULL, NOTE_LINE_NUMBER (insn));
NOTE_DATA (copy) = NOTE_DATA (insn);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment