Commit ffa4602f by Eric Botcazou Committed by Eric Botcazou

rtl.h (insn_location): Declare.

	* rtl.h (insn_location): Declare.
	* cfgcleanup.c (try_forward_edges): Compare the locus of locations
	with UNKNOWN_LOCATION.
	* emit-rtl.c (insn_location): New function.
	* final.c (notice_source_line): Check that the instruction has a
	location before retrieving it and use insn_location.
	* modulo-sched.c (loop_single_full_bb_p): Likewise.
	* print-rtl.c (print_rtx): Likewise.

From-SVN: r211305
parent 28a4a292
2014-06-06 Eric Botcazou <ebotcazou@adacore.com>
* rtl.h (insn_location): Declare.
* cfgcleanup.c (try_forward_edges): Compare the locus of locations
with UNKNOWN_LOCATION.
* emit-rtl.c (insn_location): New function.
* final.c (notice_source_line): Check that the instruction has a
location before retrieving it and use insn_location.
* modulo-sched.c (loop_single_full_bb_p): Likewise.
* print-rtl.c (print_rtx): Likewise.
2014-06-06 Richard Biener <rguenther@suse.de> 2014-06-06 Richard Biener <rguenther@suse.de>
* passes.def: Move 2nd VRP pass before phi-only-cprop. * passes.def: Move 2nd VRP pass before phi-only-cprop.
......
...@@ -482,31 +482,30 @@ try_forward_edges (int mode, basic_block b) ...@@ -482,31 +482,30 @@ try_forward_edges (int mode, basic_block b)
location_t new_locus = single_succ_edge (target)->goto_locus; location_t new_locus = single_succ_edge (target)->goto_locus;
location_t locus = goto_locus; location_t locus = goto_locus;
if (new_locus != UNKNOWN_LOCATION if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION
&& locus != UNKNOWN_LOCATION && LOCATION_LOCUS (locus) != UNKNOWN_LOCATION
&& new_locus != locus) && new_locus != locus)
new_target = NULL; new_target = NULL;
else else
{ {
rtx last; if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION)
if (new_locus != UNKNOWN_LOCATION)
locus = new_locus; locus = new_locus;
last = BB_END (target); rtx last = BB_END (target);
if (DEBUG_INSN_P (last)) if (DEBUG_INSN_P (last))
last = prev_nondebug_insn (last); last = prev_nondebug_insn (last);
if (last && INSN_P (last))
new_locus = INSN_LOCATION (last);
else
new_locus = UNKNOWN_LOCATION;
new_locus = last && INSN_P (last) if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION
? INSN_LOCATION (last) : 0; && LOCATION_LOCUS (locus) != UNKNOWN_LOCATION
if (new_locus != UNKNOWN_LOCATION
&& locus != UNKNOWN_LOCATION
&& new_locus != locus) && new_locus != locus)
new_target = NULL; new_target = NULL;
else else
{ {
if (new_locus != UNKNOWN_LOCATION) if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION)
locus = new_locus; locus = new_locus;
goto_locus = locus; goto_locus = locus;
......
...@@ -6174,6 +6174,13 @@ insn_file (const_rtx insn) ...@@ -6174,6 +6174,13 @@ insn_file (const_rtx insn)
return LOCATION_FILE (INSN_LOCATION (insn)); return LOCATION_FILE (INSN_LOCATION (insn));
} }
/* Return expanded location of the statement that produced this insn. */
expanded_location
insn_location (const_rtx insn)
{
return expand_location (INSN_LOCATION (insn));
}
/* Return true if memory model MODEL requires a pre-operation (release-style) /* Return true if memory model MODEL requires a pre-operation (release-style)
barrier or a post-operation (acquire-style) barrier. While not universal, barrier or a post-operation (acquire-style) barrier. While not universal,
this function matches behavior of several targets. */ this function matches behavior of several targets. */
......
...@@ -3019,10 +3019,16 @@ notice_source_line (rtx insn, bool *is_stmt) ...@@ -3019,10 +3019,16 @@ notice_source_line (rtx insn, bool *is_stmt)
filename = override_filename; filename = override_filename;
linenum = override_linenum; linenum = override_linenum;
} }
else if (INSN_HAS_LOCATION (insn))
{
expanded_location xloc = insn_location (insn);
filename = xloc.file;
linenum = xloc.line;
}
else else
{ {
filename = insn_file (insn); filename = NULL;
linenum = insn_line (insn); linenum = 0;
} }
if (filename == NULL) if (filename == NULL)
......
...@@ -1244,11 +1244,10 @@ loop_single_full_bb_p (struct loop *loop) ...@@ -1244,11 +1244,10 @@ loop_single_full_bb_p (struct loop *loop)
static void static void
dump_insn_location (rtx insn) dump_insn_location (rtx insn)
{ {
if (dump_file && INSN_LOCATION (insn)) if (dump_file && INSN_HAS_LOCATION (insn))
{ {
const char *file = insn_file (insn); expanded_location xloc = insn_location (insn);
if (file) fprintf (dump_file, " %s:%i", xloc.file, xloc.line);
fprintf (dump_file, " %s:%i", file, insn_line (insn));
} }
} }
......
...@@ -395,9 +395,11 @@ print_rtx (const_rtx in_rtx) ...@@ -395,9 +395,11 @@ print_rtx (const_rtx in_rtx)
/* Pretty-print insn locations. Ignore scoping as it is mostly /* Pretty-print insn locations. Ignore scoping as it is mostly
redundant with line number information and do not print anything redundant with line number information and do not print anything
when there is no location information available. */ when there is no location information available. */
if (INSN_LOCATION (in_rtx) && insn_file (in_rtx)) if (INSN_HAS_LOCATION (in_rtx))
fprintf (outfile, " %s:%i", insn_file (in_rtx), {
insn_line (in_rtx)); expanded_location xloc = insn_location (in_rtx);
fprintf (outfile, " %s:%i", xloc.file, xloc.line);
}
#endif #endif
} }
else if (i == 6 && GET_CODE (in_rtx) == ASM_OPERANDS) else if (i == 6 && GET_CODE (in_rtx) == ASM_OPERANDS)
......
...@@ -2130,6 +2130,7 @@ extern rtx prev_cc0_setter (rtx); ...@@ -2130,6 +2130,7 @@ extern rtx prev_cc0_setter (rtx);
extern int insn_line (const_rtx); extern int insn_line (const_rtx);
extern const char * insn_file (const_rtx); extern const char * insn_file (const_rtx);
extern tree insn_scope (const_rtx); extern tree insn_scope (const_rtx);
extern expanded_location insn_location (const_rtx);
extern location_t prologue_location, epilogue_location; extern location_t prologue_location, epilogue_location;
/* In jump.c */ /* In jump.c */
......
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