From patchwork Sat Jun 13 09:47:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 483828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0DC9614028F for ; Sat, 13 Jun 2015 19:48:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=et/mOvwa; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=BMNZ55tpx5d/ETof7AoG5iMzW998oZ4ipi9dDoyzI1lR62SSDYV1H iRsOT8dad5GAWL1ZdXP0A4PlD8MdT7/BZX7szFOxQK0UDX1lnmYGecyhdOGc80uT WZmSogLBMm65U5ghg6eCzL8OWlEIOXdyyPxioGHCMCA5piBQBw1jlg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=m0Jsl0knnqOZNbfvnr4s+0O5VkI=; b=et/mOvwa7bg73OCFIsB3 JFlWVhOPFcKNXiPwh6sNCs/21YKngFAL4ycn/ZpizJzEjv8uTBXXpXZ9bZEobiwA kjQRF48eBuWwn38OOX+H/qBvisMXlluOst8TaI8DpMx23Guz1yMLPfDeX/HZ6sX2 /Gz7jpiy4W1BWpdNH/ud9bg= Received: (qmail 74613 invoked by alias); 13 Jun 2015 09:48:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74597 invoked by uid 89); 13 Jun 2015 09:48:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wg0-f41.google.com Received: from mail-wg0-f41.google.com (HELO mail-wg0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 13 Jun 2015 09:48:03 +0000 Received: by wgzl5 with SMTP id l5so12709619wgz.3 for ; Sat, 13 Jun 2015 02:48:00 -0700 (PDT) X-Received: by 10.180.72.145 with SMTP id d17mr14422556wiv.69.1434188880205; Sat, 13 Jun 2015 02:48:00 -0700 (PDT) Received: from localhost ([95.144.14.193]) by mx.google.com with ESMTPSA id v3sm6528787wiz.14.2015.06.13.02.47.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jun 2015 02:47:59 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [committed] Move add_implicit_parallel to gensupport Date: Sat, 13 Jun 2015 10:47:58 +0100 Message-ID: <877fr83po1.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Several places in the generators want to convert a define_insn rtvec into a single rtx. This patch just puts the routine to do that in gensupport.c. The changes to process_one_cond_exec mean that we'll allocate rtvecs more often, but that's not going to make a noticeable difference and I think it's better to handle the single- and multi-rtx forms consistently. Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested with config-list.mk. Applied. Richard 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. Index: gcc/gensupport.h =================================================================== --- gcc/gensupport.h 2015-06-13 10:37:47.844961062 +0100 +++ gcc/gensupport.h 2015-06-13 10:38:52.370125288 +0100 @@ -23,6 +23,7 @@ #define GCC_GENSUPPORT_H 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 *); Index: gcc/genrecog.c =================================================================== --- gcc/genrecog.c 2015-06-13 10:37:47.844961062 +0100 +++ gcc/genrecog.c 2015-06-13 10:38:52.369125332 +0100 @@ -5187,22 +5187,6 @@ print_subroutine_group (output_state *os 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 Index: gcc/gensupport.c =================================================================== --- gcc/gensupport.c 2015-06-13 10:37:47.844961062 +0100 +++ gcc/gensupport.c 2015-06-13 10:38:52.370125288 +0100 @@ -143,6 +143,22 @@ gen_rtx_CONST_INT (machine_mode ARG_UNUS 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. @@ -1703,19 +1719,9 @@ process_one_cond_exec (struct queue_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) { @@ -1760,19 +1766,10 @@ process_one_cond_exec (struct queue_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++) { Index: gcc/genemit.c =================================================================== --- gcc/genemit.c 2015-06-13 10:37:47.844961062 +0100 +++ gcc/genemit.c 2015-06-13 10:38:52.369125332 +0100 @@ -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. */