Commit 9506ac2b by Per Bothner Committed by Per Bothner

Conditionally compile support for --enable-mapped_location.

	* gengtype-lex.l:  Temporary kludge to avoid duplicate typedef.
	* gengtype.c:  Update for now typdefs in input.h.  More kludges.
	* modulo-sched.c (sms_schedule):  Use NOTE_EXPANDED_LOCATION macro.
	* ra-debug.c (ra_print_rtl):  Likewise.
	* sched-rgn.c:  Likewise.
	* sched-vis.c:  Likewise.
	* rtl.h (gen_rtx_ASM_OPERANDS):  Redefine if USE_MAPPED_LOCATION.
	* stmt.c (expand_asm_operands):  Adjust calls to gen_rtx_ASM_OPERANDS.
	* tree-cfg.c:  Use new macros and typedefs.
	* tree-flow-inline.h:  Likewise.

From-SVN: r83922
parent 6773e15f
...@@ -79,6 +79,16 @@ ...@@ -79,6 +79,16 @@
* rtl-error.c: Likewise. * rtl-error.c: Likewise.
* stmt.c (check_seenlabel): Likewise. * stmt.c (check_seenlabel): Likewise.
* tree-pretty-print.c: Likewise. * tree-pretty-print.c: Likewise.
* gengtype-lex.l: Temporary kludge to avoid duplicate typedef.
* gengtype.c: Update for now typdefs in input.h. More kludges.
* modulo-sched.c (sms_schedule): Use NOTE_EXPANDED_LOCATION macro.
* ra-debug.c (ra_print_rtl): Likewise.
* sched-rgn.c: Likewise.
* sched-vis.c: Likewise.
* rtl.h (gen_rtx_ASM_OPERANDS): Redefine if USE_MAPPED_LOCATION.
* stmt.c (expand_asm_operands): Adjust calls to gen_rtx_ASM_OPERANDS.
* tree-cfg.c: Use new macros and typedefs.
* tree-flow-inline.h: Likewise.
2004-06-30 Richard Sandiford <rsandifo@redhat.com> 2004-06-30 Richard Sandiford <rsandifo@redhat.com>
Eric Christopher <echristo@redhat.com> Eric Christopher <echristo@redhat.com>
......
...@@ -88,7 +88,12 @@ ITYPE {IWORD}({WS}{IWORD})* ...@@ -88,7 +88,12 @@ ITYPE {IWORD}({WS}{IWORD})*
t = find_structure (xmemdup (tagstart, taglen, taglen+1), union_p); t = find_structure (xmemdup (tagstart, taglen, taglen+1), union_p);
if (is_pointer) if (is_pointer)
t = create_pointer (t); t = create_pointer (t);
do_typedef (xmemdup (namestart, namelen, namelen+1), t, &lexer_line); namestart = xmemdup (namestart, namelen, namelen+1);
#ifdef USE_MAPPED_LOCATION
/* temporary kludge - gentype doesn't handle cpp conditionals */
if (strcmp (namestart, "location_t") != 0)
#endif
do_typedef (namestart, t, &lexer_line);
update_lineno (yytext, yyleng); update_lineno (yytext, yyleng);
} }
......
...@@ -1104,7 +1104,7 @@ open_base_files (void) ...@@ -1104,7 +1104,7 @@ open_base_files (void)
/* The order of files here matters very much. */ /* The order of files here matters very much. */
static const char *const ifiles [] = { static const char *const ifiles [] = {
"config.h", "system.h", "coretypes.h", "tm.h", "varray.h", "config.h", "system.h", "coretypes.h", "tm.h", "varray.h",
"hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h", "hashtab.h", "splay-tree.h", "bitmap.h", "input.h", "tree.h", "rtl.h",
"function.h", "insn-config.h", "expr.h", "hard-reg-set.h", "function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
"basic-block.h", "cselib.h", "insn-addr.h", "optabs.h", "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
"libfuncs.h", "debug.h", "ggc.h", "cgraph.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
...@@ -2988,6 +2988,10 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) ...@@ -2988,6 +2988,10 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
do_scalar_typedef ("uint8", &pos); do_scalar_typedef ("uint8", &pos);
do_scalar_typedef ("jword", &pos); do_scalar_typedef ("jword", &pos);
do_scalar_typedef ("JCF_u2", &pos); do_scalar_typedef ("JCF_u2", &pos);
#ifdef USE_MAPPED_LOCATION
do_scalar_typedef ("location_t", &pos);
do_scalar_typedef ("source_locus", &pos);
#endif
do_scalar_typedef ("void", &pos); do_scalar_typedef ("void", &pos);
do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos); do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos);
...@@ -3010,6 +3014,12 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) ...@@ -3010,6 +3014,12 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
} }
if (!dupflag) if (!dupflag)
parse_file (all_files[i]); parse_file (all_files[i]);
#ifndef USE_MAPPED_LOCATION
/* temporary kludge - gengtype doesn't handle conditionals.
Manually add source_locus *after* we've processed input.h. */
if (i == 0)
do_typedef ("source_locus", create_pointer (resolve_typedef ("location_t", &pos)), &pos);
#endif
} }
if (hit_error != 0) if (hit_error != 0)
......
...@@ -900,8 +900,12 @@ sms_schedule (FILE *dump_file) ...@@ -900,8 +900,12 @@ sms_schedule (FILE *dump_file)
rtx line_note = find_line_note (tail); rtx line_note = find_line_note (tail);
if (line_note) if (line_note)
fprintf (stats_file, "SMS bb %s %d (file, line)\n", {
NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note)); expanded_location xloc;
NOTE_EXPANDED_LOCATION (xloc, line_note);
fprintf (stats_file, "SMS bb %s %d (file, line)\n",
xloc.file, xloc.line);
}
fprintf (stats_file, "SMS single-bb-loop\n"); fprintf (stats_file, "SMS single-bb-loop\n");
if (profile_info && flag_branch_probabilities) if (profile_info && flag_branch_probabilities)
{ {
...@@ -996,8 +1000,12 @@ sms_schedule (FILE *dump_file) ...@@ -996,8 +1000,12 @@ sms_schedule (FILE *dump_file)
rtx line_note = find_line_note (tail); rtx line_note = find_line_note (tail);
if (line_note) if (line_note)
fprintf (stats_file, "SMS bb %s %d (file, line)\n", {
NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note)); expanded_location xloc;
NOTE_EXPANDED_LOCATION (xloc, line_note);
fprintf (stats_file, "SMS bb %s %d (file, line)\n",
xloc.file, xloc.line);
}
fprintf (stats_file, "SMS single-bb-loop\n"); fprintf (stats_file, "SMS single-bb-loop\n");
if (profile_info && flag_branch_probabilities) if (profile_info && flag_branch_probabilities)
{ {
......
...@@ -389,9 +389,11 @@ ra_print_rtx (FILE *file, rtx x, int with_pn) ...@@ -389,9 +389,11 @@ ra_print_rtx (FILE *file, rtx x, int with_pn)
fprintf (file, " %s", GET_NOTE_INSN_NAME (ln)); fprintf (file, " %s", GET_NOTE_INSN_NAME (ln));
else else
{ {
fprintf (file, " line %d", ln); expanded_location s;
if (NOTE_SOURCE_FILE (x)) NOTE_EXPANDED_LOCATION (s, x);
fprintf (file, ":%s", NOTE_SOURCE_FILE (x)); fprintf (file, " line %d", s.line);
if (s.file != NULL)
fprintf (file, ":%s", s.file);
} }
} }
else else
......
...@@ -2321,8 +2321,12 @@ debug_dependencies (void) ...@@ -2321,8 +2321,12 @@ debug_dependencies (void)
if (n < 0) if (n < 0)
fprintf (sched_dump, "%s\n", GET_NOTE_INSN_NAME (n)); fprintf (sched_dump, "%s\n", GET_NOTE_INSN_NAME (n));
else else
fprintf (sched_dump, "line %d, file %s\n", n, {
NOTE_SOURCE_FILE (insn)); expanded_location xloc;
NOTE_EXPANDED_LOCATION (xloc, insn);
fprintf (sched_dump, "line %d, file %s\n",
xloc.line, xloc.file);
}
} }
else else
fprintf (sched_dump, " {%s}\n", GET_RTX_NAME (GET_CODE (insn))); fprintf (sched_dump, " {%s}\n", GET_RTX_NAME (GET_CODE (insn)));
......
...@@ -787,8 +787,12 @@ print_insn (char *buf, rtx x, int verbose) ...@@ -787,8 +787,12 @@ print_insn (char *buf, rtx x, int verbose)
break; break;
case NOTE: case NOTE:
if (NOTE_LINE_NUMBER (x) > 0) if (NOTE_LINE_NUMBER (x) > 0)
sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x), {
NOTE_SOURCE_FILE (x), NOTE_LINE_NUMBER (x)); expanded_location xloc;
NOTE_EXPANDED_LOCATION (xloc, x);
sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
xloc.file, xloc.line);
}
else else
sprintf (buf, "%4d %s", INSN_UID (x), sprintf (buf, "%4d %s", INSN_UID (x),
GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x))); GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x)));
......
...@@ -666,7 +666,11 @@ make_goto_expr_edges (basic_block bb) ...@@ -666,7 +666,11 @@ make_goto_expr_edges (basic_block bb)
if (simple_goto_p (goto_t)) if (simple_goto_p (goto_t))
{ {
edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU); edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
#ifdef USE_MAPPED_LOCATION
e->goto_locus = EXPR_LOCATION (goto_t);
#else
e->goto_locus = EXPR_LOCUS (goto_t); e->goto_locus = EXPR_LOCUS (goto_t);
#endif
bsi_remove (&last); bsi_remove (&last);
return; return;
} }
...@@ -1115,9 +1119,10 @@ static void remove_useless_stmts_1 (tree *, struct rus_data *); ...@@ -1115,9 +1119,10 @@ static void remove_useless_stmts_1 (tree *, struct rus_data *);
static bool static bool
remove_useless_stmts_warn_notreached (tree stmt) remove_useless_stmts_warn_notreached (tree stmt)
{ {
if (EXPR_LOCUS (stmt)) if (EXPR_HAS_LOCATION (stmt))
{ {
warning ("%Hwill never be executed", EXPR_LOCUS (stmt)); location_t loc = EXPR_LOCATION (stmt);
warning ("%Hwill never be executed", &loc);
return true; return true;
} }
...@@ -1776,7 +1781,7 @@ static void ...@@ -1776,7 +1781,7 @@ static void
remove_bb (basic_block bb) remove_bb (basic_block bb)
{ {
block_stmt_iterator i; block_stmt_iterator i;
location_t *loc = NULL; source_locus loc = 0;
if (dump_file) if (dump_file)
{ {
...@@ -1799,8 +1804,12 @@ remove_bb (basic_block bb) ...@@ -1799,8 +1804,12 @@ remove_bb (basic_block bb)
jump threading, thus resulting in bogus warnings. Not great, jump threading, thus resulting in bogus warnings. Not great,
since this way we lose warnings for gotos in the original since this way we lose warnings for gotos in the original
program that are indeed unreachable. */ program that are indeed unreachable. */
if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_LOCUS (stmt) && !loc) if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_HAS_LOCATION (stmt) && !loc)
#ifdef USE_MAPPED_LOCATION
loc = EXPR_LOCATION (stmt);
#else
loc = EXPR_LOCUS (stmt); loc = EXPR_LOCUS (stmt);
#endif
} }
/* If requested, give a warning that the first statement in the /* If requested, give a warning that the first statement in the
...@@ -1808,7 +1817,11 @@ remove_bb (basic_block bb) ...@@ -1808,7 +1817,11 @@ remove_bb (basic_block bb)
loop above, so the last statement we process is the first statement loop above, so the last statement we process is the first statement
in the block. */ in the block. */
if (warn_notreached && loc) if (warn_notreached && loc)
#ifdef USE_MAPPED_LOCATION
warning ("%Hwill never be executed", &loc);
#else
warning ("%Hwill never be executed", loc); warning ("%Hwill never be executed", loc);
#endif
remove_phi_nodes_and_edges_for_unreachable_block (bb); remove_phi_nodes_and_edges_for_unreachable_block (bb);
} }
...@@ -2641,7 +2654,11 @@ disband_implicit_edges (void) ...@@ -2641,7 +2654,11 @@ disband_implicit_edges (void)
label = tree_block_label (e->dest); label = tree_block_label (e->dest);
stmt = build1 (GOTO_EXPR, void_type_node, label); stmt = build1 (GOTO_EXPR, void_type_node, label);
#ifdef USE_MAPPED_LOCATION
SET_EXPR_LOCATION (stmt, e->goto_locus);
#else
SET_EXPR_LOCUS (stmt, e->goto_locus); SET_EXPR_LOCUS (stmt, e->goto_locus);
#endif
bsi_insert_after (&last, stmt, BSI_NEW_STMT); bsi_insert_after (&last, stmt, BSI_NEW_STMT);
e->flags &= ~EDGE_FALLTHRU; e->flags &= ~EDGE_FALLTHRU;
} }
...@@ -4759,7 +4776,11 @@ struct tree_opt_pass pass_split_crit_edges = ...@@ -4759,7 +4776,11 @@ struct tree_opt_pass pass_split_crit_edges =
static void static void
execute_warn_function_return (void) execute_warn_function_return (void)
{ {
#ifdef USE_MAPPED_LOCATION
source_location location;
#else
location_t *locus; location_t *locus;
#endif
tree last; tree last;
edge e; edge e;
...@@ -4774,17 +4795,31 @@ execute_warn_function_return (void) ...@@ -4774,17 +4795,31 @@ execute_warn_function_return (void)
if (TREE_THIS_VOLATILE (cfun->decl) if (TREE_THIS_VOLATILE (cfun->decl)
&& EXIT_BLOCK_PTR->pred != NULL) && EXIT_BLOCK_PTR->pred != NULL)
{ {
#ifdef USE_MAPPED_LOCATION
location = UNKNOWN_LOCATION;
#else
locus = NULL; locus = NULL;
#endif
for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next) for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
{ {
last = last_stmt (e->src); last = last_stmt (e->src);
if (TREE_CODE (last) == RETURN_EXPR if (TREE_CODE (last) == RETURN_EXPR
#ifdef USE_MAPPED_LOCATION
&& (location = EXPR_LOCATION (last)) != UNKNOWN_LOCATION)
#else
&& (locus = EXPR_LOCUS (last)) != NULL) && (locus = EXPR_LOCUS (last)) != NULL)
#endif
break; break;
} }
#ifdef USE_MAPPED_LOCATION
if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus;
warning ("%H`noreturn' function does return", &location);
#else
if (!locus) if (!locus)
locus = &cfun->function_end_locus; locus = &cfun->function_end_locus;
warning ("%H`noreturn' function does return", locus); warning ("%H`noreturn' function does return", locus);
#endif
} }
/* If we see "return;" in some basic block, then we do reach the end /* If we see "return;" in some basic block, then we do reach the end
...@@ -4799,10 +4834,17 @@ execute_warn_function_return (void) ...@@ -4799,10 +4834,17 @@ execute_warn_function_return (void)
if (TREE_CODE (last) == RETURN_EXPR if (TREE_CODE (last) == RETURN_EXPR
&& TREE_OPERAND (last, 0) == NULL) && TREE_OPERAND (last, 0) == NULL)
{ {
#ifdef USE_MAPPED_LOCATION
location = EXPR_LOCATION (last);
if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus;
warning ("%Hcontrol reaches end of non-void function", &location);
#else
locus = EXPR_LOCUS (last); locus = EXPR_LOCUS (last);
if (!locus) if (!locus)
locus = &cfun->function_end_locus; locus = &cfun->function_end_locus;
warning ("%Hcontrol reaches end of non-void function", locus); warning ("%Hcontrol reaches end of non-void function", locus);
#endif
break; break;
} }
} }
......
...@@ -126,7 +126,7 @@ get_lineno (tree expr) ...@@ -126,7 +126,7 @@ get_lineno (tree expr)
if (TREE_CODE (expr) == COMPOUND_EXPR) if (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 0); expr = TREE_OPERAND (expr, 0);
if (! EXPR_LOCUS (expr)) if (! EXPR_HAS_LOCATION (expr))
return -1; return -1;
return EXPR_LINENO (expr); return EXPR_LINENO (expr);
...@@ -137,14 +137,15 @@ get_lineno (tree expr) ...@@ -137,14 +137,15 @@ get_lineno (tree expr)
static inline const char * static inline const char *
get_filename (tree expr) get_filename (tree expr)
{ {
const char *filename;
if (expr == NULL_TREE) if (expr == NULL_TREE)
return "???"; return "???";
if (TREE_CODE (expr) == COMPOUND_EXPR) if (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 0); expr = TREE_OPERAND (expr, 0);
if (EXPR_LOCUS (expr) && EXPR_FILENAME (expr)) if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
return EXPR_FILENAME (expr); return filename;
else else
return "???"; return "???";
} }
......
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