diff options
author | miyuki <miyuki@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-06 05:39:16 +0000 |
---|---|---|
committer | miyuki <miyuki@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-06 05:39:16 +0000 |
commit | 58a87a29ba8b650e6dc901fbe4a37fe905a046be (patch) | |
tree | 59990e06cf8ced52d365080821323351c4790c1c | |
parent | 9f96175798df76cbd74e3081e5384857315fc921 (diff) | |
download | gcc-58a87a29ba8b650e6dc901fbe4a37fe905a046be.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224183 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/combine.c | 2 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 2 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 2 | ||||
-rw-r--r-- | gcc/config/sh/sh_treg_combine.cc | 2 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 5 | ||||
-rw-r--r-- | gcc/genemit.c | 12 | ||||
-rw-r--r-- | gcc/genrecog.c | 32 | ||||
-rw-r--r-- | gcc/recog.c | 5 | ||||
-rw-r--r-- | gcc/recog.h | 4 | ||||
-rw-r--r-- | gcc/rtl.h | 6 |
11 files changed, 55 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index faaf7b22837..b7676aad413 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/combine.c b/gcc/combine.c index 01f43b1defe..8a9ab7aadb4 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -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); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 914a02400bb..7b570cd1342 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -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; } } diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index d77154c0658..3b63014cb13 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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); diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc index 02e13e85e46..c09a4c330ee 100644 --- a/gcc/config/sh/sh_treg_combine.cc +++ b/gcc/config/sh/sh_treg_combine.cc @@ -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 (); diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index e6327109804..7bb2c771f90 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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; diff --git a/gcc/genemit.c b/gcc/genemit.c index 3f5dd825a1e..e5b39fdd47e 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -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); diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 4b6dee64b5a..217eb500751 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -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; diff --git a/gcc/recog.c b/gcc/recog.c index ace0e9b3264..b1b9c227753 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -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); diff --git a/gcc/recog.h b/gcc/recog.h index d97f4df3dbe..ce931ebdf5a 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -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 *); diff --git a/gcc/rtl.h b/gcc/rtl.h index 863bfd42968..2c190ec5d16 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -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, |