From patchwork Fri Oct 17 14:47:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 400541 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 E8B9E14009A for ; Sat, 18 Oct 2014 01:47:31 +1100 (AEDT) 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:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=hwm5IhTx+dXpQ3mg+lZOa1FxsrG7VM6eHAwiX5C1lFgxUW3lOs0Do WDXoCmMhiXv3fOe38IMNPBsjre4ixtWC4HwiZMABj20+qLw0dpgFaTevOf+/lr63 ayfNPupqS7uFc1PKGLYuhdQX/PFCWMI1GXSFPzbExxUMtsh74ujv6o= 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:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=Kfoy1AijTxiecBeo+yjODRkplM4=; b=Ym0IhIypMyOR+ucBsJ3W3HEvESTK rJFdSBlMc8xws80NXPDXJmgFrjGHnsPfCj+lNvqCX+O6lAUjUeve4SrsL4lJhrYO z2UKgqIkjRbgV6luNdJK+3sYsAoUy+3mTqIBjkpnQCGUGOBagXrP3ufWSJqc0+n1 q8UZ1KwnefRboNA= Received: (qmail 18961 invoked by alias); 17 Oct 2014 14:47:24 -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 18952 invoked by uid 89); 17 Oct 2014 14:47:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Oct 2014 14:47:23 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 17 Oct 2014 15:47:20 +0100 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Oct 2014 15:47:19 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, vmakarov@redhat.com, ubizjak@gmail.com, markus@trippelsdorf.de, Ganesh.Gopalasubramanian@amd.com, richard.sandiford@arm.com Cc: vmakarov@redhat.com, ubizjak@gmail.com, markus@trippelsdorf.de, Ganesh.Gopalasubramanian@amd.com Subject: [PATCH 1/5] Add recog_constrain_insn References: <87bnpabvvx.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 17 Oct 2014 15:47:18 +0100 In-Reply-To: <87bnpabvvx.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 17 Oct 2014 15:42:26 +0100") Message-ID: <874mv2bvnt.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 114101715472001901 This patch just adds a new utility function called recog_constrain_insn, to go alongside the existing recog_constrain_insn_cached. Note that the extract_insn in lra.c wasn't used when checking is disabled. The function just moved on to the next instruction straight away. Richard gcc/ * recog.h (extract_constrain_insn): Declare. * recog.c (extract_constrain_insn): New function. * lra.c (check_rtl): Use it. * postreload.c (reload_cse_simplify_operands): Likewise. * reg-stack.c (check_asm_stack_operands): Likewise. (subst_asm_stack_regs): Likewise. * regcprop.c (copyprop_hardreg_forward_1): Likewise. * regrename.c (build_def_use): Likewise. * sel-sched.c (get_reg_class): Likewise. * config/arm/arm.c (note_invalid_constants): Likewise. * config/s390/predicates.md (execute_operation): Likewise. Index: gcc/recog.h =================================================================== --- gcc/recog.h 2014-09-18 11:40:31.223690858 +0100 +++ gcc/recog.h 2014-10-17 15:44:50.219398486 +0100 @@ -134,6 +134,7 @@ extern void add_clobbers (rtx, int); extern int added_clobbers_hard_reg_p (int); extern void insn_extract (rtx_insn *); extern void extract_insn (rtx_insn *); +extern void extract_constrain_insn (rtx_insn *insn); extern void extract_constrain_insn_cached (rtx_insn *); extern void extract_insn_cached (rtx_insn *); extern void preprocess_constraints (int, int, const char **, Index: gcc/recog.c =================================================================== --- gcc/recog.c 2014-09-22 08:36:23.889794255 +0100 +++ gcc/recog.c 2014-10-17 15:44:50.219398486 +0100 @@ -2110,6 +2110,17 @@ extract_insn_cached (rtx_insn *insn) recog_data.insn = insn; } +/* Do uncached extract_insn, constrain_operands and complain about failures. + This should be used when extracting a pre-existing constrained instruction + if the caller wants to know which alternative was chosen. */ +void +extract_constrain_insn (rtx_insn *insn) +{ + extract_insn (insn); + if (!constrain_operands (reload_completed)) + fatal_insn_not_found (insn); +} + /* Do cached extract_insn, constrain_operands and complain about failures. Used by insn_attrtab. */ void Index: gcc/lra.c =================================================================== --- gcc/lra.c 2014-09-26 16:05:57.868394574 +0100 +++ gcc/lra.c 2014-10-17 15:44:50.219398486 +0100 @@ -1919,8 +1919,9 @@ check_rtl (bool final_p) { if (final_p) { - extract_insn (insn); - lra_assert (constrain_operands (1)); +#ifdef ENABLED_CHECKING + extract_constrain_insn (insn); +#endif continue; } /* LRA code is based on assumption that all addresses can be Index: gcc/postreload.c =================================================================== --- gcc/postreload.c 2014-08-26 12:09:02.182959856 +0100 +++ gcc/postreload.c 2014-10-17 15:44:50.219398486 +0100 @@ -401,15 +401,11 @@ reload_cse_simplify_operands (rtx_insn * /* Array of alternatives, sorted in order of decreasing desirability. */ int *alternative_order; - extract_insn (insn); + extract_constrain_insn (insn); if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0) return 0; - /* Figure out which alternative currently matches. */ - if (! constrain_operands (1)) - fatal_insn_not_found (insn); - alternative_reject = XALLOCAVEC (int, recog_data.n_alternatives); alternative_nregs = XALLOCAVEC (int, recog_data.n_alternatives); alternative_order = XALLOCAVEC (int, recog_data.n_alternatives); Index: gcc/reg-stack.c =================================================================== --- gcc/reg-stack.c 2014-09-18 11:40:31.307689884 +0100 +++ gcc/reg-stack.c 2014-10-17 15:44:50.219398486 +0100 @@ -469,8 +469,7 @@ check_asm_stack_operands (rtx_insn *insn /* Find out what the constraints require. If no constraint alternative matches, this asm is malformed. */ - extract_insn (insn); - constrain_operands (1); + extract_constrain_insn (insn); preprocess_constraints (insn); @@ -2016,8 +2015,7 @@ subst_asm_stack_regs (rtx_insn *insn, st /* Find out what the constraints required. If no constraint alternative matches, that is a compiler bug: we should have caught such an insn in check_asm_stack_operands. */ - extract_insn (insn); - constrain_operands (1); + extract_constrain_insn (insn); preprocess_constraints (insn); const operand_alternative *op_alt = which_op_alt (); Index: gcc/regcprop.c =================================================================== --- gcc/regcprop.c 2014-10-13 08:02:41.225135081 +0100 +++ gcc/regcprop.c 2014-10-17 15:44:50.227398391 +0100 @@ -762,9 +762,7 @@ copyprop_hardreg_forward_1 (basic_block } set = single_set (insn); - extract_insn (insn); - if (! constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); preprocess_constraints (insn); const operand_alternative *op_alt = which_op_alt (); n_ops = recog_data.n_operands; @@ -865,9 +863,7 @@ copyprop_hardreg_forward_1 (basic_block } /* We need to re-extract as validate_change clobbers recog_data. */ - extract_insn (insn); - if (! constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); preprocess_constraints (insn); } @@ -893,9 +889,7 @@ copyprop_hardreg_forward_1 (basic_block } /* We need to re-extract as validate_change clobbers recog_data. */ - extract_insn (insn); - if (! constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); preprocess_constraints (insn); } } Index: gcc/regrename.c =================================================================== --- gcc/regrename.c 2014-08-26 12:08:57.679011819 +0100 +++ gcc/regrename.c 2014-10-17 15:44:50.227398391 +0100 @@ -1564,9 +1564,7 @@ build_def_use (basic_block bb) to be marked unrenamable or even cause us to abort the entire basic block. */ - extract_insn (insn); - if (! constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); preprocess_constraints (insn); const operand_alternative *op_alt = which_op_alt (); n_ops = recog_data.n_operands; Index: gcc/sel-sched.c =================================================================== --- gcc/sel-sched.c 2014-09-18 11:40:31.163691553 +0100 +++ gcc/sel-sched.c 2014-10-17 15:44:50.227398391 +0100 @@ -994,9 +994,7 @@ get_reg_class (rtx_insn *insn) { int i, n_ops; - extract_insn (insn); - if (! constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); preprocess_constraints (insn); n_ops = recog_data.n_operands; Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c 2014-09-22 08:36:24.541786033 +0100 +++ gcc/config/arm/arm.c 2014-10-17 15:44:50.215398533 +0100 @@ -17022,10 +17022,7 @@ note_invalid_constants (rtx_insn *insn, { int opno; - extract_insn (insn); - - if (!constrain_operands (1)) - fatal_insn_not_found (insn); + extract_constrain_insn (insn); if (recog_data.n_alternatives == 0) return; Index: gcc/config/s390/predicates.md =================================================================== --- gcc/config/s390/predicates.md 2014-09-12 08:26:02.847292053 +0100 +++ gcc/config/s390/predicates.md 2014-10-17 15:44:50.219398486 +0100 @@ -406,8 +406,7 @@ (define_special_predicate "execute_opera if (icode < 0) return false; - extract_insn (insn); - constrain_operands (1); + extract_constrain_insn (insn); return which_alternative >= 0; })