From ad1c1eeb76df357dacedaa1e6f3be33e3e8514e5 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 15 Feb 2011 12:46:51 +0000 Subject: [PATCH] make fr30 use constraints.md make fr30 use constraints.md * 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. From-SVN: r170172 --- gcc/ChangeLog | 8 ++++ gcc/config/fr30/constraints.md | 72 ++++++++++++++++++++++++++++++++++ gcc/config/fr30/fr30.h | 71 --------------------------------- gcc/config/fr30/fr30.md | 1 + 4 files changed, 81 insertions(+), 71 deletions(-) create mode 100644 gcc/config/fr30/constraints.md diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0db9e5504eb..600f6802171 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-02-15 Nathan Froyd + + * 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. + 2011-02-15 Nathan Froyd * config/frv/constraints.md: New file. diff --git a/gcc/config/fr30/constraints.md b/gcc/config/fr30/constraints.md new file mode 100644 index 00000000000..2fb0491598e --- /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 549c9275c2d..d20d7fb79c3 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. */ @@ -403,53 +379,6 @@ enum reg_class the reload pass. */ #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. */ diff --git a/gcc/config/fr30/fr30.md b/gcc/config/fr30/fr30.md index f95559f3d46..6b35599837f 100644 --- a/gcc/config/fr30/fr30.md +++ b/gcc/config/fr30/fr30.md @@ -54,6 +54,7 @@ ) (include "predicates.md") +(include "constraints.md") ;;}}} ;;{{{ Moves