Promote types of rtl expressions to rtx_insn in gen_split and gen_peephole2

* combine.c (combine_split_insns): Remove cast.
	* config/bfin/bfin.c (hwloop_fail): Add cast in try_split call.
	* config/sh/sh.c (sh_try_split_insn_simple): Remove cast.
	* config/sh/sh_treg_combine.cc (sh_treg_combine::execute): Add cast.
	* emit-rtl.c (try_split): Promote type of trial argument to rtx_insn.
	* genemit.c (gen_split): Change return type of generated functions to
	rtx_insn.
	* genrecog.c (get_failure_return): Use NULL instead of NULL_RTX.
	(print_subroutine_start): Promote rtx to rtx_insn in gen_split_* and
	gen_peephole2_* functions.
	(print_subroutine, main): Likewise.
	* recog.c (peephole2_optimize): Remove cast.
	(peep2_next_insn): Promote return type to rtx_insn.
	* recog.h (peep2_next_insn): Fix prototype.
	* rtl.h (try_split, split_insns): Likewise.

From-SVN: r224183
This commit is contained in:
Mikhail Maltsev 2015-06-06 05:39:16 +00:00 committed by Mikhail Maltsev
parent 2bc43588af
commit bb5c49564f
11 changed files with 55 additions and 35 deletions

View File

@ -1,3 +1,21 @@
2015-06-06 Mikhail Maltsev <maltsevm@gmail.com>
* combine.c (combine_split_insns): Remove cast.
* config/bfin/bfin.c (hwloop_fail): Add cast in try_split call.
* config/sh/sh.c (sh_try_split_insn_simple): Remove cast.
* config/sh/sh_treg_combine.cc (sh_treg_combine::execute): Add cast.
* emit-rtl.c (try_split): Promote type of trial argument to rtx_insn.
* genemit.c (gen_split): Change return type of generated functions to
rtx_insn.
* genrecog.c (get_failure_return): Use NULL instead of NULL_RTX.
(print_subroutine_start): Promote rtx to rtx_insn in gen_split_* and
gen_peephole2_* functions.
(print_subroutine, main): Likewise.
* recog.c (peephole2_optimize): Remove cast.
(peep2_next_insn): Promote return type to rtx_insn.
* recog.h (peep2_next_insn): Fix prototype.
* rtl.h (try_split, split_insns): Likewise.
2015-06-06 DJ Delorie <dj@redhat.com>
* config/msp430/msp430.c (msp430_asm_integer): Support addition

View File

@ -554,7 +554,7 @@ combine_split_insns (rtx pattern, rtx_insn *insn)
rtx_insn *ret;
unsigned int nregs;
ret = safe_as_a <rtx_insn *> (split_insns (pattern, insn));
ret = split_insns (pattern, insn);
nregs = max_reg_num ();
if (nregs > reg_stat.length ())
reg_stat.safe_grow_cleared (nregs);

View File

@ -3877,7 +3877,7 @@ hwloop_fail (hwloop_info loop)
else
{
splitting_loops = 1;
try_split (PATTERN (insn), insn, 1);
try_split (PATTERN (insn), safe_as_a <rtx_insn *> (insn), 1);
splitting_loops = 0;
}
}

View File

@ -14236,7 +14236,7 @@ sh_try_split_insn_simple (rtx_insn* i, rtx_insn* curr_insn, int n = 0)
fprintf (dump_file, "\n");
}
rtx_insn* seq = safe_as_a<rtx_insn*> (split_insns (PATTERN (i), curr_insn));
rtx_insn* seq = split_insns (PATTERN (i), curr_insn);
if (seq == NULL)
return std::make_pair (i, i);

View File

@ -1612,7 +1612,7 @@ sh_treg_combine::execute (function *fun)
log_msg ("trying to split insn:\n");
log_insn (*i);
log_msg ("\n");
try_split (PATTERN (*i), *i, 0);
try_split (PATTERN (*i), safe_as_a <rtx_insn *> (*i), 0);
}
m_touched_insns.clear ();

View File

