From: Richard Sandiford Date: Thu, 28 Aug 2014 06:22:33 +0000 (+0000) Subject: cse.c (check_for_label_ref): Move earlier in file. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f000294852af1e858096f415588b247b51802683;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3fe52d50be8..e096c5e8cee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-08-28 Richard Sandiford + + * 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 * cse.c (check_dependence_data): Delete. diff --git a/gcc/cse.c b/gcc/cse.c index 3557894dde9..a6c9e5c5a03 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -596,7 +596,6 @@ static void invalidate_from_clobbers (rtx_insn *); static void invalidate_from_sets_and_clobbers (rtx_insn *); static rtx cse_process_notes (rtx, rtx, bool *); 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*); static void get_cse_reg_info_1 (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) 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. */ static void @@ -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, check this one. */ if (INSN_P (insn) && !recorded_label_ref - && for_each_rtx (&PATTERN (insn), check_for_label_ref, - (void *) insn)) + && check_for_label_ref (insn)) recorded_label_ref = true; #ifdef HAVE_cc0 @@ -6630,28 +6654,6 @@ cse_main (rtx_insn *f ATTRIBUTE_UNUSED, int nregs) 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. COUNTS is an array in which we accumulate the count, INCR is how much we count each register usage.