From patchwork Mon Feb 14 16:34:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 83122 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]) by ozlabs.org (Postfix) with SMTP id 6CBE3B7108 for ; Tue, 15 Feb 2011 03:34:20 +1100 (EST) Received: (qmail 30486 invoked by alias); 14 Feb 2011 16:34:15 -0000 Received: (qmail 30290 invoked by uid 22791); 14 Feb 2011 16:34:12 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL, BAYES_00, MEDICAL_SUBJECT, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 16:34:07 +0000 Received: (qmail 20820 invoked from network); 14 Feb 2011 16:34:05 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Feb 2011 16:34:05 -0000 Date: Mon, 14 Feb 2011 08:34:05 -0800 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: nickc@redhat.com Subject: [PATCH] make fr30 use constraints.md Message-ID: <20110214163404.GD6247@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-IsSubscribed: yes 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 As $SUBJECT suggests. Tested with cross to fr30-elf. OK to commit? -Nathan * config/fr30/constraints.md: New file. * config/fr30/fr30.md: Include it. * config/fr30/fr30.h (REG_CLASS_FROM_LETTER): Delete. (CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete. (EXTRA_CONSTRAINT): Delete. diff --git a/gcc/config/fr30/constraints.md b/gcc/config/fr30/constraints.md new file mode 100644 index 0000000..2fb0491 --- /dev/null +++ b/gcc/config/fr30/constraints.md @@ -0,0 +1,72 @@ +;; Constraint definitions for the FR30. +;; Copyright (C) 2011 +;; Free Software Foundation, Inc. + +;; This file is part of GCC. + +;; GCC is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GCC is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; . + +;; Register constraints. +(define_register_constraint "d" "MULTIPLY_64_REG" + "The MDH,MDL register pair as used by MUL and MULU.") + +(define_register_constraint "e" "MULTIPLY_32_REG" + "The MDL register as used by MULH and MULUH.") + +(define_register_constraint "h" "HIGH_REGS" + "Registers 8 through 15.") + +(define_register_constraint "l" "LOW_REGS" + "Registers 0 through 7.") + +(define_register_constraint "a" "ALL_REGS" + "@internal") + +;; Integer constraints. +(define_constraint "I" + "An integer in the range 0 to 15." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, 0, 15)"))) + +(define_constraint "J" + "An integer in the range -16 to -1." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, -16, -1)"))) + +(define_constraint "K" + "An integer in the range 16 to 31." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, 16, 31)"))) + +(define_constraint "L" + "An integer in the range 0 to 255." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, 0, 255)"))) + +(define_constraint "M" + "An integer in the range 0 to 1048575." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, 0, 1048575)"))) + +(define_constraint "P" + "An integer in the range -256 to 255." + (and (match_code "const_int") + (match_test "IN_RANGE (ival, -256, 255)"))) + +;; Extra constraints. +(define_constraint "Q" + "@internal" + (and (match_code "mem") + (match_code "symbol_ref" "0"))) diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 549c927..d20d7fb 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -350,30 +350,6 @@ enum reg_class (as well as added to a displacement). */ #define INDEX_REG_CLASS REAL_REGS -/* A C expression which defines the machine-dependent operand constraint - letters for register classes. If CHAR is such a letter, the value should be - the register class corresponding to it. Otherwise, the value should be - `NO_REGS'. The register letter `r', corresponding to class `GENERAL_REGS', - will not be passed to this macro; you do not need to handle it. - - The following letters are unavailable, due to being used as - constraints: - '0'..'9' - '<', '>' - 'E', 'F', 'G', 'H' - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' - 'Q', 'R', 'S', 'T', 'U' - 'V', 'X' - 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's' */ - -#define REG_CLASS_FROM_LETTER(CHAR) \ - ( (CHAR) == 'd' ? MULTIPLY_64_REG \ - : (CHAR) == 'e' ? MULTIPLY_32_REG \ - : (CHAR) == 'h' ? HIGH_REGS \ - : (CHAR) == 'l' ? LOW_REGS \ - : (CHAR) == 'a' ? ALL_REGS \ - : NO_REGS) - /* A C expression which is nonzero if register number NUM is suitable for use as a base register in operand addresses. It may be either a suitable hard register or a pseudo register that has been allocated such a hard register. */ @@ -404,53 +380,6 @@ enum reg_class #define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (0, MODE) /*}}}*/ -/*{{{ CONSTANTS. */ - -/* A C expression that defines the machine-dependent operand constraint letters - (`I', `J', `K', .. 'P') that specify particular ranges of integer values. - If C is one of those letters, the expression should check that VALUE, an - integer, is in the appropriate range and return 1 if so, 0 otherwise. If C - is not one of those letters, the value should be 0 regardless of VALUE. */ -#define CONST_OK_FOR_LETTER_P(VALUE, C) \ - ( (C) == 'I' ? IN_RANGE (VALUE, 0, 15) \ - : (C) == 'J' ? IN_RANGE (VALUE, -16, -1) \ - : (C) == 'K' ? IN_RANGE (VALUE, 16, 31) \ - : (C) == 'L' ? IN_RANGE (VALUE, 0, (1 << 8) - 1) \ - : (C) == 'M' ? IN_RANGE (VALUE, 0, (1 << 20) - 1) \ - : (C) == 'P' ? IN_RANGE (VALUE, -(1 << 8), (1 << 8) - 1) \ - : 0) - -/* A C expression that defines the machine-dependent operand constraint letters - (`G', `H') that specify particular ranges of `const_double' values. - - If C is one of those letters, the expression should check that VALUE, an RTX - of code `const_double', is in the appropriate range and return 1 if so, 0 - otherwise. If C is not one of those letters, the value should be 0 - regardless of VALUE. - - `const_double' is used for all floating-point constants and for `DImode' - fixed-point constants. A given letter can accept either or both kinds of - values. It can use `GET_MODE' to distinguish between these kinds. */ -#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 - -/* A C expression that defines the optional machine-dependent constraint - letters (`Q', `R', `S', `T', `U') that can be used to segregate specific - types of operands, usually memory references, for the target machine. - Normally this macro will not be defined. If it is required for a particular - target machine, it should return 1 if VALUE corresponds to the operand type - represented by the constraint letter C. If C is not defined as an extra - constraint, the value returned should be 0 regardless of VALUE. - - For example, on the ROMP, load instructions cannot have their output in r0 - if the memory reference contains a symbolic address. Constraint letter `Q' - is defined as representing a memory address that does *not* contain a - symbolic address. An alternative is specified with a `Q' constraint on the - input and `r' on the output. The next alternative specifies `m' on the - input and a register class that does not include r0 on the output. */ -#define EXTRA_CONSTRAINT(VALUE, C) \ - ((C) == 'Q' ? (GET_CODE (VALUE) == MEM && GET_CODE (XEXP (VALUE, 0)) == SYMBOL_REF) : 0) - -/*}}}*/ /*{{{ Basic Stack Layout. */ /* Define this macro if pushing a word onto the stack moves the stack pointer diff --git a/gcc/config/fr30/fr30.md b/gcc/config/fr30/fr30.md index f95559f..6b35599 100644 --- a/gcc/config/fr30/fr30.md +++ b/gcc/config/fr30/fr30.md @@ -54,6 +54,7 @@ ) (include "predicates.md") +(include "constraints.md") ;;}}} ;;{{{ Moves