@ -3653,9 +3653,8 @@ mark_label_nuses (rtx x)
returns TRIAL. If the insn to be returned can be split, it will be. */
rtx_insn *
try_split (rtx pat, rtx uncast_trial, int last)
try_split (rtx pat, rtx_insn *trial, int last)
{
rtx_insn *trial = as_a <rtx_insn *> (uncast_trial);
rtx_insn *before = PREV_INSN (trial);
rtx_insn *after = NEXT_INSN (trial);
rtx note;
@ -3674,7 +3673,7 @@ try_split (rtx pat, rtx uncast_trial, int last)
split_branch_probability = XINT (note, 0);
probability = split_branch_probability;
seq = safe_as_a <rtx_insn *> (split_insns (pat, trial));
seq = split_insns (pat, trial);
split_branch_probability = -1;

View File

@ -568,15 +568,17 @@ gen_split (rtx split)
/* Output the prototype, function name and argument declarations. */
if (GET_CODE (split) == DEFINE_PEEPHOLE2)
{
printf ("extern rtx gen_%s_%d (rtx_insn *, rtx *);\n",
printf ("extern rtx_insn *gen_%s_%d (rtx_insn *, rtx *);\n",
name, insn_code_number);
printf ("rtx\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
printf ("rtx_insn *\ngen_%s_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
name, insn_code_number, unused);
}
else
{
printf ("extern rtx gen_split_%d (rtx_insn *, rtx *);\n", insn_code_number);
printf ("rtx\ngen_split_%d (rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
insn_code_number);
printf ("rtx_insn *\ngen_split_%d "
"(rtx_insn *curr_insn ATTRIBUTE_UNUSED, rtx *operands%s)\n",
insn_code_number, unused);
}
printf ("{\n");
@ -584,7 +586,7 @@ gen_split (rtx split)
/* Declare all local variables. */
for (i = 0; i < stats.num_operand_vars; i++)
printf (" rtx operand%d;\n", i);
printf (" rtx _val = 0;\n");
printf (" rtx_insn *_val = NULL;\n");
if (GET_CODE (split) == DEFINE_PEEPHOLE2)
output_peephole2_scratches (split);

View File

@ -4307,7 +4307,7 @@ get_failure_return (routine_type type)
case SPLIT:
case PEEPHOLE2:
return "NULL_RTX";
return "NULL";
}
gcc_unreachable ();
}
@ -5061,7 +5061,7 @@ print_subroutine_start (output_state *os, state *s, position *root)
if (os->type == SUBPATTERN || os->type == RECOG)
printf (" int res ATTRIBUTE_UNUSED;\n");
else
printf (" rtx res ATTRIBUTE_UNUSED;\n");
printf (" rtx_insn *res ATTRIBUTE_UNUSED;\n");
}
/* Output the definition of pattern routine ROUTINE. */
@ -5111,7 +5111,7 @@ print_pattern (output_state *os, pattern_routine *routine)
static void
print_subroutine (output_state *os, state *s, int proc_id)
{
/* For now, the top-level functions take a plain "rtx", and perform a
/* For now, the top-level "recog" takes a plain "rtx", and performs a
checked cast to "rtx_insn *" for use throughout the rest of the
function and the code it calls. */
const char *insn_param
@ -5134,29 +5134,31 @@ print_subroutine (output_state *os, state *s, int proc_id)
case SPLIT:
if (proc_id)
printf ("static rtx\nsplit_%d", proc_id);
printf ("static rtx_insn *\nsplit_%d", proc_id);
else
printf ("rtx\nsplit_insns");
printf (" (rtx x1 ATTRIBUTE_UNUSED, %s ATTRIBUTE_UNUSED)\n",
insn_param);
printf ("rtx_insn *\nsplit_insns");
printf (" (rtx x1 ATTRIBUTE_UNUSED, rtx_insn *insn ATTRIBUTE_UNUSED)\n");
break;
case PEEPHOLE2:
if (proc_id)
printf ("static rtx\npeephole2_%d", proc_id);
printf ("static rtx_insn *\npeephole2_%d", proc_id);
else
printf ("rtx\npeephole2_insns");
printf ("rtx_insn *\npeephole2_insns");
printf (" (rtx x1 ATTRIBUTE_UNUSED,\n"
"\t%s ATTRIBUTE_UNUSED,\n"
"\tint *pmatch_len_ ATTRIBUTE_UNUSED)\n", insn_param);
"\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
"\tint *pmatch_len_ ATTRIBUTE_UNUSED)\n");
break;
}
print_subroutine_start (os, s, &root_pos);
if (proc_id == 0)
{
printf (" recog_data.insn = NULL;\n");
printf (" rtx_insn *insn ATTRIBUTE_UNUSED;\n");
printf (" insn = safe_as_a <rtx_insn *> (uncast_insn);\n");
if (os->type == RECOG)
{
printf (" rtx_insn *insn ATTRIBUTE_UNUSED;\n");
printf (" insn = safe_as_a <rtx_insn *> (uncast_insn);\n");
}
}
print_state (os, s, 2, true);
printf ("}\n");
@ -5323,7 +5325,7 @@ main (int argc, char **argv)
/* Declare the gen_split routine that we'll call if the
pattern matches. The definition comes from insn-emit.c. */
printf ("extern rtx gen_split_%d (rtx_insn *, rtx *);\n",
printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
next_insn_code);
break;
@ -5335,7 +5337,7 @@ main (int argc, char **argv)
/* Declare the gen_peephole2 routine that we'll call if the
pattern matches. The definition comes from insn-emit.c. */
printf ("extern rtx gen_peephole2_%d (rtx_insn *, rtx *);\n",
printf ("extern rtx_insn *gen_peephole2_%d (rtx_insn *, rtx *);\n",
next_insn_code);
break;

View File

@ -3080,7 +3080,7 @@ peep2_buf_position (int n)
does not exist. Used by the recognizer to find the next insn to match
in a multi-insn pattern. */
rtx
rtx_insn *
peep2_next_insn (int n)
{
gcc_assert (n <= peep2_current_count);
@ -3653,8 +3653,7 @@ peephole2_optimize (void)
/* Match the peephole. */
head = peep2_insn_data[peep2_current].insn;
attempt = safe_as_a <rtx_insn *> (
peephole2_insns (PATTERN (head), head, &match_len));
attempt = peephole2_insns (PATTERN (head), head, &match_len);
if (attempt != NULL)
{
rtx_insn *last = peep2_attempt (bb, head, match_len, attempt);

View File

@ -139,14 +139,14 @@ extern void preprocess_constraints (int, int, const char **,
operand_alternative *);
extern const operand_alternative *preprocess_insn_constraints (int);
extern void preprocess_constraints (rtx_insn *);
extern rtx peep2_next_insn (int);
extern rtx_insn *peep2_next_insn (int);
extern int peep2_regno_dead_p (int, int);
extern int peep2_reg_dead_p (int, rtx);
#ifdef CLEAR_HARD_REG_SET
extern rtx peep2_find_free_register (int, int, const char *,
machine_mode, HARD_REG_SET *);
#endif
extern rtx peephole2_insns (rtx, rtx, int *);
extern rtx_insn *peephole2_insns (rtx, rtx_insn *, int *);
extern int store_data_bypass_p (rtx_insn *, rtx_insn *);
extern int if_test_bypass_p (rtx_insn *, rtx_insn *);

View File

@ -2831,11 +2831,11 @@ extern rtx_insn *delete_related_insns (rtx);
extern rtx *find_constant_term_loc (rtx *);
/* In emit-rtl.c */
extern rtx_insn *try_split (rtx, rtx, int);
extern rtx_insn *try_split (rtx, rtx_insn *, int);
extern int split_branch_probability;
/* In unknown file */
extern rtx split_insns (rtx, rtx);
/* In insn-recog.c (generated by genrecog). */
extern rtx_insn *split_insns (rtx, rtx_insn *);
/* In simplify-rtx.c */
extern rtx simplify_const_unary_operation (enum rtx_code, machine_mode,