From patchwork Sun Dec 14 20:36:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 42212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3452921772 for ; Sun, 14 Dec 2014 20:36:56 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf6516668lab.1 for ; Sun, 14 Dec 2014 12:36:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:in-reply-to:references:date:message-id :subject:from:to:content-type:x-original-sender :x-original-authentication-results; bh=fTav31MKbxKGJ6iJirzrmxSq2ovbpk2/oAV7jveW02w=; b=mfNnE8aYzzDjm/S0/w+aaBfcwmHfufCBP6YO7zZSjAYCt4YeRfA6ZoATHibySiCj6Q t49lk0t6ekGLrC+XbXlcy7VlnwG2qhL1Aexj6VyNiiX107GI7dYhr9c4u452zkzeyq6G GS2OlrrVBcwBxqAKMg1VUjZAkWbn2colD9DHuMSqbtLFEtjOC9hB0l2i5t5TiXS+8tj3 EMLDehtiwMdnF1iLoDl9mjpDYxt3b/T7vVchiEjWCZwi1CMpVwXqwjDlW/MxplB+Jkzc lqU74CmNXCE7OnEnlVDx6l7H9lYwS19bltPDTH02R+lz3qH+KleAi07F/DoISGAQQfZT JdDA== X-Gm-Message-State: ALoCoQmgMAq2+LVgMrcX9j7sAwSgP5Ea3Cf16Tlzjq9BAQHp736cGZCQ1riug669gKbDNXVQMSM1 X-Received: by 10.152.2.40 with SMTP id 8mr1317lar.7.1418589415141; Sun, 14 Dec 2014 12:36:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.50 with SMTP id u18ls624198laz.96.gmail; Sun, 14 Dec 2014 12:36:54 -0800 (PST) X-Received: by 10.112.205.65 with SMTP id le1mr26791972lbc.54.1418589414841; Sun, 14 Dec 2014 12:36:54 -0800 (PST) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com. [2a00:1450:4010:c03::234]) by mx.google.com with ESMTPS id f6si8568028lbc.11.2014.12.14.12.36.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Dec 2014 12:36:54 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) client-ip=2a00:1450:4010:c03::234; Received: by mail-la0-f52.google.com with SMTP id hs14so8315998lab.25 for ; Sun, 14 Dec 2014 12:36:54 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr4072737lbc.91.1418589414770; Sun, 14 Dec 2014 12:36:54 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp538681lbb; Sun, 14 Dec 2014 12:36:53 -0800 (PST) X-Received: by 10.68.108.4 with SMTP id hg4mr7502824pbb.19.1418589412221; Sun, 14 Dec 2014 12:36:52 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id te6si10919835pbc.227.2014.12.14.12.36.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Dec 2014 12:36:52 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-387362-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 17220 invoked by alias); 14 Dec 2014 20:36:39 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 17210 invoked by uid 89); 14 Dec 2014 20:36:39 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f180.google.com Received: from mail-lb0-f180.google.com (HELO mail-lb0-f180.google.com) (209.85.217.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 14 Dec 2014 20:36:38 +0000 Received: by mail-lb0-f180.google.com with SMTP id l4so8299151lbv.11 for ; Sun, 14 Dec 2014 12:36:34 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.112.24.130 with SMTP id u2mr26599652lbf.57.1418589394616; Sun, 14 Dec 2014 12:36:34 -0800 (PST) Received: by 10.25.211.16 with HTTP; Sun, 14 Dec 2014 12:36:34 -0800 (PST) In-Reply-To: References: Date: Mon, 15 Dec 2014 02:06:34 +0530 Message-ID: Subject: Re: [match-and-simplify] print capture name From: Prathamesh Kulkarni To: rguenther@suse.de, gcc-patches@gcc.gnu.org X-IsSubscribed: yes X-Original-Sender: prathamesh.kulkarni@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::234 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On 15 December 2014 at 02:03, Prathamesh Kulkarni wrote: > Print name of capture in patterns written by user. > > * genmatch.c > (capture::name): New. > (capture::capture): New default argument. > (parse_capture): Pass id to capture::capture. > (print_operand): Print name of capture if available. > oops, forgot to attach the patch. > Thanks, > Prathamesh Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 218664) +++ gcc/genmatch.c (working copy) @@ -508,12 +508,15 @@ struct capture : public operand { - capture (unsigned where_, operand *what_) - : operand (OP_CAPTURE), where (where_), what (what_) {} + capture (unsigned where_, operand *what_, const char *name_ = 0) + : operand (OP_CAPTURE), where (where_), what (what_), name (name_) {} /* Identifier index for the value. */ unsigned where; /* The captured value. */ operand *what; + /* The original capture name */ + const char *name; + virtual void gen_transform (FILE *f, const char *, bool, int, const char *, capture_info *, dt_operand ** = 0, bool = true); @@ -605,6 +608,8 @@ if (capture *c = dyn_cast (o)) { fprintf (f, "@%u", c->where); + if (c->name) + fprintf (f, "(%s)", c->name); if (c->what && flattened == false) { putc (':', f); @@ -2940,7 +2945,7 @@ unsigned &num = capture_ids->get_or_insert (id, &existed); if (!existed) num = next_id; - return new capture (num, op); + return new capture (num, op, id); } /* Parse an expression