Commit f0002948 by Richard Sandiford Committed by Richard Sandiford

cse.c (check_for_label_ref): Move earlier in file.

gcc/
	* cse.c (check_for_label_ref): Move earlier in file.  Turn from
	being a for_each_rtx callback to being a function that examines
	each subrtx itself.
	(cse_extended_basic_block): Update call accordingly.

From-SVN: r214629
parent c992c066
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* cse.c (check_for_label_ref): Move earlier in file. Turn from
being a for_each_rtx callback to being a function that examines
each subrtx itself.
(cse_extended_basic_block): Update call accordingly.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* cse.c (check_dependence_data): Delete. * cse.c (check_dependence_data): Delete.
(check_dependence): Change from being a for_each_rtx callback to being (check_dependence): Change from being a for_each_rtx callback to being
a function that examines all subrtxes itself. Don't handle null rtxes. a function that examines all subrtxes itself. Don't handle null rtxes.
......
...@@ -596,7 +596,6 @@ static void invalidate_from_clobbers (rtx_insn *); ...@@ -596,7 +596,6 @@ static void invalidate_from_clobbers (rtx_insn *);
static void invalidate_from_sets_and_clobbers (rtx_insn *); static void invalidate_from_sets_and_clobbers (rtx_insn *);
static rtx cse_process_notes (rtx, rtx, bool *); static rtx cse_process_notes (rtx, rtx, bool *);
static void cse_extended_basic_block (struct cse_basic_block_data *); static void cse_extended_basic_block (struct cse_basic_block_data *);
static int check_for_label_ref (rtx *, void *);
extern void dump_class (struct table_elt*); extern void dump_class (struct table_elt*);
static void get_cse_reg_info_1 (unsigned int regno); static void get_cse_reg_info_1 (unsigned int regno);
static struct cse_reg_info * get_cse_reg_info (unsigned int regno); static struct cse_reg_info * get_cse_reg_info (unsigned int regno);
...@@ -6366,6 +6365,32 @@ cse_prescan_path (struct cse_basic_block_data *data) ...@@ -6366,6 +6365,32 @@ cse_prescan_path (struct cse_basic_block_data *data)
data->nsets = nsets; data->nsets = nsets;
} }
/* Return true if the pattern of INSN uses a LABEL_REF for which
there isn't a REG_LABEL_OPERAND note. */
static bool
check_for_label_ref (rtx_insn *insn)
{
/* If this insn uses a LABEL_REF and there isn't a REG_LABEL_OPERAND
note for it, we must rerun jump since it needs to place the note. If
this is a LABEL_REF for a CODE_LABEL that isn't in the insn chain,
don't do this since no REG_LABEL_OPERAND will be added. */
subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
{
const_rtx x = *iter;
if (GET_CODE (x) == LABEL_REF
&& !LABEL_REF_NONLOCAL_P (x)
&& (!JUMP_P (insn)
|| !label_is_jump_target_p (XEXP (x, 0), insn))
&& LABEL_P (XEXP (x, 0))
&& INSN_UID (XEXP (x, 0)) != 0
&& !find_reg_note (insn, REG_LABEL_OPERAND, XEXP (x, 0)))
return true;
}
return false;
}
/* Process a single extended basic block described by EBB_DATA. */ /* Process a single extended basic block described by EBB_DATA. */
static void static void
...@@ -6436,8 +6461,7 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data) ...@@ -6436,8 +6461,7 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
/* If we haven't already found an insn where we added a LABEL_REF, /* If we haven't already found an insn where we added a LABEL_REF,
check this one. */ check this one. */
if (INSN_P (insn) && !recorded_label_ref if (INSN_P (insn) && !recorded_label_ref
&& for_each_rtx (&PATTERN (insn), check_for_label_ref, && check_for_label_ref (insn))
(void *) insn))
recorded_label_ref = true; recorded_label_ref = true;
#ifdef HAVE_cc0 #ifdef HAVE_cc0
...@@ -6630,28 +6654,6 @@ cse_main (rtx_insn *f ATTRIBUTE_UNUSED, int nregs) ...@@ -6630,28 +6654,6 @@ cse_main (rtx_insn *f ATTRIBUTE_UNUSED, int nregs)
return 0; return 0;
} }
/* Called via for_each_rtx to see if an insn is using a LABEL_REF for
which there isn't a REG_LABEL_OPERAND note.
Return one if so. DATA is the insn. */
static int
check_for_label_ref (rtx *rtl, void *data)
{
rtx_insn *insn = (rtx_insn *) data;
/* If this insn uses a LABEL_REF and there isn't a REG_LABEL_OPERAND
note for it, we must rerun jump since it needs to place the note. If
this is a LABEL_REF for a CODE_LABEL that isn't in the insn chain,
don't do this since no REG_LABEL_OPERAND will be added. */
return (GET_CODE (*rtl) == LABEL_REF
&& ! LABEL_REF_NONLOCAL_P (*rtl)
&& (!JUMP_P (insn)
|| !label_is_jump_target_p (XEXP (*rtl, 0), insn))
&& LABEL_P (XEXP (*rtl, 0))
&& INSN_UID (XEXP (*rtl, 0)) != 0
&& ! find_reg_note (insn, REG_LABEL_OPERAND, XEXP (*rtl, 0)));
}
/* Count the number of times registers are used (not set) in X. /* Count the number of times registers are used (not set) in X.
COUNTS is an array in which we accumulate the count, INCR is how much COUNTS is an array in which we accumulate the count, INCR is how much
we count each register usage. we count each register usage.
......
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