summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 08:20:08 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 08:20:08 +0000
commit375c1c8af9bf76d2c619e056ff3d9c94e28039aa (patch)
tree9fd420c1917b17a0fa1e409f993e1a80d266278e /gcc
parente996e8f12337f7038e1ca36708a93b91a85e7adb (diff)
downloadgcc-375c1c8af9bf76d2c619e056ff3d9c94e28039aa.tar.gz
* config/alpha/alpha.c (alpha_output_mi_thunk_osf): Use
insn_locators_alloc instead of insn_locators_initialize; call reset_block_changes. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * config/sh/sh.c (sparc_output_mi_thunk): Likewise. * config/is64/ia64.c (ia64_output_mi_thunk): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/score/score.c (th_output_mi_thunk): Likewise. * config/mips/mips.c (mips_output_mi_thunk): Likewise. * cfglyaout.c (set_curr_insn_source_location, set_curr_insn_block): tolerate uninitialized locator info. Re-apply: * function.c (init_function_start): Don't init line number info. (expand_function_end): Update. (reset_block_changes, record_block_change, finalize_block_changes, check_block_change, free_block_changes): Kill. * function.h (reset_block_changes, record_block_change, finalize_block_changes, check_block_change, free_block_changes): Remove prototypes. (struct function): Remove ib_boundaries_block. * emit-rtl.c (make_insn_raw, make_jump_insn_raw, make_call_insn_raw): Use curr_insn_locator to initialize locator. (emit_line_note): Remove. * cfgexpand.c (expand_gimple_cond_expr): Update. (construct_exit_block): Likewise. (tree_expand_cfg): Initialize/finalize locators. * expr.c (expand_expr_real): Update. * cfglayout.c (line_locators_locs, line_locators_lines, file_locators_locs, file_locators_files): Remove. (set_block_levels): Move to cfgexpand.c. (insn_locators_initialize): Remove. (pass_insn_locators_initialize): Remove. (locations_locators_locs, locations_locators_vals): New static vars. (curr_location, last_location, curr_block, last_block, curr_rtl_loc): Likewise. (insn_locators_alloc, insn_locators_finalize, set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator): New functions. (locator_location): New. (locator_line, locator_file): Rewrite. * rtl.h (emit_line_note): Kill. (insn_locators_alloc, insn_locators_finalize, set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator): Declare. * tree-inline.c (initialize_cfun): Do not initialize ib_boundaries_block. * passes.c (pass_insn_locators_initialize): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124258 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog51
-rw-r--r--gcc/cfgexpand.c46
-rw-r--r--gcc/cfglayout.c255
-rw-r--r--gcc/config/alpha/alpha.c4
-rw-r--r--gcc/config/ia64/ia64.c3
-rw-r--r--gcc/config/m68k/m68k.c1
-rw-r--r--gcc/config/mips/mips.c3
-rw-r--r--gcc/config/rs6000/rs6000.c3
-rw-r--r--gcc/config/score/score.c3
-rw-r--r--gcc/config/sh/sh.c3
-rw-r--r--gcc/config/sparc/sparc.c3
-rw-r--r--gcc/emit-rtl.c42
-rw-r--r--gcc/expr.c6
-rw-r--r--gcc/function.c70
-rw-r--r--gcc/function.h8
-rw-r--r--gcc/passes.c1
-rw-r--r--gcc/rtl.h7
-rw-r--r--gcc/tree-inline.c1
-rw-r--r--gcc/tree-pass.h1
19 files changed, 219 insertions, 292 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8240b2ac234..682195135c5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,54 @@
+2007-04-28 Jan Hubicka <jh@suse.cz>
+
+ * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Use
+ insn_locators_alloc instead of insn_locators_initialize;
+ call reset_block_changes.
+ * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise.
+ * config/sh/sh.c (sparc_output_mi_thunk): Likewise.
+ * config/is64/ia64.c (ia64_output_mi_thunk): Likewise.
+ * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise.
+ * config/score/score.c (th_output_mi_thunk): Likewise.
+ * config/mips/mips.c (mips_output_mi_thunk): Likewise.
+ * cfglyaout.c (set_curr_insn_source_location, set_curr_insn_block):
+ tolerate uninitialized locator info.
+
+ Re-apply:
+ * function.c (init_function_start): Don't init line number info.
+ (expand_function_end): Update.
+ (reset_block_changes, record_block_change, finalize_block_changes,
+ check_block_change, free_block_changes): Kill.
+ * function.h (reset_block_changes, record_block_change,
+ finalize_block_changes, check_block_change, free_block_changes): Remove
+ prototypes.
+ (struct function): Remove ib_boundaries_block.
+ * emit-rtl.c (make_insn_raw, make_jump_insn_raw, make_call_insn_raw):
+ Use curr_insn_locator to initialize locator.
+ (emit_line_note): Remove.
+ * cfgexpand.c (expand_gimple_cond_expr): Update.
+ (construct_exit_block): Likewise.
+ (tree_expand_cfg): Initialize/finalize locators.
+ * expr.c (expand_expr_real): Update.
+ * cfglayout.c (line_locators_locs, line_locators_lines,
+ file_locators_locs, file_locators_files): Remove.
+ (set_block_levels): Move to cfgexpand.c.
+ (insn_locators_initialize): Remove.
+ (pass_insn_locators_initialize): Remove.
+ (locations_locators_locs, locations_locators_vals): New static vars.
+ (curr_location, last_location, curr_block, last_block, curr_rtl_loc):
+ Likewise.
+ (insn_locators_alloc, insn_locators_finalize,
+ set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator):
+ New functions.
+ (locator_location): New.
+ (locator_line, locator_file): Rewrite.
+ * rtl.h (emit_line_note): Kill.
+ (insn_locators_alloc, insn_locators_finalize,
+ set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator):
+ Declare.
+ * tree-inline.c (initialize_cfun): Do not initialize
+ ib_boundaries_block.
+ * passes.c (pass_insn_locators_initialize): Remove.
+
2007-04-28 Zdenek Dvorak <dvorakz@suse.cz>
* tree-cfg.c (move_block_to_fn): Release bb from dominance
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 643ff207108..c8d446f12bd 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1297,8 +1297,8 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
if (EXPR_LOCUS (stmt))
{
- emit_line_note (*(EXPR_LOCUS (stmt)));
- record_block_change (TREE_BLOCK (stmt));
+ set_curr_insn_source_location (*(EXPR_LOCUS (stmt)));
+ set_curr_insn_block (TREE_BLOCK (stmt));
}
/* These flags have no purpose in RTL land. */
@@ -1313,7 +1313,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
add_reg_br_prob_note (last, true_edge->probability);
maybe_dump_rtl_for_tree_stmt (stmt, last);
if (true_edge->goto_locus)
- emit_line_note (*true_edge->goto_locus);
+ set_curr_insn_source_location (*true_edge->goto_locus);
false_edge->flags |= EDGE_FALLTHRU;
return NULL;
}
@@ -1323,7 +1323,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
add_reg_br_prob_note (last, false_edge->probability);
maybe_dump_rtl_for_tree_stmt (stmt, last);
if (false_edge->goto_locus)
- emit_line_note (*false_edge->goto_locus);
+ set_curr_insn_source_location (*false_edge->goto_locus);
true_edge->flags |= EDGE_FALLTHRU;
return NULL;
}
@@ -1354,7 +1354,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
maybe_dump_rtl_for_tree_stmt (stmt, last2);
if (false_edge->goto_locus)
- emit_line_note (*false_edge->goto_locus);
+ set_curr_insn_source_location (*false_edge->goto_locus);
return new_bb;
}
@@ -1608,7 +1608,7 @@ expand_gimple_basic_block (basic_block bb)
{
emit_jump (label_rtx_for_bb (e->dest));
if (e->goto_locus)
- emit_line_note (*e->goto_locus);
+ set_curr_insn_source_location (*e->goto_locus);
e->flags &= ~EDGE_FALLTHRU;
}
@@ -1679,6 +1679,19 @@ construct_init_block (void)
return init_block;
}
+/* For each lexical block, set BLOCK_NUMBER to the depth at which it is
+ found in the block tree. */
+
+static void
+set_block_levels (tree block, int level)
+{
+ while (block)
+ {
+ BLOCK_NUMBER (block) = level;
+ set_block_levels (BLOCK_SUBBLOCKS (block), level + 1);
+ block = BLOCK_CHAIN (block);
+ }
+}
/* Create a block containing landing pads and similar stuff. */
@@ -1703,7 +1716,7 @@ construct_exit_block (void)
input_location = cfun->function_end_locus;
/* The following insns belong to the top scope. */
- record_block_change (DECL_INITIAL (current_function_decl));
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
/* Generate rtl for function exit. */
expand_function_end ();
@@ -1831,8 +1844,16 @@ tree_expand_cfg (void)
/* Some backends want to know that we are expanding to RTL. */
currently_expanding_to_rtl = 1;
- /* Prepare the rtl middle end to start recording block changes. */
- reset_block_changes ();
+ insn_locators_alloc ();
+ if (!DECL_BUILT_IN (current_function_decl))
+ set_curr_insn_source_location (DECL_SOURCE_LOCATION (current_function_decl));
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
+ prologue_locator = curr_insn_locator ();
+
+ /* Make sure first insn is a note even if we don't want linenums.
+ This makes sure the first insn will never be deleted.
+ Also, final expects a note to appear there. */
+ emit_note (NOTE_INSN_DELETED);
/* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */
discover_nonconstant_array_refs ();
@@ -1879,6 +1900,8 @@ tree_expand_cfg (void)
bb = expand_gimple_basic_block (bb);
construct_exit_block ();
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
+ insn_locators_finalize ();
/* We're done expanding trees to RTL. */
currently_expanding_to_rtl = 0;
@@ -1909,8 +1932,6 @@ tree_expand_cfg (void)
more CONCATs anywhere. */
generating_concat_p = 0;
- finalize_block_changes ();
-
if (dump_file)
{
fprintf (dump_file,
@@ -1941,6 +1962,9 @@ tree_expand_cfg (void)
return_label = NULL;
naked_return_label = NULL;
free_histograms ();
+ /* Tag the blocks with a depth number so that change_scope can find
+ the common parent easily. */
+ set_block_levels (DECL_INITIAL (cfun->decl), 0);
return 0;
}
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 01784319c19..b40695fa306 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -48,7 +48,6 @@ static void record_effective_endpoints (void);
static rtx label_for_bb (basic_block);
static void fixup_reorder_chain (void);
-static void set_block_levels (tree, int);
static void change_scope (rtx, tree, tree);
void verify_insn_chain (void);
@@ -232,120 +231,111 @@ record_effective_endpoints (void)
than the following one. Similarly for the other properties. */
static VEC(int,heap) *block_locators_locs;
static GTY(()) VEC(tree,gc) *block_locators_blocks;
-static VEC(int,heap) *line_locators_locs;
-static VEC(int,heap) *line_locators_lines;
-static VEC(int,heap) *file_locators_locs;
-static GTY(()) varray_type file_locators_files;
+static VEC(int,heap) *locations_locators_locs;
+DEF_VEC_O(location_t);
+DEF_VEC_ALLOC_O(location_t,heap);
+static VEC(location_t,heap) *locations_locators_vals;
int prologue_locator;
int epilogue_locator;
-/* During the RTL expansion the lexical blocks and line numbers are
- represented via INSN_NOTEs. Replace them by representation using
- INSN_LOCATORs. */
+/* Hold current location information and last location information, so the
+ datastructures are built lazilly only when some instructions in given
+ place are needed. */
+location_t curr_location, last_location;
+static tree curr_block, last_block;
+static int curr_rtl_loc = -1;
-unsigned int
-insn_locators_initialize (void)
+/* Allocate insn locator datastructure. */
+void
+insn_locators_alloc (void)
{
- tree block = NULL;
- tree last_block = NULL;
- rtx insn, next;
- int loc = 0;
- int line_number = 0, last_line_number = 0;
- const char *file_name = NULL, *last_file_name = NULL;
-
prologue_locator = epilogue_locator = 0;
block_locators_locs = VEC_alloc (int, heap, 32);
block_locators_blocks = VEC_alloc (tree, gc, 32);
- line_locators_locs = VEC_alloc (int, heap, 32);
- line_locators_lines = VEC_alloc (int, heap, 32);
- file_locators_locs = VEC_alloc (int, heap, 32);
- VARRAY_CHAR_PTR_INIT (file_locators_files, 32, "file_locators_files");
-
- for (insn = get_insns (); insn; insn = next)
- {
- int active = 0;
-
- next = NEXT_INSN (insn);
-
- if (NOTE_P (insn))
- {
- gcc_assert (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_BEG
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END);
- if (NOTE_LINE_NUMBER (insn) > 0)
- {
- expanded_location xloc;
- NOTE_EXPANDED_LOCATION (xloc, insn);
- line_number = xloc.line;
- file_name = xloc.file;
- delete_insn (insn);
- }
- }
- else
- active = (active_insn_p (insn)
- && GET_CODE (PATTERN (insn)) != ADDR_VEC
- && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC);
-
- check_block_change (insn, &block);
+ locations_locators_locs = VEC_alloc (int, heap, 32);
+ locations_locators_vals = VEC_alloc (location_t, heap, 32);
+
+#ifdef USE_MAPPED_LOCATION
+ last_location = -1;
+ curr_location = -1;
+#else
+ last_location.line = -1;
+ curr_location.line = -1;
+#endif
+ curr_block = NULL;
+ last_block = NULL;
+ curr_rtl_loc = 0;
+}
- if (active
- || !next
- || (!prologue_locator && file_name))
- {
- if (last_block != block)
- {
- loc++;
- VEC_safe_push (int, heap, block_locators_locs, loc);
- VEC_safe_push (tree, gc, block_locators_blocks, block);
- last_block = block;
- }
- if (last_line_number != line_number)
- {
- loc++;
- VEC_safe_push (int, heap, line_locators_locs, loc);
- VEC_safe_push (int, heap, line_locators_lines, line_number);
- last_line_number = line_number;
- }
- if (last_file_name != file_name)
- {
- loc++;
- VEC_safe_push (int, heap, file_locators_locs, loc);
- VARRAY_PUSH_CHAR_PTR (file_locators_files, (char *) file_name);
- last_file_name = file_name;
- }
- if (!prologue_locator && file_name)
- prologue_locator = loc;
- if (!next)
- epilogue_locator = loc;
- if (active)
- INSN_LOCATOR (insn) = loc;
- }
- }
+/* At the end of emit stage, clear current location. */
+void
+insn_locators_finalize (void)
+{
+ if (curr_rtl_loc >= 0)
+ epilogue_locator = curr_insn_locator ();
+ curr_rtl_loc = -1;
+}
- /* Tag the blocks with a depth number so that change_scope can find
- the common parent easily. */
- set_block_levels (DECL_INITIAL (cfun->decl), 0);
+/* Set current location. */
+void
+set_curr_insn_source_location (location_t location)
+{
+ /* IV opts calls into RTL expansion to compute costs of operations. At this
+ time locators are not initialized. */
+ if (curr_rtl_loc == -1)
+ return;
+#ifdef USE_MAPPED_LOCATION
+ if (location == last_location)
+ return;
+#else
+ if (location.file && last_location.file
+ && !strcmp (location.file, last_location.file)
+ && location.line == last_location.line)
+ return;
+#endif
+ curr_location = location;
+}
- free_block_changes ();
- return 0;
+/* Set current scope block. */
+void
+set_curr_insn_block (tree b)
+{
+ /* IV opts calls into RTL expansion to compute costs of operations. At this
+ time locators are not initialized. */
+ if (curr_rtl_loc == -1)
+ return;
+ if (b)
+ curr_block = b;
}
-struct tree_opt_pass pass_insn_locators_initialize =
+/* Return current insn locator. */
+int
+curr_insn_locator (void)
{
- "locators", /* name */
- NULL, /* gate */
- insn_locators_initialize, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- 0, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func, /* todo_flags_finish */
- 0 /* letter */
-};
+ if (curr_rtl_loc == -1)
+ return 0;
+ if (last_block != curr_block)
+ {
+ curr_rtl_loc++;
+ VEC_safe_push (int, heap, block_locators_locs, curr_rtl_loc);
+ VEC_safe_push (tree, gc, block_locators_blocks, curr_block);
+ last_block = curr_block;
+ }
+#ifdef USE_MAPPED_LOCATION
+ if (last_location != curr_location)
+#else
+ if (last_location.file != curr_location.file
+ || last_location.line != curr_location.line)
+#endif
+ {
+ curr_rtl_loc++;
+ VEC_safe_push (int, heap, locations_locators_locs, curr_rtl_loc);
+ VEC_safe_push (location_t, heap, locations_locators_vals, &curr_location);
+ last_location = curr_location;
+ }
+ return curr_rtl_loc;
+}
static unsigned int
into_cfg_layout_mode (void)
@@ -401,20 +391,6 @@ struct tree_opt_pass pass_outof_cfg_layout_mode =
TODO_dump_func, /* todo_flags_finish */
0 /* letter */
};
-
-/* For each lexical block, set BLOCK_NUMBER to the depth at which it is
- found in the block tree. */
-
-static void
-set_block_levels (tree block, int level)
-{
- while (block)
- {
- BLOCK_NUMBER (block) = level;
- set_block_levels (BLOCK_SUBBLOCKS (block), level + 1);
- block = BLOCK_CHAIN (block);
- }
-}
/* Return sope resulting from combination of S1 and S2. */
static tree
@@ -514,18 +490,16 @@ insn_scope (rtx insn)
}
/* Return line number of the statement specified by the locator. */
-int
-locator_line (int loc)
+static location_t
+locator_location (int loc)
{
- int max = VEC_length (int, line_locators_locs);
+ int max = VEC_length (int, locations_locators_locs);
int min = 0;
- if (!max || !loc)
- return 0;
while (1)
{
int pos = (min + max) / 2;
- int tmp = VEC_index (int, line_locators_locs, pos);
+ int tmp = VEC_index (int, locations_locators_locs, pos);
if (tmp <= loc && min != pos)
min = pos;
@@ -537,7 +511,19 @@ locator_line (int loc)
break;
}
}
- return VEC_index (int, line_locators_lines, min);
+ return *VEC_index (location_t, locations_locators_vals, min);
+}
+
+/* Return source line of the statement that produced this insn. */
+int
+locator_line (int loc)
+{
+ expanded_location xloc;
+ if (!loc)
+ return 0;
+ else
+ xloc = expand_location (locator_location (loc));
+ return xloc.line;
}
/* Return line number of the statement that produced this insn. */
@@ -551,27 +537,12 @@ insn_line (rtx insn)
const char *
locator_file (int loc)
{
- int max = VEC_length (int, file_locators_locs);
- int min = 0;
-
- if (!max || !loc)
- return NULL;
- while (1)
- {
- int pos = (min + max) / 2;
- int tmp = VEC_index (int, file_locators_locs, pos);
-
- if (tmp <= loc && min != pos)
- min = pos;
- else if (tmp > loc && max != pos)
- max = pos;
- else
- {
- min = pos;
- break;
- }
- }
- return VARRAY_CHAR_PTR (file_locators_files, min);
+ expanded_location xloc;
+ if (!loc)
+ return 0;
+ else
+ xloc = expand_location (locator_location (loc));
+ return xloc.file;
}
/* Return source file of the statement that produced this insn. */
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 32bb92c89d0..55d35a45f59 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -8264,8 +8264,6 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT hi, lo;
rtx this, insn, funexp;
- reset_block_changes ();
-
/* We always require a valid GP. */
emit_insn (gen_prologue_ldgp ());
emit_note (NOTE_INSN_PROLOGUE_END);
@@ -8342,7 +8340,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
insn = get_insns ();
- insn_locators_initialize ();
+ insn_locators_alloc ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 2bbd6819f7b..87056ddcc54 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9370,7 +9370,6 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
reload_completed = 1;
epilogue_completed = 1;
no_new_pseudos = 1;
- reset_block_changes ();
/* Set things up as ia64_expand_prologue might. */
last_scratch_gr_reg = 15;
@@ -9485,7 +9484,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
- insn_locators_initialize ();
+ insn_locators_alloc ();
emit_all_insn_group_barriers (NULL);
insn = get_insns ();
shorten_branches (insn);
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 2df2a7c8904..f975e06fea9 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -4112,7 +4112,6 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
/* Pretend to be a post-reload pass while generating rtl. */
no_new_pseudos = 1;
reload_completed = 1;
- reset_block_changes ();
allocate_reg_info (FIRST_PSEUDO_REGISTER, true, true);
/* The "this" pointer is stored at 4(%sp). */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5b3b10de435..55bacf7bb19 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -7172,7 +7172,6 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Pretend to be a post-reload pass while generating rtl. */
no_new_pseudos = 1;
reload_completed = 1;
- reset_block_changes ();
/* Pick a global pointer. Use a call-clobbered register if
TARGET_CALL_SAVED_GP, so that we can use a sibcall. */
@@ -7258,7 +7257,7 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Run just enough of rest_of_compilation. This sequence was
"borrowed" from alpha.c. */
insn = get_insns ();
- insn_locators_initialize ();
+ insn_locators_alloc ();
split_all_insns_noflow ();
if (TARGET_MIPS16)
mips16_lay_out_constants ();
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9172e28de04..acbc7080aa2 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16039,7 +16039,6 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
reload_completed = 1;
epilogue_completed = 1;
no_new_pseudos = 1;
- reset_block_changes ();
/* Mark the end of the (empty) prologue. */
emit_note (NOTE_INSN_PROLOGUE_END);
@@ -16119,7 +16118,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
insn = get_insns ();
- insn_locators_initialize ();
+ insn_locators_alloc ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index 34352a67e4d..9fc179e1534 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -183,7 +183,6 @@ th_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Pretend to be a post-reload pass while generating rtl. */
no_new_pseudos = 1;
reload_completed = 1;
- reset_block_changes ();
/* We need two temporary registers in some cases. */
temp1 = gen_rtx_REG (Pmode, 8);
@@ -231,7 +230,7 @@ th_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Run just enough of rest_of_compilation. This sequence was
"borrowed" from alpha.c. */
insn = get_insns ();
- insn_locators_initialize ();
+ insn_locators_alloc ();
split_all_insns_noflow ();
shorten_branches (insn);
final_start_function (insn, file, 1);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index ffa25095eb4..ab9ea90232b 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -10167,7 +10167,6 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
epilogue_completed = 1;
no_new_pseudos = 1;
current_function_uses_only_leaf_regs = 1;
- reset_block_changes ();
emit_note (NOTE_INSN_PROLOGUE_END);
@@ -10324,7 +10323,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
the insns emitted. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
- insn_locators_initialize ();
+ insn_locators_alloc ();
insns = get_insns ();
if (optimize > 0)
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 9b881e1176d..be07ce7d3d0 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -8546,7 +8546,6 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
reload_completed = 1;
epilogue_completed = 1;
no_new_pseudos = 1;
- reset_block_changes ();
emit_note (NOTE_INSN_PROLOGUE_END);
@@ -8724,7 +8723,7 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
insn = get_insns ();
- insn_locators_initialize ();
+ insn_locators_alloc ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 16fa6c5ed7c..e816026a3d4 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3336,7 +3336,7 @@ make_insn_raw (rtx pattern)
INSN_CODE (insn) = -1;
LOG_LINKS (insn) = NULL;
REG_NOTES (insn) = NULL;
- INSN_LOCATOR (insn) = 0;
+ INSN_LOCATOR (insn) = curr_insn_locator ();
BLOCK_FOR_INSN (insn) = NULL;
#ifdef ENABLE_RTL_CHECKING
@@ -3369,7 +3369,7 @@ make_jump_insn_raw (rtx pattern)
LOG_LINKS (insn) = NULL;
REG_NOTES (insn) = NULL;
JUMP_LABEL (insn) = NULL;
- INSN_LOCATOR (insn) = 0;
+ INSN_LOCATOR (insn) = curr_insn_locator ();
BLOCK_FOR_INSN (insn) = NULL;
return insn;
@@ -3390,7 +3390,7 @@ make_call_insn_raw (rtx pattern)
LOG_LINKS (insn) = NULL;
REG_NOTES (insn) = NULL;
CALL_INSN_FUNCTION_USAGE (insn) = NULL;
- INSN_LOCATOR (insn) = 0;
+ INSN_LOCATOR (insn) = curr_insn_locator ();
BLOCK_FOR_INSN (insn) = NULL;
return insn;
@@ -4460,42 +4460,6 @@ emit_barrier (void)
return barrier;
}
-/* Make line numbering NOTE insn for LOCATION add it to the end
- of the doubly-linked list, but only if line-numbers are desired for
- debugging info and it doesn't match the previous one. */
-
-rtx
-emit_line_note (location_t location)
-{
- rtx note;
-
-#ifdef USE_MAPPED_LOCATION
- if (location == last_location)
- return NULL_RTX;
-#else
- if (location.file && last_location.file
- && !strcmp (location.file, last_location.file)
- && location.line == last_location.line)
- return NULL_RTX;
-#endif
- last_location = location;
-
- if (no_line_numbers)
- {
- cur_insn_uid++;
- return NULL_RTX;
- }
-
-#ifdef USE_MAPPED_LOCATION
- note = emit_note ((int) location);
-#else
- note = emit_note (location.line);
- NOTE_SOURCE_FILE (note) = location.file;
-#endif
-
- return note;
-}
-
/* Emit a copy of note ORIG. */
rtx
diff --git a/gcc/expr.c b/gcc/expr.c
index 34cc0aa6553..e8630f5cc86 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6777,14 +6777,14 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
information. It would be better of the diagnostic routines
used the file/line information embedded in the tree nodes rather
than globals. */
- if (cfun && cfun->ib_boundaries_block && EXPR_HAS_LOCATION (exp))
+ if (cfun && EXPR_HAS_LOCATION (exp))
{
location_t saved_location = input_location;
input_location = EXPR_LOCATION (exp);
- emit_line_note (input_location);
+ set_curr_insn_source_location (input_location);
/* Record where the insns produced belong. */
- record_block_change (TREE_BLOCK (exp));
+ set_curr_insn_block (TREE_BLOCK (exp));
ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl);
diff --git a/gcc/function.c b/gcc/function.c
index f0a2dd61392..70047939501 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3843,18 +3843,6 @@ init_function_start (tree subr)
{
prepare_function_start (subr);
- /* Prevent ever trying to delete the first instruction of a
- function. Also tell final how to output a linenum before the
- function prologue. Note linenums could be missing, e.g. when
- compiling a Java .class file. */
- if (! DECL_IS_BUILTIN (subr))
- emit_line_note (DECL_SOURCE_LOCATION (subr));
-
- /* Make sure first insn is a note even if we don't want linenums.
- This makes sure the first insn will never be deleted.
- Also, final expects a note to appear there. */
- emit_note (NOTE_INSN_DELETED);
-
/* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */
if (AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
@@ -4305,7 +4293,7 @@ expand_function_end (void)
/* Output a linenumber for the end of the function.
SDB depends on this. */
force_next_line_note ();
- emit_line_note (input_location);
+ set_curr_insn_source_location (input_location);
/* Before the return label (if any), clobber the return
registers so that they are not propagated live to the rest of
@@ -5348,62 +5336,6 @@ reposition_prologue_and_epilogue_notes (rtx f ATTRIBUTE_UNUSED)
#endif /* HAVE_prologue or HAVE_epilogue */
}
-/* Resets insn_block_boundaries array. */
-
-void
-reset_block_changes (void)
-{
- cfun->ib_boundaries_block = VEC_alloc (tree, gc, 100);
- VEC_quick_push (tree, cfun->ib_boundaries_block, NULL_TREE);
-}
-
-/* Record the boundary for BLOCK. */
-void
-record_block_change (tree block)
-{
- int i, n;
- tree last_block;
-
- if (!block)
- return;
-
- if(!cfun->ib_boundaries_block)
- return;
-
- last_block = VEC_pop (tree, cfun->ib_boundaries_block);
- n = get_max_uid ();
- for (i = VEC_length (tree, cfun->ib_boundaries_block); i < n; i++)
- VEC_safe_push (tree, gc, cfun->ib_boundaries_block, last_block);
-
- VEC_safe_push (tree, gc, cfun->ib_boundaries_block, block);
-}
-
-/* Finishes record of boundaries. */
-void
-finalize_block_changes (void)
-{
- record_block_change (DECL_INITIAL (current_function_decl));
-}
-
-/* For INSN return the BLOCK it belongs to. */
-void
-check_block_change (rtx insn, tree *block)
-{
- unsigned uid = INSN_UID (insn);
-
- if (uid >= VEC_length (tree, cfun->ib_boundaries_block))
- return;
-
- *block = VEC_index (tree, cfun->ib_boundaries_block, uid);
-}
-
-/* Releases the ib_boundaries_block records. */
-void
-free_block_changes (void)
-{
- VEC_free (tree, gc, cfun->ib_boundaries_block);
-}
-
/* Returns the name of the current function. */
const char *
current_function_name (void)
diff --git a/gcc/function.h b/gcc/function.h
index f176d85398f..a5afd1b8ddd 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -347,9 +347,6 @@ struct function GTY(())
/* Line number of the end of the function. */
location_t function_end_locus;
- /* Array mapping insn uids to blocks. */
- VEC(tree,gc) *ib_boundaries_block;
-
/* The variables unexpanded so far. */
tree unexpanded_var_list;
@@ -552,11 +549,6 @@ extern void number_blocks (tree);
extern void clear_block_marks (tree);
extern tree blocks_nreverse (tree);
-extern void reset_block_changes (void);
-extern void record_block_change (tree);
-extern void finalize_block_changes (void);
-extern void check_block_change (rtx, tree *);
-extern void free_block_changes (void);
/* Return size needed for stack frame based on slots so far allocated.
This size counts from zero. It is not rounded to STACK_BOUNDARY;
diff --git a/gcc/passes.c b/gcc/passes.c
index 11b11981fdd..9650e894cd6 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -654,7 +654,6 @@ init_optimization_passes (void)
struct tree_opt_pass **p = &pass_rest_of_compilation.sub;
NEXT_PASS (pass_init_function);
NEXT_PASS (pass_jump);
- NEXT_PASS (pass_insn_locators_initialize);
NEXT_PASS (pass_rtl_eh);
NEXT_PASS (pass_initial_value_sets);
NEXT_PASS (pass_unshare_all_rtl);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 81ed8bc8659..2ba7c8a471d 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1562,7 +1562,6 @@ extern rtx emit_label (rtx);
extern rtx emit_barrier (void);
extern rtx emit_note (int);
extern rtx emit_note_copy (rtx);
-extern rtx emit_line_note (location_t);
extern rtx make_insn_raw (rtx);
extern rtx make_jump_insn_raw (rtx);
extern void add_function_usage_to (rtx, rtx);
@@ -2298,4 +2297,10 @@ extern const struct rtl_hooks general_rtl_hooks;
/* Keep this for the nonce. */
#define gen_lowpart rtl_hooks.gen_lowpart
+extern void insn_locators_alloc (void);
+extern void insn_locators_finalize (void);
+extern void set_curr_insn_source_location (location_t);
+extern void set_curr_insn_block (tree);
+extern int curr_insn_locator (void);
+
#endif /* ! GCC_RTL_H */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ba8a71eeb87..a6dfc683d59 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1117,7 +1117,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count,
new_cfun->unexpanded_var_list = NULL;
new_cfun->cfg = NULL;
new_cfun->decl = new_fndecl /*= copy_node (callee_fndecl)*/;
- new_cfun->ib_boundaries_block = NULL;
DECL_STRUCT_FUNCTION (new_fndecl) = new_cfun;
push_cfun (new_cfun);
init_empty_tree_cfg ();
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index c22e15e8a9d..b77243582b6 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -332,7 +332,6 @@ extern struct tree_opt_pass pass_fixup_cfg;
extern struct tree_opt_pass pass_init_function;
extern struct tree_opt_pass pass_jump;
-extern struct tree_opt_pass pass_insn_locators_initialize;
extern struct tree_opt_pass pass_rtl_eh;
extern struct tree_opt_pass pass_initial_value_sets;
extern struct tree_opt_pass pass_unshare_all_rtl;