From 313d38e359bfcd8b56c946233294061c66ae21dc Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 13 Jun 2015 09:48:35 +0000 Subject: [PATCH] gensupport.h (add_implicit_parallel): Declare. gcc/ * gensupport.h (add_implicit_parallel): Declare. * genrecog.c (add_implicit_parallel): Move to... * gensupport.c (add_implicit_parallel): ...here. (process_one_cond_exec): Use it. * genemit.c (gen_insn): Likewise. From-SVN: r224454 --- gcc/ChangeLog | 8 ++++++++ gcc/genemit.c | 30 +++++++++-------------------- gcc/genrecog.c | 16 ---------------- gcc/gensupport.c | 49 +++++++++++++++++++++++------------------------- gcc/gensupport.h | 1 + 5 files changed, 41 insertions(+), 63 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ceda880c0ba..903cc3f9efe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-06-13 Richard Sandiford + + * gensupport.h (add_implicit_parallel): Declare. + * genrecog.c (add_implicit_parallel): Move to... + * gensupport.c (add_implicit_parallel): ...here. + (process_one_cond_exec): Use it. + * genemit.c (gen_insn): Likewise. + 2015-06-13 Iain Sandoe PR bootstrap/66448 diff --git a/gcc/genemit.c b/gcc/genemit.c index 29437b95dae..b6df49cd959 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -378,27 +378,15 @@ gen_insn (rtx insn, int lineno) /* Output code to construct and return the rtl for the instruction body. */ - if (XVECLEN (insn, 1) == 1) - { - printf (" return "); - gen_exp (XVECEXP (insn, 1, 0), DEFINE_INSN, NULL); - printf (";\n}\n\n"); - } - else - { - char *used = XCNEWVEC (char, stats.num_generator_args); - - printf (" return gen_rtx_PARALLEL (VOIDmode, gen_rtvec (%d", - XVECLEN (insn, 1)); - - for (i = 0; i < XVECLEN (insn, 1); i++) - { - printf (",\n\t\t"); - gen_exp (XVECEXP (insn, 1, i), DEFINE_INSN, used); - } - printf ("));\n}\n\n"); - XDELETEVEC (used); - } + rtx pattern = add_implicit_parallel (XVEC (insn, 1)); + /* ??? This is the traditional behavior, but seems suspect. */ + char *used = (XVECLEN (insn, 1) == 1 + ? NULL + : XCNEWVEC (char, stats.num_generator_args)); + printf (" return "); + gen_exp (pattern, DEFINE_INSN, used); + printf (";\n}\n\n"); + XDELETEVEC (used); } /* Generate the `gen_...' function for a DEFINE_EXPAND. */ diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 88177d523f0..d8432283915 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -5185,22 +5185,6 @@ print_subroutine_group (output_state *os, routine_type type, state *root) print_subroutine (os, root, 0); } -/* Return the rtx pattern specified by the list of rtxes in a - define_insn or define_split. */ - -static rtx -add_implicit_parallel (rtvec vec) -{ - if (GET_NUM_ELEM (vec) == 1) - return RTVEC_ELT (vec, 0); - else - { - rtx pattern = rtx_alloc (PARALLEL); - XVEC (pattern, 0) = vec; - return pattern; - } -} - /* Return the rtx pattern for the list of rtxes in a define_peephole2. */ static rtx diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 2f26f3a87ae..dc73cf9ae17 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -142,6 +142,22 @@ gen_rtx_CONST_INT (machine_mode ARG_UNUSED (mode), XWINT (rt, 0) = arg; return rt; } + +/* Return the rtx pattern specified by the list of rtxes in a + define_insn or define_split. */ + +rtx +add_implicit_parallel (rtvec vec) +{ + if (GET_NUM_ELEM (vec) == 1) + return RTVEC_ELT (vec, 0); + else + { + rtx pattern = rtx_alloc (PARALLEL); + XVEC (pattern, 0) = vec; + return pattern; + } +} /* Predicate handling. @@ -1702,19 +1718,9 @@ process_one_cond_exec (struct queue_elem *ce_elem) XSTR (insn, 0) = new_name; pattern = rtx_alloc (COND_EXEC); XEXP (pattern, 0) = pred; - if (XVECLEN (insn, 1) == 1) - { - XEXP (pattern, 1) = XVECEXP (insn, 1, 0); - XVECEXP (insn, 1, 0) = pattern; - PUT_NUM_ELEM (XVEC (insn, 1), 1); - } - else - { - XEXP (pattern, 1) = rtx_alloc (PARALLEL); - XVEC (XEXP (pattern, 1), 0) = XVEC (insn, 1); - XVEC (insn, 1) = rtvec_alloc (1); - XVECEXP (insn, 1, 0) = pattern; - } + XEXP (pattern, 1) = add_implicit_parallel (XVEC (insn, 1)); + XVEC (insn, 1) = rtvec_alloc (1); + XVECEXP (insn, 1, 0) = pattern; if (XVEC (ce_elem->data, 3) != NULL) { @@ -1759,19 +1765,10 @@ process_one_cond_exec (struct queue_elem *ce_elem) /* Predicate the pattern matched by the split. */ pattern = rtx_alloc (COND_EXEC); XEXP (pattern, 0) = pred; - if (XVECLEN (split, 0) == 1) - { - XEXP (pattern, 1) = XVECEXP (split, 0, 0); - XVECEXP (split, 0, 0) = pattern; - PUT_NUM_ELEM (XVEC (split, 0), 1); - } - else - { - XEXP (pattern, 1) = rtx_alloc (PARALLEL); - XVEC (XEXP (pattern, 1), 0) = XVEC (split, 0); - XVEC (split, 0) = rtvec_alloc (1); - XVECEXP (split, 0, 0) = pattern; - } + XEXP (pattern, 1) = add_implicit_parallel (XVEC (split, 0)); + XVEC (split, 0) = rtvec_alloc (1); + XVECEXP (split, 0, 0) = pattern; + /* Predicate all of the insns generated by the split. */ for (i = 0; i < XVECLEN (split, 2); i++) { diff --git a/gcc/gensupport.h b/gcc/gensupport.h index 0f3f2eff031..e2544353d93 100644 --- a/gcc/gensupport.h +++ b/gcc/gensupport.h @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see struct obstack; extern struct obstack *rtl_obstack; +extern rtx add_implicit_parallel (rtvec); extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *)); extern bool init_rtx_reader_args (int, char **); extern rtx read_md_rtx (int *, int *); -- 2.30.2