From patchwork Wed May 20 10:47:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 48794 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7CAF221411 for ; Wed, 20 May 2015 10:48:00 +0000 (UTC) Received: by wixv7 with SMTP id v7sf18584514wix.0 for ; Wed, 20 May 2015 03:47:59 -0700 (PDT) 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:date:message-id:subject:from:to :content-type:x-original-sender:x-original-authentication-results; bh=9QIEuCi/a7r1ITPGPGgOX0pXXyESMeuU2Lqj5p72v9I=; b=LAf80x1uNh7Xz1JXB1qv75N1Pi/ScFzAwmXLyrNeIEDcwF4mzF5kR5AX8UoRTmFPuH 5ZXtcXwdPwd2XGcJVpdj285ehhXIysULZi3ibgdMA26I7cWEiuoep2wz0BbnyC/nEshM iALN10R+ve/2uOLCFMIs+yMgvX2H7kIREJ8/fawxMC5l12wNQBZROhDzo7PfYLrbmyIw 6YmudDccUbicd5SojBzxeWT95Z1OFjEtsXqnFpy9uVFfi3oLLinSKpKbm5Uf5lYFTDlY UfAnCj6Zxm41mY/lQ3wdPq26RN0kOs36+D6pji7/2Ni6XK5qoHpXPRQ7V6eCKs3BMCNw R5rg== X-Gm-Message-State: ALoCoQnSlnJw+K3HHx6M9yYhny0GPgTMGt1uSryfaBd2qg6VCaBZfVdWJn6YQi7atQGm1Dq+RcfP X-Received: by 10.180.12.77 with SMTP id w13mr2131890wib.4.1432118879753; Wed, 20 May 2015 03:47:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.245.43 with SMTP id xl11ls175474lac.21.gmail; Wed, 20 May 2015 03:47:59 -0700 (PDT) X-Received: by 10.152.30.100 with SMTP id r4mr24935008lah.107.1432118879583; Wed, 20 May 2015 03:47:59 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com. [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id x9si10945049lal.18.2015.05.20.03.47.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 03:47:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by lagr1 with SMTP id r1so67134537lag.0 for ; Wed, 20 May 2015 03:47:59 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr24885993lac.41.1432118879219; Wed, 20 May 2015 03:47:59 -0700 (PDT) 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.108.230 with SMTP id hn6csp1436060lbb; Wed, 20 May 2015 03:47:57 -0700 (PDT) X-Received: by 10.66.155.197 with SMTP id vy5mr63127819pab.104.1432118875804; Wed, 20 May 2015 03:47:55 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id mk3si25906844pdb.222.2015.05.20.03.47.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 03:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-398368-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 16864 invoked by alias); 20 May 2015 10:47: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 16851 invoked by uid 89); 20 May 2015 10:47:38 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f42.google.com Received: from mail-la0-f42.google.com (HELO mail-la0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 20 May 2015 10:47:37 +0000 Received: by labbd9 with SMTP id bd9so67919939lab.2 for ; Wed, 20 May 2015 03:47:33 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.157.100 with SMTP id wl4mr25456072lbb.20.1432118853424; Wed, 20 May 2015 03:47:33 -0700 (PDT) Received: by 10.25.205.146 with HTTP; Wed, 20 May 2015 03:47:33 -0700 (PDT) Date: Wed, 20 May 2015 16:17:33 +0530 Message-ID: Subject: [match-and-simplify] reject expanding operator-list to implicit 'for' From: Prathamesh Kulkarni To: Richard Biener , gcc Patches 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::22d 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 Hi, This patch rejects expanding operator-list to implicit 'for'. OK for trunk after bootstrap+testing ? Thanks, Prathamesh 2015-05-20 Prathamesh Kulkarni * genmatch.c (parser::record_operlist): Remove. (parser::oper_lists_set): Likewise. (parser::oper_lists): Likewise. (parser::parse_operation): Reject operator-list and remove call to parser::record_operlist. (parser::parse_c_expr): Remove call to parser::record_operlist. (parser::push_simplify): Remove pushing and popping parser::oper_lists in parser::active_fors. (parser::parse_simplify): Avoid initializing parser::oper_lists and parser::oper_lists_set. (parser::parser): Likewise. Index: genmatch.c =================================================================== --- genmatch.c (revision 223437) +++ genmatch.c (working copy) @@ -2714,7 +2714,6 @@ c_expr *parse_c_expr (cpp_ttype); operand *parse_op (); - void record_operlist (source_location, user_id *); void parse_pattern (); void push_simplify (vec&, operand *, source_location, @@ -2729,9 +2728,6 @@ cpp_reader *r; vec active_ifs; vec > active_fors; - hash_set *oper_lists_set; - vec oper_lists; - cid_map_t *capture_ids; public: @@ -2860,22 +2856,6 @@ return (const char *)token->val.str.text; } - -/* Record an operator-list use for transparent for handling. */ - -void -parser::record_operlist (source_location loc, user_id *p) -{ - if (!oper_lists_set->add (p)) - { - if (!oper_lists.is_empty () - && oper_lists[0]->substitutes.length () != p->substitutes.length ()) - fatal_at (loc, "User-defined operator list does not have the " - "same number of entries as others used in the pattern"); - oper_lists.safe_push (p); - } -} - /* Parse the operator ID, special-casing convert?, convert1? and convert2? */ @@ -2913,7 +2893,7 @@ user_id *p = dyn_cast (op); if (p && p->is_oper_list) - record_operlist (id_tok->src_loc, p); + fatal_at (id_tok, "invalid use of operator-list %s", id); return op; } @@ -3051,11 +3031,8 @@ /* If this is possibly a user-defined identifier mark it used. */ if (token->type == CPP_NAME) { - id_base *idb = get_operator ((const char *)CPP_HASHNODE - (token->val.node.node)->ident.str); - user_id *p; - if (idb && (p = dyn_cast (idb)) && p->is_oper_list) - record_operlist (token->src_loc, p); + get_operator ((const char *)CPP_HASHNODE + (token->val.node.node)->ident.str); } /* Record the token. */ @@ -3140,16 +3117,9 @@ operand *match, source_location match_loc, operand *result, source_location result_loc) { - /* Build and push a temporary for for operator list uses in expressions. */ - if (!oper_lists.is_empty ()) - active_fors.safe_push (oper_lists); - simplifiers.safe_push (new simplify (match, match_loc, result, result_loc, active_ifs.copy (), active_fors.copy (), capture_ids)); - - if (!oper_lists.is_empty ()) - active_fors.pop (); } /* Parse @@ -3170,11 +3140,7 @@ /* Reset the capture map. */ if (!capture_ids) capture_ids = new cid_map_t; - /* Reset oper_lists and set. */ - hash_set olist; - oper_lists_set = &olist; - oper_lists = vNULL; - + const cpp_token *loc = peek (); parsing_match_operand = true; struct operand *match = parse_op (); @@ -3563,8 +3529,6 @@ active_ifs = vNULL; active_fors = vNULL; simplifiers = vNULL; - oper_lists_set = NULL; - oper_lists = vNULL; capture_ids = NULL; user_predicates = vNULL; parsing_match_operand = false;