aboutsummaryrefslogtreecommitdiff
path: root/gcc/dse.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2011-02-03 06:04:04 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2011-02-03 06:04:04 +0000
commit4deef538ecda16acd4c0ae3d3ed71c591603ce73 (patch)
tree1064817b077534a9d4c8d69e161ab2fcd975a017 /gcc/dse.c
parent1551d44aba2deeb55393396502ca091e41bcfee3 (diff)
downloadgcc-4deef538ecda16acd4c0ae3d3ed71c591603ce73.zip
gcc-4deef538ecda16acd4c0ae3d3ed71c591603ce73.tar.gz
gcc-4deef538ecda16acd4c0ae3d3ed71c591603ce73.tar.bz2
re PR debug/43092 (Wrong debuginfo with VTA and -fomit-frame-pointer/-mno-accumulate-outgoing-args)
PR debug/43092 PR rtl-optimization/43494 * rtl.h (for_each_inc_dec_fn): New type. (for_each_inc_dec): Declare. * rtlanal.c (struct for_each_inc_dec_ops): New type. (for_each_inc_dec_find_inc_dec): New fn. (for_each_inc_dec_find_mem): New fn. (for_each_inc_dec): New fn. * dse.c (struct insn_size): Remove. (replace_inc_dec, replace_inc_dec_mem): Remove. (emit_inc_dec_insn_before): New fn. (check_for_inc_dec): Use it, along with for_each_inc_dec. (canon_address): Pass mem modes to cselib_lookup. * cselib.h (cselib_lookup): Add memmode argument. Adjust callers. (cselib_lookup_from_insn): Likewise. (cselib_subst_to_values): Likewise. * cselib.c (find_slot_memmode): New var. (cselib_find_slot): New fn. Use it instead of htab_find_slot_with_hash everywhere. (entry_and_rtx_equal_p): Use find_slot_memmode. (autoinc_split): New fn. (rtx_equal_for_cselib_p): Rename and implement in terms of... (rtx_equal_for_cselib_1): ... this. Take memmode, pass it on. Deal with autoinc. Special-case recursion into MEMs. (cselib_hash_rtx): Likewise. (cselib_lookup_mem): Infer pmode from address mode. Distinguish address and MEM modes. (cselib_subst_to_values): Add memmode, pass it on. Deal with autoinc. (cselib_lookup): Add memmode argument, pass it on. (cselib_lookup_from_insn): Add memmode. (cselib_invalidate_rtx): Discard obsolete push_operand handling. (struct cselib_record_autoinc_data): New. (cselib_record_autoinc_cb): New fn. (cselib_record_sets): Use it, along with for_each_inc_dec. Pass MEM mode to cselib_lookup. Reset autoinced REGs here instead of... (cselib_process_insn): ... here. * var-tracking.c (replace_expr_with_values, use_type): Pass MEM mode to cselib_lookup. (add_uses): Likewise, also to cselib_subst_to_values. (add_stores): Likewise. * sched-deps.c (add_insn_mem_dependence): Pass mode to cselib_subst_to_values. (sched_analyze_1, sched_analyze_2): Likewise. Adjusted. * gcse.c (do_local_cprop): Adjusted. * postreload.c (reload_cse_simplify_set): Adjusted. (reload_cse_simplify_operands): Adjusted. * sel-sched-dump (debug_mem_addr_value): Pass mode. From-SVN: r169782
Diffstat (limited to 'gcc/dse.c')
-rw-r--r--gcc/dse.c87
1 files changed, 15 insertions, 72 deletions
diff --git a/gcc/dse.c b/gcc/dse.c
index 1debafc..1163981 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -806,82 +806,25 @@ free_store_info (insn_info_t insn_info)
insn_info->store_rec = NULL;
}
-
-struct insn_size {
- int size;
- rtx insn;
-};
-
-
-/* Add an insn to do the add inside a x if it is a
- PRE/POST-INC/DEC/MODIFY. D is an structure containing the insn and
- the size of the mode of the MEM that this is inside of. */
+/* Callback for for_each_inc_dec that emits an INSN that sets DEST to
+ SRC + SRCOFF before insn ARG. */
static int
-replace_inc_dec (rtx *r, void *d)
+emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
+ rtx op ATTRIBUTE_UNUSED,
+ rtx dest, rtx src, rtx srcoff, void *arg)
{
- rtx x = *r;
- struct insn_size *data = (struct insn_size *)d;
- switch (GET_CODE (x))
- {
- case PRE_INC:
- case POST_INC:
- {
- rtx r1 = XEXP (x, 0);
- rtx c = gen_int_mode (data->size, GET_MODE (r1));
- emit_insn_before (gen_rtx_SET (VOIDmode, r1,
- gen_rtx_PLUS (GET_MODE (r1), r1, c)),
- data->insn);
- return -1;
- }
+ rtx insn = (rtx)arg;
- case PRE_DEC:
- case POST_DEC:
- {
- rtx r1 = XEXP (x, 0);
- rtx c = gen_int_mode (-data->size, GET_MODE (r1));
- emit_insn_before (gen_rtx_SET (VOIDmode, r1,
- gen_rtx_PLUS (GET_MODE (r1), r1, c)),
- data->insn);
- return -1;
- }
+ if (srcoff)
+ src = gen_rtx_PLUS (GET_MODE (src), src, srcoff);
- case PRE_MODIFY:
- case POST_MODIFY:
- {
- /* We can reuse the add because we are about to delete the
- insn that contained it. */
- rtx add = XEXP (x, 0);
- rtx r1 = XEXP (add, 0);
- emit_insn_before (gen_rtx_SET (VOIDmode, r1, add), data->insn);
- return -1;
- }
-
- default:
- return 0;
- }
-}
+ /* We can reuse all operands without copying, because we are about
+ to delete the insn that contained it. */
+ emit_insn_before (gen_rtx_SET (VOIDmode, dest, src), insn);
-/* If X is a MEM, check the address to see if it is PRE/POST-INC/DEC/MODIFY
- and generate an add to replace that. */
-
-static int
-replace_inc_dec_mem (rtx *r, void *d)
-{
- rtx x = *r;
- if (x != NULL_RTX && MEM_P (x))
- {
- struct insn_size data;
-
- data.size = GET_MODE_SIZE (GET_MODE (x));
- data.insn = (rtx) d;
-
- for_each_rtx (&XEXP (x, 0), replace_inc_dec, &data);
-
- return -1;
- }
- return 0;
+ return -1;
}
/* Before we delete INSN, make sure that the auto inc/dec, if it is
@@ -892,7 +835,7 @@ check_for_inc_dec (rtx insn)
{
rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
if (note)
- for_each_rtx (&insn, replace_inc_dec_mem, insn);
+ for_each_inc_dec (&insn, emit_inc_dec_insn_before, insn);
}
@@ -1107,7 +1050,7 @@ canon_address (rtx mem,
*alias_set_out = 0;
- cselib_lookup (mem_address, address_mode, 1);
+ cselib_lookup (mem_address, address_mode, 1, GET_MODE (mem));
if (dump_file)
{
@@ -1187,7 +1130,7 @@ canon_address (rtx mem,
}
}
- *base = cselib_lookup (address, address_mode, true);
+ *base = cselib_lookup (address, address_mode, true, GET_MODE (mem));
*group_id = -1;
if (*base == NULL)