From a9052a408154a465587aaa7ee4d91f63ad81b60b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 28 Aug 2014 06:22:42 +0000 Subject: [PATCH] cse.c (change_cc_mode_args): Delete. gcc/ * cse.c (change_cc_mode_args): Delete. (cse_change_cc_mode): Turn from being a for_each_rtx callback to being a function that examines each subrtx itself. Take the fields of change_cc_mode_args as argument and return void. (cse_change_cc_mode_insn): Update calls accordingly. From-SVN: r214631 --- gcc/ChangeLog | 8 ++++++++ gcc/cse.c | 50 +++++++++++++++++++------------------------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9adee3fe8f..5d733dd4436 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-08-28 Richard Sandiford + + * cse.c (change_cc_mode_args): Delete. + (cse_change_cc_mode): Turn from being a for_each_rtx callback to being + a function that examines each subrtx itself. Take the fields of + change_cc_mode_args as argument and return void. + (cse_change_cc_mode_insn): Update calls accordingly. + 2014-08-28 Richard Sandiford * cse.c (is_dead_reg): Change argument to const_rtx. diff --git a/gcc/cse.c b/gcc/cse.c index 319b5f89abb..866b0ee5bc7 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -255,14 +255,6 @@ struct qty_table_elem /* The table of all qtys, indexed by qty number. */ static struct qty_table_elem *qty_table; -/* Structure used to pass arguments via for_each_rtx to function - cse_change_cc_mode. */ -struct change_cc_mode_args -{ - rtx_insn *insn; - rtx newreg; -}; - #ifdef HAVE_cc0 /* For machines that have a CC0, we do not record its value in the hash table since its use is guaranteed to be the insn immediately following @@ -603,7 +595,6 @@ static struct cse_reg_info * get_cse_reg_info (unsigned int regno); static void flush_hash_table (void); static bool insn_live_p (rtx_insn *, int *); static bool set_live_p (rtx, rtx_insn *, int *); -static int cse_change_cc_mode (rtx *, void *); static void cse_change_cc_mode_insn (rtx_insn *, rtx); static void cse_change_cc_mode_insns (rtx_insn *, rtx_insn *, rtx); static enum machine_mode cse_cc_succs (basic_block, basic_block, rtx, rtx, @@ -7070,26 +7061,26 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg) return ndead; } -/* This function is called via for_each_rtx. The argument, NEWREG, is - a condition code register with the desired mode. If we are looking - at the same register in a different mode, replace it with - NEWREG. */ +/* If LOC contains references to NEWREG in a different mode, change them + to use NEWREG instead. */ -static int -cse_change_cc_mode (rtx *loc, void *data) +static void +cse_change_cc_mode (subrtx_ptr_iterator::array_type &array, + rtx *loc, rtx insn, rtx newreg) { - struct change_cc_mode_args* args = (struct change_cc_mode_args*)data; - - if (*loc - && REG_P (*loc) - && REGNO (*loc) == REGNO (args->newreg) - && GET_MODE (*loc) != GET_MODE (args->newreg)) + FOR_EACH_SUBRTX_PTR (iter, array, loc, NONCONST) { - validate_change (args->insn, loc, args->newreg, 1); - - return -1; + rtx *loc = *iter; + rtx x = *loc; + if (x + && REG_P (x) + && REGNO (x) == REGNO (newreg) + && GET_MODE (x) != GET_MODE (newreg)) + { + validate_change (insn, loc, newreg, 1); + iter.skip_subrtxes (); + } } - return 0; } /* Change the mode of any reference to the register REGNO (NEWREG) to @@ -7098,17 +7089,14 @@ cse_change_cc_mode (rtx *loc, void *data) static void cse_change_cc_mode_insn (rtx_insn *insn, rtx newreg) { - struct change_cc_mode_args args; int success; if (!INSN_P (insn)) return; - args.insn = insn; - args.newreg = newreg; - - for_each_rtx (&PATTERN (insn), cse_change_cc_mode, &args); - for_each_rtx (®_NOTES (insn), cse_change_cc_mode, &args); + subrtx_ptr_iterator::array_type array; + cse_change_cc_mode (array, &PATTERN (insn), insn, newreg); + cse_change_cc_mode (array, ®_NOTES (insn), insn, newreg); /* If the following assertion was triggered, there is most probably something wrong with the cc_modes_compatible back end function. -- 2.30.2