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
This commit is contained in:
Nathan Sidwell 2003-06-16 08:27:05 +00:00
parent 695a94b30a
commit fd3acbb3a2
8 changed files with 92 additions and 59 deletions

View File

@ -1,3 +1,23 @@
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>
* optabs.c (emit_libcall_block): Don't hoist insns past a label.
@ -86,8 +106,7 @@
* c.opt: Specify languages.
* opts.h: Remove languages.
* opts.sh: Recognise front-end defined languages.
doc:
* sourcebuild.texi: Update.
* doc/sourcebuild.texi: Update.
2003-06-15 Andreas Jaeger <aj@suse.de>

View File

@ -631,7 +631,7 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h $(HOOKS_H)
MACHMODE_H = machmode.h machmode.def @extra_modes_file@
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
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \
input.h

View File

@ -1023,7 +1023,8 @@ duplicate_insn_chain (from, to)
abort ();
break;
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;
default:
@ -1031,7 +1032,8 @@ duplicate_insn_chain (from, to)
abort ();
/* It is possible that no_line_number is set and the note
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;
default:

View File

@ -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 last_insn (cfun->emit->x_last_insn)
#define cur_insn_uid (cfun->emit->x_cur_insn_uid)
#define last_linenum (cfun->emit->x_last_linenum)
#define last_filename (cfun->emit->x_last_filename)
#define last_location (cfun->emit->x_last_location)
#define first_label_num (cfun->emit->x_first_label_num)
static rtx make_jump_insn_raw PARAMS ((rtx));
@ -4636,7 +4635,9 @@ emit_line_note_after (file, line, after)
{
rtx note;
if (no_line_numbers && line > 0)
if (line < 0)
abort ();
if (no_line_numbers)
{
cur_insn_uid++;
return 0;
@ -4896,12 +4897,22 @@ emit_line_note (file, line)
const char *file;
int line;
{
if (line < 0)
abort ();
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)
return 0;
#endif
{
cur_insn_uid++;
return NULL_RTX;
}
return emit_note (file, line);
}
@ -4918,21 +4929,6 @@ emit_note (file, line)
{
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);
INSN_UID (note) = cur_insn_uid++;
NOTE_SOURCE_FILE (note) = file;
@ -4949,7 +4945,7 @@ emit_line_note_force (file, line)
const char *file;
int line;
{
last_linenum = -1;
last_location.line = -1;
return emit_line_note (file, line);
}
@ -4959,7 +4955,7 @@ emit_line_note_force (file, line)
void
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
@ -5438,8 +5434,8 @@ init_emit ()
seq_rtl_expr = NULL;
cur_insn_uid = 1;
reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
last_linenum = 0;
last_filename = 0;
last_location.line = 0;
last_location.file = 0;
first_label_num = label_num;
last_label_num = 0;
seq_stack = NULL;

View File

@ -83,10 +83,9 @@ struct emit_status GTY(())
Reset to 1 for each function compiled. */
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. */
int x_last_linenum;
const char *x_last_filename;
location_t x_last_location;
/* 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

View File

@ -925,8 +925,8 @@ expand_inline_function (fndecl, parms, target, ignore, type,
if (GET_CODE (parm_insns) == NOTE
&& NOTE_LINE_NUMBER (parm_insns) > 0)
{
rtx note = emit_note (NOTE_SOURCE_FILE (parm_insns),
NOTE_LINE_NUMBER (parm_insns));
rtx note = emit_line_note (NOTE_SOURCE_FILE (parm_insns),
NOTE_LINE_NUMBER (parm_insns));
if (note)
RTX_INTEGRATED_P (note) = 1;
}
@ -1017,8 +1017,8 @@ expand_inline_function (fndecl, parms, target, ignore, type,
&& ! (GET_CODE (XEXP (loc, 0)) == REG
&& REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER))
{
rtx note = emit_note (DECL_SOURCE_FILE (formal),
DECL_SOURCE_LINE (formal));
rtx note = emit_line_note (DECL_SOURCE_FILE (formal),
DECL_SOURCE_LINE (formal));
if (note)
RTX_INTEGRATED_P (note) = 1;
@ -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
delete it. */
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);
@ -1683,15 +1683,17 @@ copy_insn_list (insns, map, static_chain_value)
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_DELETED)
{
copy = emit_note (NOTE_SOURCE_FILE (insn),
NOTE_LINE_NUMBER (insn));
if (copy
&& (NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_BEG
|| NOTE_LINE_NUMBER (copy) == NOTE_INSN_BLOCK_END)
copy = emit_note (NULL, 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))
{
tree *mapped_block_p;
@ -1708,8 +1710,7 @@ copy_insn_list (insns, map, static_chain_value)
else
NOTE_BLOCK (copy) = *mapped_block_p;
}
else if (copy
&& NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE)
else if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EXPECTED_VALUE)
NOTE_EXPECTED_VALUE (copy)
= copy_rtx_and_substitute (NOTE_EXPECTED_VALUE (insn),
map, 0);

View File

@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
struct function;
#include "machmode.h"
#include "input.h"
#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
#undef FLOAT /* Likewise. */
@ -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.)
*/
/* Opaque data. */
#define NOTE_DATA(INSN) XCINT (INSN, 4, NOTE)
#define NOTE_SOURCE_FILE(INSN) XCSTR (INSN, 4, NOTE)
#define NOTE_BLOCK(INSN) XCTREE (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,
extern rtx assign_stack_temp_for_type PARAMS ((enum machine_mode,
HOST_WIDE_INT, int, tree));
extern rtx assign_temp PARAMS ((tree, int, int, int));
/* In emit-rtl.c */
extern rtx emit_insn_before PARAMS ((rtx, rtx));
extern rtx emit_insn_before_setloc PARAMS ((rtx, rtx, int));

View File

@ -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
this new block. */
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_SOURCE_FILE (insn),
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
&& 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
copy = 0;
break;
@ -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
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
&& 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)
emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
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
&& 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);
}
}
}