summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-02 00:34:11 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-02 00:34:11 +0000
commite663775373e9fff81e57536eb860c28985a57c43 (patch)
treee8586f90b0101adcc1ada9b7625fd4d25cb71a67 /gcc/combine.c
parent51d6c5165bdb8b26855bdbd8c0fec7e3a8565af2 (diff)
downloadgcc-e663775373e9fff81e57536eb860c28985a57c43.tar.gz
PR debug/52983
* valtrack.h, valtrack.c: New. * Makefile.in (VALTRACK_H): New. (OBJS): Add valtrack.o. (valtrack.o): New. (cselib.o, dce.o, df-problems.o, combine.o): Add VALTRACK_H. * combine.c: Include valtrack.h. (make_compound_operation): Publish. (cleanup_auto_inc_dec): Move to valtrack.c. (struct rtx_subst_pair, propagate_for_debug_subst): Likewise. (propagate_for_debug): Likewise. Add this_basic_block parameter. Adjust all callers. * cselib.c: Include valtrack.h. * dce.c: Likewise. * df-problems.c: Likewise. (dead_debug_init, dead_debug_reset_uses): Move to valtrack.c. (dead_debug_finish, dead_debug_add): Likewise. (dead_debug_insert_temp): Likewise. * df.h (struct dead_debug_use): Move to valtrack.h. (struct dead_debug, enum debug_temp_where): Likewise. (dead_debug_init, dead_debug_reset_uses): Move to valtrack.h. (dead_debug_finish, dead_debug_add): Likewise. (dead_debug_insert_temp): Likewise. * rtl.h (make_compound_operation): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c180
1 files changed, 16 insertions, 164 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index a07c046503e..dbc6ff6f962 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -100,6 +100,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "tree-pass.h"
#include "df.h"
+#include "valtrack.h"
#include "cgraph.h"
#include "obstack.h"
@@ -424,7 +425,6 @@ static const_rtx expand_field_assignment (const_rtx);
static rtx make_extraction (enum machine_mode, rtx, HOST_WIDE_INT,
rtx, unsigned HOST_WIDE_INT, int, int, int);
static rtx extract_left_shift (rtx, int);
-static rtx make_compound_operation (rtx, enum rtx_code);
static int get_pos_from_mask (unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT *);
static rtx canon_reg_for_combine (rtx, rtx);
@@ -2357,161 +2357,6 @@ reg_subword_p (rtx x, rtx reg)
&& GET_MODE_CLASS (GET_MODE (x)) == MODE_INT;
}
-#ifdef AUTO_INC_DEC
-/* Replace auto-increment addressing modes with explicit operations to access
- the same addresses without modifying the corresponding registers. */
-
-static rtx
-cleanup_auto_inc_dec (rtx src, enum machine_mode mem_mode)
-{
- rtx x = src;
- const RTX_CODE code = GET_CODE (x);
- int i;
- const char *fmt;
-
- switch (code)
- {
- case REG:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST_FIXED:
- case CONST_VECTOR:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case SCRATCH:
- /* SCRATCH must be shared because they represent distinct values. */
- return x;
- case CLOBBER:
- if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
- return x;
- break;
-
- case CONST:
- if (shared_const_p (x))
- return x;
- break;
-
- case MEM:
- mem_mode = GET_MODE (x);
- break;
-
- case PRE_INC:
- case PRE_DEC:
- gcc_assert (mem_mode != VOIDmode && mem_mode != BLKmode);
- return gen_rtx_PLUS (GET_MODE (x),
- cleanup_auto_inc_dec (XEXP (x, 0), mem_mode),
- GEN_INT (code == PRE_INC
- ? GET_MODE_SIZE (mem_mode)
- : -GET_MODE_SIZE (mem_mode)));
-
- case POST_INC:
- case POST_DEC:
- case PRE_MODIFY:
- case POST_MODIFY:
- return cleanup_auto_inc_dec (code == PRE_MODIFY
- ? XEXP (x, 1) : XEXP (x, 0),
- mem_mode);
-
- default:
- break;
- }
-
- /* Copy the various flags, fields, and other information. We assume
- that all fields need copying, and then clear the fields that should
- not be copied. That is the sensible default behavior, and forces
- us to explicitly document why we are *not* copying a flag. */
- x = shallow_copy_rtx (x);
-
- /* We do not copy the USED flag, which is used as a mark bit during
- walks over the RTL. */
- RTX_FLAG (x, used) = 0;
-
- /* We do not copy FRAME_RELATED for INSNs. */
- if (INSN_P (x))
- RTX_FLAG (x, frame_related) = 0;
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- XEXP (x, i) = cleanup_auto_inc_dec (XEXP (x, i), mem_mode);
- else if (fmt[i] == 'E' || fmt[i] == 'V')
- {
- int j;
- XVEC (x, i) = rtvec_alloc (XVECLEN (x, i));
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j)
- = cleanup_auto_inc_dec (XVECEXP (src, i, j), mem_mode);
- }
-
- return x;
-}
-#endif
-
-/* Auxiliary data structure for propagate_for_debug_stmt. */
-
-struct rtx_subst_pair
-{
- rtx to;
- bool adjusted;
-};
-
-/* DATA points to an rtx_subst_pair. Return the value that should be
- substituted. */
-
-static rtx
-propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data)
-{
- struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data;
-
- if (!rtx_equal_p (from, old_rtx))
- return NULL_RTX;
- if (!pair->adjusted)
- {
- pair->adjusted = true;
-#ifdef AUTO_INC_DEC
- pair->to = cleanup_auto_inc_dec (pair->to, VOIDmode);
-#else
- pair->to = copy_rtx (pair->to);
-#endif
- pair->to = make_compound_operation (pair->to, SET);
- return pair->to;
- }
- return copy_rtx (pair->to);
-}
-
-/* Replace all the occurrences of DEST with SRC in DEBUG_INSNs between INSN
- and LAST, not including INSN, but including LAST. Also stop at the end
- of THIS_BASIC_BLOCK. */
-
-static void
-propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src)
-{
- rtx next, loc, end = NEXT_INSN (BB_END (this_basic_block));
-
- struct rtx_subst_pair p;
- p.to = src;
- p.adjusted = false;
-
- next = NEXT_INSN (insn);
- last = NEXT_INSN (last);
- while (next != last && next != end)
- {
- insn = next;
- next = NEXT_INSN (insn);
- if (DEBUG_INSN_P (insn))
- {
- loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn),
- dest, propagate_for_debug_subst, &p);
- if (loc == INSN_VAR_LOCATION_LOC (insn))
- continue;
- INSN_VAR_LOCATION_LOC (insn) = loc;
- df_insn_rescan (insn);
- }
- }
-}
-
/* Delete the unconditional jump INSN and adjust the CFG correspondingly.
Note that the INSN should be deleted *after* removing dead edges, so
that the kept edge is the fallthrough edge for a (set (pc) (pc))
@@ -3971,7 +3816,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
i2src while its original mode is temporarily
restored, and then clear i2scratch so that we don't
do it again later. */
- propagate_for_debug (i2, last_combined_insn, reg, i2src);
+ propagate_for_debug (i2, last_combined_insn, reg, i2src,
+ this_basic_block);
i2scratch = false;
/* Put back the new mode. */
adjust_reg_mode (reg, new_mode);
@@ -4005,10 +3851,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
with this copy we have created; then, replace the
copy with the SUBREG of the original shared reg,
once again changed to the new mode. */
- propagate_for_debug (first, last, reg, tempreg);
+ propagate_for_debug (first, last, reg, tempreg,
+ this_basic_block);
adjust_reg_mode (reg, new_mode);
propagate_for_debug (first, last, tempreg,
- lowpart_subreg (old_mode, reg, new_mode));
+ lowpart_subreg (old_mode, reg, new_mode),
+ this_basic_block);
}
}
}
@@ -4220,14 +4068,16 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
if (newi2pat)
{
if (MAY_HAVE_DEBUG_INSNS && i2scratch)
- propagate_for_debug (i2, last_combined_insn, i2dest, i2src);
+ propagate_for_debug (i2, last_combined_insn, i2dest, i2src,
+ this_basic_block);
INSN_CODE (i2) = i2_code_number;
PATTERN (i2) = newi2pat;
}
else
{
if (MAY_HAVE_DEBUG_INSNS && i2src)
- propagate_for_debug (i2, last_combined_insn, i2dest, i2src);
+ propagate_for_debug (i2, last_combined_insn, i2dest, i2src,
+ this_basic_block);
SET_INSN_DELETED (i2);
}
@@ -4236,7 +4086,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
LOG_LINKS (i1) = NULL;
REG_NOTES (i1) = 0;
if (MAY_HAVE_DEBUG_INSNS)
- propagate_for_debug (i1, last_combined_insn, i1dest, i1src);
+ propagate_for_debug (i1, last_combined_insn, i1dest, i1src,
+ this_basic_block);
SET_INSN_DELETED (i1);
}
@@ -4245,7 +4096,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
LOG_LINKS (i0) = NULL;
REG_NOTES (i0) = 0;
if (MAY_HAVE_DEBUG_INSNS)
- propagate_for_debug (i0, last_combined_insn, i0dest, i0src);
+ propagate_for_debug (i0, last_combined_insn, i0dest, i0src,
+ this_basic_block);
SET_INSN_DELETED (i0);
}
@@ -7596,7 +7448,7 @@ extract_left_shift (rtx x, int count)
being kludges), it is MEM. When processing the arguments of a comparison
or a COMPARE against zero, it is COMPARE. */
-static rtx
+rtx
make_compound_operation (rtx x, enum rtx_code in_code)
{
enum rtx_code code = GET_CODE (x);