From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5613 invoked by alias); 5 Jun 2014 21:38:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 5591 invoked by uid 89); 5 Jun 2014 21:38:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 05 Jun 2014 21:37:54 +0000 Received: by mail-wg0-f50.google.com with SMTP id b13so924045wgh.33 for ; Thu, 05 Jun 2014 14:37:51 -0700 (PDT) X-Received: by 10.194.216.162 with SMTP id or2mr752698wjc.0.1402004271818; Thu, 05 Jun 2014 14:37:51 -0700 (PDT) Received: from localhost ([2.26.169.52]) by mx.google.com with ESMTPSA id fn1sm9641271wib.18.2014.06.05.14.37.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jun 2014 14:37:51 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 6/8] Treat 'I'-'P' as separate subtype References: <87sinj9hhy.fsf@talisman.default> Date: Thu, 05 Jun 2014 21:38:00 -0000 In-Reply-To: <87sinj9hhy.fsf@talisman.default> (Richard Sandiford's message of "Thu, 05 Jun 2014 22:24:57 +0100") Message-ID: <8738fj9gwh.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-06/txt/msg00528.txt.bz2 This patch extends patch 4 to have a CT_CONST_INT type for CONST_INT constraints ('I'-'P'), which are already handled by things like constraint_satisfied_p. On its own this has little effect, since most places handle 'I'-'P' as a separate case statement anyway. It's really just making way for the final patch. It might be worth adding a define_const_int_constraint so that 'I'-'P' are less special. Richard gcc/ * genpreds.c (const_int_start, const_int_end): New variables. (choose_enum_order): Output CONST_INT constraints before memory constraints. (write_tm_preds_h): Always define insn_const_int_ok_for_constraint. Add CT_CONST_INT. * ira-costs.c (record_reg_classes): Handle CT_CONST_INT. * ira.c (ira_setup_alts): Likewise. * lra-constraints.c (process_alt_operands): Likewise. * recog.c (asm_operand_ok, preprocess_constraints): Likewise. * reload.c (find_reloads): Likewise. Index: gcc/genpreds.c =================================================================== --- gcc/genpreds.c 2014-06-04 18:46:18.253815502 +0100 +++ gcc/genpreds.c 2014-06-04 18:57:19.968858594 +0100 @@ -690,6 +690,7 @@ static const char const_dbl_constraints[ static const constraint_data **enum_order; static unsigned int register_start, register_end; static unsigned int satisfied_start; +static unsigned int const_int_start, const_int_end; static unsigned int memory_start, memory_end; static unsigned int address_start, address_end; @@ -931,6 +932,12 @@ choose_enum_order (void) satisfied_start = next; + const_int_start = next; + FOR_ALL_CONSTRAINTS (c) + if (c->is_const_int) + enum_order[next++] = c; + const_int_end = next; + memory_start = next; FOR_ALL_CONSTRAINTS (c) if (c->is_memory) @@ -944,7 +951,7 @@ choose_enum_order (void) address_end = next; FOR_ALL_CONSTRAINTS (c) - if (!c->is_register && !c->is_memory && !c->is_address) + if (!c->is_register && !c->is_const_int && !c->is_memory && !c->is_address) enum_order[next++] = c; gcc_assert (next == num_constraints); } @@ -1361,6 +1368,13 @@ #define GCC_TM_PREDS_H\n\ "#define CONST_OK_FOR_CONSTRAINT_P(v_,c_,s_) \\\n" " insn_const_int_ok_for_constraint (v_, " "lookup_constraint (s_))\n"); + else + puts ("static inline bool\n" + "insn_const_int_ok_for_constraint (HOST_WIDE_INT," + " enum constraint_num)\n" + "{\n" + " return false;\n" + "}\n"); if (have_const_dbl_constraints) puts ("#define CONST_DOUBLE_OK_FOR_CONSTRAINT_P(v_,c_,s_) \\\n" " constraint_satisfied_p (v_, lookup_constraint (s_))\n"); @@ -1370,6 +1384,7 @@ #define GCC_TM_PREDS_H\n\ puts ("enum constraint_type\n" "{\n" " CT_REGISTER,\n" + " CT_CONST_INT,\n" " CT_MEMORY,\n" " CT_ADDRESS,\n" " CT_FIXED_FORM\n" @@ -1378,7 +1393,9 @@ #define GCC_TM_PREDS_H\n\ "static inline enum constraint_type\n" "get_constraint_type (enum constraint_num c)\n" "{"); - auto_vec , 3> values; + auto_vec , 4> values; + if (const_int_start != const_int_end) + values.safe_push (std::make_pair (const_int_start, "CT_CONST_INT")); if (memory_start != memory_end) values.safe_push (std::make_pair (memory_start, "CT_MEMORY")); if (address_start != address_end) Index: gcc/ira-costs.c =================================================================== --- gcc/ira-costs.c 2014-06-04 18:46:18.250815475 +0100 +++ gcc/ira-costs.c 2014-06-04 18:57:19.969858603 +0100 @@ -763,6 +763,12 @@ record_reg_classes (int n_alts, int n_op classes[i] = ira_reg_class_subunion[classes[i]][cl]; break; + case CT_CONST_INT: + if (CONST_INT_P (op) + && insn_const_int_ok_for_constraint (INTVAL (op), cn)) + win = 1; + break; + case CT_MEMORY: /* Every MEM can be reloaded to fit. */ insn_allows_mem[i] = allows_mem[i] = 1; Index: gcc/ira.c =================================================================== --- gcc/ira.c 2014-06-04 18:46:18.245815430 +0100 +++ gcc/ira.c 2014-06-04 18:57:19.971858622 +0100 @@ -1936,6 +1936,13 @@ ira_setup_alts (rtx insn, HARD_REG_SET & goto op_success; break; + case CT_CONST_INT: + if (CONST_INT_P (op) + && (insn_const_int_ok_for_constraint + (INTVAL (op), cn))) + goto op_success; + break; + case CT_ADDRESS: case CT_MEMORY: goto op_success; Index: gcc/lra-constraints.c =================================================================== --- gcc/lra-constraints.c 2014-06-04 18:52:10.976036815 +0100 +++ gcc/lra-constraints.c 2014-06-04 18:57:19.973858640 +0100 @@ -2041,6 +2041,12 @@ process_alt_operands (int only_alternati goto reg; break; + case CT_CONST_INT: + if (CONST_INT_P (op) + && insn_const_int_ok_for_constraint (INTVAL (op), cn)) + win = true; + break; + case CT_MEMORY: if (MEM_P (op) && satisfies_memory_constraint_p (op, cn)) Index: gcc/recog.c =================================================================== --- gcc/recog.c 2014-06-04 18:57:18.145841967 +0100 +++ gcc/recog.c 2014-06-04 18:57:19.975858658 +0100 @@ -1920,6 +1920,13 @@ asm_operand_ok (rtx op, const char *cons goto reg; break; + case CT_CONST_INT: + if (!result + && CONST_INT_P (op) + && insn_const_int_ok_for_constraint (INTVAL (op), cn)) + result = 1; + break; + case CT_MEMORY: /* Every memory operand can be reloaded to fit. */ result = result || memory_operand (op, VOIDmode); @@ -2443,6 +2450,9 @@ preprocess_constraints (int n_operands, op_alt[i].cl = reg_class_subunion[op_alt[i].cl][cl]; break; + case CT_CONST_INT: + break; + case CT_MEMORY: op_alt[i].memory_ok = 1; break; Index: gcc/reload.c =================================================================== --- gcc/reload.c 2014-06-04 18:46:18.256815529 +0100 +++ gcc/reload.c 2014-06-04 18:57:19.977858677 +0100 @@ -3504,6 +3504,13 @@ find_reloads (rtx insn, int replace, int goto reg; break; + case CT_CONST_INT: + if (CONST_INT_P (operand) + && (insn_const_int_ok_for_constraint + (INTVAL (operand), cn))) + win = true; + break; + case CT_MEMORY: if (force_reload) break;