summaryrefslogtreecommitdiffstats
path: root/gcc/dce.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-17 05:57:04 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-17 05:57:04 +0000
commit1e5b92fa15f6677249b1fc9e240955537ae33bd2 (patch)
tree8e1097fff4f927ebe993aa6e075eafcfd576b7bf /gcc/dce.c
parenteef5de2707b8cf19f2fbd51990b3f384c6a63cef (diff)
downloadppe42-gcc-1e5b92fa15f6677249b1fc9e240955537ae33bd2.tar.gz
ppe42-gcc-1e5b92fa15f6677249b1fc9e240955537ae33bd2.zip
Remove libcall notes.
* see.c (see_analyse_one_def): Do not look for REG_LIBCALL and REG_RETVAL notes. (see_update_relevancy): Likewise. * fwprop.c (try_fwprop_subst): Likewise. * rtlanal.c (noop_move_p): Likewise. * builtins.c (expand_buitlin_mathfn): Don't try to add REG_EQUAL notes to non-existing libcall blocks. * cse.c (cse_insn): Change prototype. Don't update libcall notes. Remove orig_set. (cse_extended_basic_block): Don't track libcall and no-conflict notes. (dead_libcall_p): Remove. (delete_trivially_dead_insns): Don't use it. * web.c (union_defs): Remove comment about keeping nops. * gcse.c (hash_scan_insn): Don't take libcall pointers. (compute_hash_table_work): Don't track libcall notes. (do_local_cprop): Don't take libcall pointers. Don't update libcall notes. (adjust_libcall_notes): Deleted. (local_cprop_pass): Remove stack for nested libcalls (which shouldn't ever have existed in the first place). (replace_store_insn): Don't try to remove libcall notes. * lower-subreg.c (move_libcall_note, move_retval_note): Deleted. (resolve_reg_notes): Don't call them. (resolve_simple_move): Likewise. (decompose_multiword_subregs): Remove block handling REG_RETVAL notes. Don't remove REG_RETVAL notes. * emit-rtl.c (try_split): Don't update libcall notes. (emit_copy_of_insn_after): Dito. * cselib.c (cselib_current_insn_in_libcall): Remove. (cselib_process_insn): Don't set/clear it. (new_elt_loc_list): Don't record it. (cselib_init): Don't initialize it. * cselib.c (struct elt_loc_list): Remove in_libcall field. * loop-invariant.c (find_invariant_insn): Don't look for libcall notes. * sched-deps.c (sched_analyze_insn): Don't group libcall blocks. (sched_analyze): Don't set up deps->libcall_block_tail_insn. (init_deps): Don't initialize it. * sched-int.h (struct deps): Rremove libcall_block_tail_insn field. * combine.c (delete_noop_moves): Don't update libcall notes. (can_combine_p): Remove now pointless #if 0 block. (try_combine): Remove another obsolete #if 0 block. (distribute_notes): Don't distribute libcall notes. * reg-notes.def (REG_LIBCALL, REG_RETVAL): Remove. * dce.c (libcall_dead_p): Remove. (delete_unmarked_insns): Don't handle libcall blocks. (preserve_libcall_for_dce): Remove. (prescan_insns_for_dce): Don't special-case libcall block insns. * reload1 (reload): Don't handle libcall notes. * doc/rtl.texi (REG_LIBCALL, REG_RETVAL, REG_LIBCALL_ID): Remove documentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136861 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dce.c')
-rw-r--r--gcc/dce.c152
1 files changed, 1 insertions, 151 deletions
diff --git a/gcc/dce.c b/gcc/dce.c
index 91cc9aa5c28..b75a8b1b113 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -214,62 +214,6 @@ mark_nonreg_stores (rtx body, rtx insn, bool fast)
}
-/* Return true if the entire libcall sequence starting at INSN is dead.
- NOTE is the REG_LIBCALL note attached to INSN.
-
- A libcall sequence is a block of insns with no side-effects, i.e.
- that is only used for its return value. The terminology derives
- from that of a call, but a libcall sequence need not contain one.
- It is only defined by a pair of REG_LIBCALL/REG_RETVAL notes.
-
- From a dataflow viewpoint, a libcall sequence has the property that
- no UD chain can enter it from the outside. As a consequence, if a
- libcall sequence has a dead return value, it is effectively dead.
- This is both enforced by CSE (cse_extended_basic_block) and relied
- upon by delete_trivially_dead_insns.
-
- However, in practice, the return value business is a tricky one and
- only checking the liveness of the last insn is not sufficient to
- decide whether the whole sequence is dead (e.g. PR middle-end/19551)
- so we check the liveness of every insn starting from the call. */
-
-static bool
-libcall_dead_p (rtx insn, rtx note)
-{
- rtx last = XEXP (note, 0);
-
- /* Find the call insn. */
- while (insn != last && !CALL_P (insn))
- insn = NEXT_INSN (insn);
-
- /* If there is none, do nothing special, since ordinary death handling
- can understand these insns. */
- if (!CALL_P (insn))
- return false;
-
- /* If this is a call that returns a value via an invisible pointer, the
- dataflow engine cannot see it so it has been marked unconditionally.
- Skip it unless it has been made the last insn in the libcall, for
- example by the combiner, in which case we're left with no easy way
- of asserting its liveness. */
- if (!single_set (insn))
- {
- if (insn == last)
- return false;
- insn = NEXT_INSN (insn);
- }
-
- while (insn != NEXT_INSN (last))
- {
- if (INSN_P (insn) && marked_insn_p (insn))
- return false;
- insn = NEXT_INSN (insn);
- }
-
- return true;
-}
-
-
/* Delete all REG_EQUAL notes of the registers INSN writes, to prevent
bad dangling REG_EQUAL notes. */
@@ -316,29 +260,10 @@ delete_unmarked_insns (void)
FOR_BB_INSNS_SAFE (bb, insn, next)
if (INSN_P (insn))
{
- rtx note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
-
/* Always delete no-op moves. */
if (noop_move_p (insn))
;
- /* Try to delete libcall sequences as a whole. */
- else if (note && libcall_dead_p (insn, note))
- {
- rtx last = XEXP (note, 0);
-
- if (!dbg_cnt (dce))
- continue;
-
- if (dump_file)
- fprintf (dump_file, "DCE: Deleting libcall %d-%d\n",
- INSN_UID (insn), INSN_UID (last));
-
- next = NEXT_INSN (last);
- delete_insn_chain_and_edges (insn, last);
- continue;
- }
-
/* Otherwise rely only on the DCE algorithm. */
else if (marked_insn_p (insn))
continue;
@@ -353,41 +278,6 @@ delete_unmarked_insns (void)
for the destination regs in order to avoid dangling notes. */
delete_corresponding_reg_eq_notes (insn);
- /* If we're about to delete the first insn of a libcall, then
- move the REG_LIBCALL note to the next real insn and update
- the REG_RETVAL note. */
- if (note && (XEXP (note, 0) != insn))
- {
- rtx new_libcall_insn = next_real_insn (insn);
- rtx retval_note = find_reg_note (XEXP (note, 0),
- REG_RETVAL, NULL_RTX);
- /* If the RETVAL and LIBCALL notes would land on the same
- insn just remove them. */
- if (XEXP (note, 0) == new_libcall_insn)
- remove_note (new_libcall_insn, retval_note);
- else
- {
- REG_NOTES (new_libcall_insn)
- = gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0),
- REG_NOTES (new_libcall_insn));
- XEXP (retval_note, 0) = new_libcall_insn;
- }
- }
-
- /* If the insn contains a REG_RETVAL note and is dead, but the
- libcall as a whole is not dead, then we want to remove the
- insn, but not the whole libcall sequence. However, we also
- need to remove the dangling REG_LIBCALL note in order to
- avoid mismatched notes. We could find a new location for
- the REG_RETVAL note, but it hardly seems worth the effort. */
- note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
- if (note && (XEXP (note, 0) != insn))
- {
- rtx libcall_note
- = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL_RTX);
- remove_note (XEXP (note, 0), libcall_note);
- }
-
/* If a pure or const call is deleted, this may make the cfg
have unreachable blocks. We rememeber this and call
delete_unreachable_blocks at the end. */
@@ -404,43 +294,6 @@ delete_unmarked_insns (void)
}
-/* Helper function for prescan_insns_for_dce: prescan the entire libcall
- sequence starting at INSN and return the insn following the libcall.
- NOTE is the REG_LIBCALL note attached to INSN. */
-
-static rtx
-prescan_libcall_for_dce (rtx insn, rtx note, bool fast)
-{
- rtx last = XEXP (note, 0);
-
- /* A libcall is never necessary on its own but we need to mark the stores
- to a non-register destination. */
- while (insn != last && !CALL_P (insn))
- {
- if (INSN_P (insn))
- mark_nonreg_stores (PATTERN (insn), insn, fast);
- insn = NEXT_INSN (insn);
- }
-
- /* If this is a call that returns a value via an invisible pointer, the
- dataflow engine cannot see it so it has to be marked unconditionally. */
- if (CALL_P (insn) && !single_set (insn))
- {
- mark_insn (insn, fast);
- insn = NEXT_INSN (insn);
- }
-
- while (insn != NEXT_INSN (last))
- {
- if (INSN_P (insn))
- mark_nonreg_stores (PATTERN (insn), insn, fast);
- insn = NEXT_INSN (insn);
- }
-
- return insn;
-}
-
-
/* Go through the instructions and mark those whose necessity is not
dependent on inter-instruction information. Make sure all other
instructions are not marked. */
@@ -458,10 +311,7 @@ prescan_insns_for_dce (bool fast)
FOR_BB_INSNS_SAFE (bb, insn, next)
if (INSN_P (insn))
{
- rtx note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
- if (note)
- next = prescan_libcall_for_dce (insn, note, fast);
- else if (deletable_insn_p (insn, fast))
+ if (deletable_insn_p (insn, fast))
mark_nonreg_stores (PATTERN (insn), insn, fast);
else
mark_insn (insn, fast);
OpenPOWER on IntegriCloud