* 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
+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
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);
else
{
splitting_loops = 1;
- try_split (PATTERN (insn), insn, 1);
+ try_split (PATTERN (insn), safe_as_a <rtx_insn *> (insn), 1);
splitting_loops = 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);
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 ();
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;
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;
/* 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");
/* 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);
case SPLIT:
case PEEPHOLE2:
- return "NULL_RTX";
+ return "NULL";
}
gcc_unreachable ();
}
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. */
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
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");
/* 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;
/* 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;
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);
/* 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);
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 *);
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,