make stormy16 use constraints.md
make stormy16 use constraints.md * config/stormy16/constraints.md: New file. * config/stormy16/predicates.md (nonimmediate_nonstack_operand): Use satisfies_constraint_Q and satisfies_constraint_R. * config/stormy16/stomry16-protos.h (xstormy16_extra_constraint_p): Delete. (xstormy16_legitiamte_address_p): Declare. * config/stormy16/stormy16.h (REG_CLASS_FROM_LETTER): Delete. (CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete. (EXTRA_CONSTRAINT): Delete. * config/stormy16/stormy16.c (xstormy16_legitiamte_address_p): Un-staticize. (xstormy16_extra_constraint_p): Delete. From-SVN: r170152
This commit is contained in:
parent
400a2d2437
commit
d634083bd4
|
@ -1,3 +1,18 @@
|
|||
2011-02-14 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* config/stormy16/constraints.md: New file.
|
||||
* config/stormy16/predicates.md (nonimmediate_nonstack_operand):
|
||||
Use satisfies_constraint_Q and satisfies_constraint_R.
|
||||
* config/stormy16/stomry16-protos.h (xstormy16_extra_constraint_p):
|
||||
Delete.
|
||||
(xstormy16_legitiamte_address_p): Declare.
|
||||
* config/stormy16/stormy16.h (REG_CLASS_FROM_LETTER): Delete.
|
||||
(CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete.
|
||||
(EXTRA_CONSTRAINT): Delete.
|
||||
* config/stormy16/stormy16.c (xstormy16_legitiamte_address_p):
|
||||
Un-staticize.
|
||||
(xstormy16_extra_constraint_p): Delete.
|
||||
|
||||
2011-02-14 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
PR tree-optimization/46494
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
;; Constraint definitions for XSTORMY16.
|
||||
;; 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
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
;; Register constraints.
|
||||
(define_register_constraint "a" "R0_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "b" "R1_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "c" "R2_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "d" "R8_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "e" "EIGHT_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "t" "TWO_REGS"
|
||||
"@internal")
|
||||
|
||||
(define_register_constraint "z" "ICALL_REGS"
|
||||
"@internal")
|
||||
|
||||
;; Integer constraints.
|
||||
(define_constraint "I"
|
||||
"An integer between 0 and 3."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, 0, 3)")))
|
||||
|
||||
(define_constraint "J"
|
||||
"A power of two."
|
||||
(and (match_code "const_int")
|
||||
(match_test "exact_log2 (ival) != -1")))
|
||||
|
||||
(define_constraint "K"
|
||||
"A power of two when inverted."
|
||||
(and (match_code "const_int")
|
||||
(match_test "exact_log2 (~ival) != -1")))
|
||||
|
||||
(define_constraint "L"
|
||||
"An 8-bit unsigned integer."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, 0, 255)")))
|
||||
|
||||
(define_constraint "M"
|
||||
"An integer between -255 and 0."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, -255, 0)")))
|
||||
|
||||
(define_constraint "N"
|
||||
"An integer between -3 and 0."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, -3, 0)")))
|
||||
|
||||
(define_constraint "O"
|
||||
"An integer between 1 and 4."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, 1, 4)")))
|
||||
|
||||
(define_constraint "P"
|
||||
"An integer between -4 and -1."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, -4, -1)")))
|
||||
|
||||
;; Extra constraints.
|
||||
(define_constraint "Q"
|
||||
"A register push operation."
|
||||
(and (match_code "mem")
|
||||
(match_code "post_inc" "0")
|
||||
(match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx")))
|
||||
|
||||
(define_constraint "R"
|
||||
"A register pop operation."
|
||||
(and (match_code "mem")
|
||||
(match_code "pre_dec" "0")
|
||||
(match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx")))
|
||||
|
||||
(define_constraint "S"
|
||||
"An immediate memory address."
|
||||
(and (match_code "mem")
|
||||
(match_code "const_int" "0")
|
||||
(match_test "xstormy16_legitimate_address_p (VOIDmode, XEXP (op, 0), false)")))
|
||||
|
||||
(define_constraint "T"
|
||||
"@internal"
|
||||
;; For Rx; not implemented yet.
|
||||
(match_test "0"))
|
||||
|
||||
(define_constraint "U"
|
||||
"An integer not between 2 and 15."
|
||||
(and (match_code "const_int")
|
||||
(match_test "!IN_RANGE (ival, 2, 15)")))
|
||||
|
||||
(define_constraint "W"
|
||||
"@internal"
|
||||
(match_operand 0 "xstormy16_below100_operand"))
|
||||
|
||||
(define_constraint "Z"
|
||||
"Zero."
|
||||
(and (match_code "const_int")
|
||||
(match_test "ival == 0")))
|
|
@ -140,8 +140,8 @@
|
|||
{
|
||||
/* 'Q' is for pushes, 'R' for pops. */
|
||||
return (nonimmediate_operand (op, mode)
|
||||
&& ! xstormy16_extra_constraint_p (op, 'Q')
|
||||
&& ! xstormy16_extra_constraint_p (op, 'R'));
|
||||
&& ! satisfies_constraint_Q (op)
|
||||
&& ! satisfies_constraint_R (op));
|
||||
})
|
||||
|
||||
(define_predicate "xstormy16_carry_plus_operand"
|
||||
|
|
|
@ -45,7 +45,6 @@ extern void xstormy16_emit_cbranch (enum rtx_code, rtx, rtx, rtx);
|
|||
extern char *xstormy16_output_cbranch_hi (rtx, const char *, int, rtx);
|
||||
extern char *xstormy16_output_cbranch_si (rtx, const char *, int, rtx);
|
||||
extern int xstormy16_mode_dependent_address_p (rtx);
|
||||
extern int xstormy16_extra_constraint_p (rtx, int);
|
||||
|
||||
extern void xstormy16_print_operand (FILE *, rtx, int);
|
||||
extern void xstormy16_print_operand_address (FILE *, rtx);
|
||||
|
@ -72,5 +71,6 @@ extern const char * xstormy16_output_shift (enum machine_mode, enum rtx_code,
|
|||
rtx, rtx, rtx);
|
||||
extern int xstormy16_below100_symbol (rtx, enum machine_mode);
|
||||
extern int xstormy16_splittable_below100_operand (rtx, enum machine_mode);
|
||||
extern bool xstormy16_legitimate_address_p (enum machine_mode, rtx, bool);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ xstormy16_expand_andqi3 (rtx *operands)
|
|||
&& INTVAL (X) + (OFFSET) < 0x8000 \
|
||||
&& (INTVAL (X) + (OFFSET) < 0x100 || INTVAL (X) + (OFFSET) >= 0x7F00))
|
||||
|
||||
static bool
|
||||
bool
|
||||
xstormy16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
|
||||
rtx x, bool strict)
|
||||
{
|
||||
|
@ -683,60 +683,6 @@ xstormy16_mode_dependent_address_p (rtx x)
|
|||
return 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. */
|
||||
|
||||
int
|
||||
xstormy16_extra_constraint_p (rtx x, int c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
/* 'Q' is for pushes. */
|
||||
case 'Q':
|
||||
return (MEM_P (x)
|
||||
&& GET_CODE (XEXP (x, 0)) == POST_INC
|
||||
&& XEXP (XEXP (x, 0), 0) == stack_pointer_rtx);
|
||||
|
||||
/* 'R' is for pops. */
|
||||
case 'R':
|
||||
return (MEM_P (x)
|
||||
&& GET_CODE (XEXP (x, 0)) == PRE_DEC
|
||||
&& XEXP (XEXP (x, 0), 0) == stack_pointer_rtx);
|
||||
|
||||
/* 'S' is for immediate memory addresses. */
|
||||
case 'S':
|
||||
return (MEM_P (x)
|
||||
&& CONST_INT_P (XEXP (x, 0))
|
||||
&& xstormy16_legitimate_address_p (VOIDmode, XEXP (x, 0), 0));
|
||||
|
||||
/* 'T' is for Rx. */
|
||||
case 'T':
|
||||
/* Not implemented yet. */
|
||||
return 0;
|
||||
|
||||
/* 'U' is for CONST_INT values not between 2 and 15 inclusive,
|
||||
for allocating a scratch register for 32-bit shifts. */
|
||||
case 'U':
|
||||
return (CONST_INT_P (x) && (! IN_RANGE (INTVAL (x), 2, 15)));
|
||||
|
||||
/* 'Z' is for CONST_INT value zero. This is for adding zero to
|
||||
a register in addhi3, which would otherwise require a carry. */
|
||||
case 'Z':
|
||||
return (CONST_INT_P (x) && (INTVAL (x) == 0));
|
||||
|
||||
case 'W':
|
||||
return xstormy16_below100_operand (x, GET_MODE (x));
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
short_memory_operand (rtx x, enum machine_mode mode)
|
||||
{
|
||||
|
|
|
@ -225,26 +225,6 @@ enum reg_class
|
|||
|
||||
#define INDEX_REG_CLASS GENERAL_REGS
|
||||
|
||||
/* 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) == 'a' ? R0_REGS \
|
||||
: (CHAR) == 'b' ? R1_REGS \
|
||||
: (CHAR) == 'c' ? R2_REGS \
|
||||
: (CHAR) == 'd' ? R8_REGS \
|
||||
: (CHAR) == 'e' ? EIGHT_REGS \
|
||||
: (CHAR) == 't' ? TWO_REGS \
|
||||
: (CHAR) == 'z' ? ICALL_REGS \
|
||||
: NO_REGS)
|
||||
|
||||
#define REGNO_OK_FOR_BASE_P(NUM) 1
|
||||
|
||||
#define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM)
|
||||
|
@ -263,22 +243,6 @@ enum reg_class
|
|||
#define CLASS_MAX_NREGS(CLASS, MODE) \
|
||||
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
|
||||
|
||||
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
|
||||
( (C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 3 \
|
||||
: (C) == 'J' ? exact_log2 (VALUE) != -1 \
|
||||
: (C) == 'K' ? exact_log2 (~(VALUE)) != -1 \
|
||||
: (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 255 \
|
||||
: (C) == 'M' ? (VALUE) >= -255 && (VALUE) <= 0 \
|
||||
: (C) == 'N' ? (VALUE) >= -3 && (VALUE) <= 0 \
|
||||
: (C) == 'O' ? (VALUE) >= 1 && (VALUE) <= 4 \
|
||||
: (C) == 'P' ? (VALUE) >= -4 && (VALUE) <= -1 \
|
||||
: 0 )
|
||||
|
||||
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
|
||||
|
||||
#define EXTRA_CONSTRAINT(VALUE, C) \
|
||||
xstormy16_extra_constraint_p (VALUE, C)
|
||||
|
||||
|
||||
/* Basic Stack Layout. */
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
(set_attr "psw_operand" "clobber")])
|
||||
|
||||
(include "predicates.md")
|
||||
(include "constraints.md")
|
||||
|
||||
;; ::::::::::::::::::::
|
||||
;; ::
|
||||
|
|
Loading…
Reference in New Issue