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.
Index: gcc/cse.c =================================================================== --- gcc/cse.c 2014-08-03 11:25:23.760091083 +0100 +++ gcc/cse.c 2014-08-03 11:25:24.059094039 +0100 @@ -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; - 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 static void flush_hash_table (void); static bool insn_live_p (rtx, int *); static bool set_live_p (rtx, rtx, int *); -static int cse_change_cc_mode (rtx *, void *); static void cse_change_cc_mode_insn (rtx, rtx); static void cse_change_cc_mode_insns (rtx, rtx, rtx); static enum machine_mode cse_cc_succs (basic_block, basic_block, rtx, rtx, @@ -7067,26 +7058,26 @@ delete_trivially_dead_insns (rtx insns, 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 @@ -7095,17 +7086,14 @@ cse_change_cc_mode (rtx *loc, void *data static void cse_change_cc_mode_insn (rtx 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.