Commit 68a81332 by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

predicates.md: New file.

	* config/cris/predicates.md: New file.
	* config/cris/cris-protos.h (cris_store_multiple_op_p)
	(cris_movem_load_rest_p): Declare.
	* config/cris/cris.c (cris_store_multiple_op): Return bool, not int.
	(cris_movem_load_rest_p): Ditto.  Globalize.
	(cris_bdap_operand, cris_bdap_biap_operand,
	cris_orthogonal_operator, cris_commutative_orth_op,
	cris_operand_extend_operator,
	cris_additive_operand_extend_operator, cris_extend_operator,
	cris_plus_or_bound_operator, cris_mem_op,
	cris_general_operand_or_symbol,
	cris_general_operand_or_gotless_symbol,
	cris_general_operand_or_plt_symbol, cris_mem_call_operand,
	cris_load_multiple_op): Remove predicate functions.
	(cris_symbol, cris_gotless_symbol) <case UNSPEC>: Return 0, don't
	abort, for UNSPECs other than CRIS_UNSPEC_PLT.
	* config/cris/cris.h (PREDICATE_CODES): Don't define.
	* config/cris/cris.md: Include predicates.md.
	("call", "call_value"): Generate CONSTs of Pmode, not VOIDmode.

From-SVN: r98471
parent c3e5898b
2005-04-21 Hans-Peter Nilsson <hp@axis.com>
* config/cris/predicates.md: New file.
* config/cris/cris-protos.h (cris_store_multiple_op_p)
(cris_movem_load_rest_p): Declare.
* config/cris/cris.c (cris_store_multiple_op): Return bool, not int.
(cris_movem_load_rest_p): Ditto. Globalize.
(cris_bdap_operand, cris_bdap_biap_operand,
cris_orthogonal_operator, cris_commutative_orth_op,
cris_operand_extend_operator,
cris_additive_operand_extend_operator, cris_extend_operator,
cris_plus_or_bound_operator, cris_mem_op,
cris_general_operand_or_symbol,
cris_general_operand_or_gotless_symbol,
cris_general_operand_or_plt_symbol, cris_mem_call_operand,
cris_load_multiple_op): Remove predicate functions.
(cris_symbol, cris_gotless_symbol) <case UNSPEC>: Return 0, don't
abort, for UNSPECs other than CRIS_UNSPEC_PLT.
* config/cris/cris.h (PREDICATE_CODES): Don't define.
* config/cris/cris.md: Include predicates.md.
("call", "call_value"): Generate CONSTs of Pmode, not VOIDmode.
2005-04-20 Ian Lance Taylor <ian@airs.com> 2005-04-20 Ian Lance Taylor <ian@airs.com>
* c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def). * c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def).
......
...@@ -41,6 +41,8 @@ extern int cris_legitimate_pic_operand (rtx); ...@@ -41,6 +41,8 @@ extern int cris_legitimate_pic_operand (rtx);
extern int cris_gotless_symbol (rtx); extern int cris_gotless_symbol (rtx);
extern int cris_got_symbol (rtx); extern int cris_got_symbol (rtx);
extern int cris_symbol (rtx); extern int cris_symbol (rtx);
extern bool cris_store_multiple_op_p (rtx);
extern bool cris_movem_load_rest_p (rtx, int);
extern void cris_asm_output_symbol_ref (FILE *, rtx); extern void cris_asm_output_symbol_ref (FILE *, rtx);
extern bool cris_output_addr_const_extra (FILE *, rtx); extern bool cris_output_addr_const_extra (FILE *, rtx);
extern int cris_cfun_uses_pic_table (void); extern int cris_cfun_uses_pic_table (void);
......
...@@ -1616,44 +1616,6 @@ struct cum_args {int regs;}; ...@@ -1616,44 +1616,6 @@ struct cum_args {int regs;};
/* Node: Misc */ /* Node: Misc */
/* FIXME: Check this one more time. */
#define PREDICATE_CODES \
{"cris_orthogonal_operator", \
{PLUS, MINUS, IOR, AND, UMIN}}, \
{"cris_commutative_orth_op", \
{PLUS, IOR, AND, UMIN}}, \
{"cris_operand_extend_operator", \
{PLUS, MINUS, UMIN}}, \
{"cris_additive_operand_extend_operator", \
{PLUS, MINUS}}, \
{"cris_extend_operator", \
{ZERO_EXTEND, SIGN_EXTEND}}, \
{"cris_plus_or_bound_operator", \
{PLUS, UMIN}}, \
{"cris_mem_op", \
{MEM}}, \
{"cris_load_multiple_op", \
{PARALLEL}}, \
{"cris_store_multiple_op", \
{PARALLEL}}, \
{"cris_bdap_operand", \
{SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \
CONST_DOUBLE, CONST, SIGN_EXTEND}}, \
{"cris_bdap_biap_operand", \
{SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \
CONST_DOUBLE, CONST, SIGN_EXTEND, MULT}}, \
{"cris_general_operand_or_gotless_symbol", \
{CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
LABEL_REF, SUBREG, REG, MEM, UNSPEC}}, \
{"cris_general_operand_or_symbol", \
{CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
LABEL_REF, SUBREG, REG, MEM}}, \
{"cris_general_operand_or_plt_symbol", \
{CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
LABEL_REF, SUBREG, REG, MEM}}, \
{"cris_mem_call_operand", \
{MEM}},
/* A combination of the bound (umin) insn together with a /* A combination of the bound (umin) insn together with a
sign-extended add via the table to PC seems optimal. sign-extended add via the table to PC seems optimal.
If the table overflows, the assembler will take care of it. If the table overflows, the assembler will take care of it.
......
...@@ -141,6 +141,10 @@ ...@@ -141,6 +141,10 @@
(define_delay (eq_attr "slottable" "has_slot") (define_delay (eq_attr "slottable" "has_slot")
[(eq_attr "slottable" "yes") (nil) (nil)]) [(eq_attr "slottable" "yes") (nil) (nil)])
;; Operand and operator predicates.
(include "predicates.md")
;; Test insns. ;; Test insns.
;; DImode ;; DImode
...@@ -3944,7 +3948,7 @@ ...@@ -3944,7 +3948,7 @@
for the symbol cause bad recombinatorial effects? */ for the symbol cause bad recombinatorial effects? */
op0 = force_reg (Pmode, op0 = force_reg (Pmode,
gen_rtx_CONST gen_rtx_CONST
(VOIDmode, (Pmode,
gen_rtx_UNSPEC (VOIDmode, gen_rtx_UNSPEC (VOIDmode,
gen_rtvec (1, op0), gen_rtvec (1, op0),
CRIS_UNSPEC_PLT))); CRIS_UNSPEC_PLT)));
...@@ -4009,7 +4013,7 @@ ...@@ -4009,7 +4013,7 @@
for the symbol cause bad recombinatorial effects? */ for the symbol cause bad recombinatorial effects? */
op1 = force_reg (Pmode, op1 = force_reg (Pmode,
gen_rtx_CONST gen_rtx_CONST
(VOIDmode, (Pmode,
gen_rtx_UNSPEC (VOIDmode, gen_rtx_UNSPEC (VOIDmode,
gen_rtvec (1, op1), gen_rtvec (1, op1),
CRIS_UNSPEC_PLT))); CRIS_UNSPEC_PLT)));
......
;; Operand and operator predicates for the GCC CRIS port.
;; Copyright (C) 2005 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 2, 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 COPYING. If not, write to
;; the Free Software Foundation, 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Operator predicates.
(define_predicate "cris_orthogonal_operator"
(match_code "plus, minus, ior, and, umin"))
(define_predicate "cris_commutative_orth_op"
(match_code "plus, ior, and, umin"))
;; By the name, you might think we should include MULT. We don't because
;; it doesn't accept the same addressing modes as the others (only
;; registers) and there's also the problem of handling TARGET_MUL_BUG.
(define_predicate "cris_operand_extend_operator"
(match_code "plus, minus, umin"))
(define_predicate "cris_additive_operand_extend_operator"
(match_code "plus, minus"))
(define_predicate "cris_extend_operator"
(match_code "zero_extend, sign_extend"))
(define_predicate "cris_plus_or_bound_operator"
(match_code "plus, umin"))
;; Used as an operator to get a handle on a already-known-valid MEM rtx:es
;; (no need to validate the address), where some address expression parts
;; have their own match_operand.
(define_predicate "cris_mem_op"
(match_code "mem"))
(define_predicate "cris_load_multiple_op"
(and (match_code "parallel")
(match_test "cris_movem_load_rest_p (op, 0)")))
(define_predicate "cris_store_multiple_op"
(and (match_code "parallel")
(match_test "cris_store_multiple_op_p (op)")))
;; Operand helper predicates.
(define_predicate "cris_bdap_const_operand"
(and (match_code "label_ref, symbol_ref, const_int, const_double, const")
(not (and (match_test "flag_pic")
(match_test "cris_symbol (op)")))))
(define_predicate "cris_simple_address_operand"
(ior (match_operand:SI 0 "register_operand")
(and (match_code "post_inc")
(match_test "register_operand (XEXP (op, 0), Pmode)"))))
(define_predicate "cris_simple_operand"
(ior (match_operand 0 "register_operand")
(and (match_code "mem")
(match_test "cris_simple_address_operand (XEXP (op, 0),
Pmode)"))))
;; The caller needs to use :SI.
(define_predicate "cris_bdap_sign_extend_operand"
(and (match_code "sign_extend")
(and (match_test "MEM_P (XEXP (op, 0))")
(match_test "cris_simple_address_operand (XEXP (XEXP (op, 0), 0),
Pmode)"))))
;; FIXME: Should not have to test for 1.
(define_predicate "cris_scale_int_operand"
(and (match_code "const_int")
(ior (ior (match_test "op == GEN_INT (4)")
(match_test "op == const2_rtx"))
(match_test "op == const1_rtx"))))
;; FIXME: Should be able to assume (reg int).
(define_predicate "cris_biap_mult_operand"
(and (match_code "mult")
(ior (and (match_test "register_operand (XEXP (op, 0), Pmode)")
(match_test "cris_scale_int_operand (XEXP (op, 1), Pmode)"))
(and (match_test "cris_scale_int_operand (XEXP (op, 0), Pmode)")
(match_test "register_operand (XEXP (op, 1), Pmode)")))))
;; Operand predicates.
;; This checks a part of an address, the one that is not a plain register
;; for an addressing mode using BDAP.
;; Allowed operands are either:
;; a) a register
;; b) a CONST operand (but not a symbol when generating PIC)
;; c) a [r] or [r+] in SImode, or sign-extend from HI or QI.
(define_predicate "cris_bdap_operand"
(ior (match_operand 0 "cris_bdap_const_operand")
(ior (match_operand:SI 0 "cris_simple_operand")
(match_operand:SI 0 "cris_bdap_sign_extend_operand"))))
;; This is similar to cris_bdap_operand:
;; It checks a part of an address, the one that is not a plain register
;; for an addressing mode using BDAP or BIAP.
;; Allowed operands are either:
;; a) a register
;; b) a CONST operand (but not a symbol when generating PIC)
;; c) a mult of (1, 2 or 4) and a register
;; d) a [r] or [r+] in SImode, or sign-extend from HI or QI. */
(define_predicate "cris_bdap_biap_operand"
(ior (match_operand 0 "cris_bdap_operand")
(match_operand 0 "cris_biap_mult_operand")))
;; Since a PIC symbol without a GOT entry is not a general_operand, we
;; have to have a predicate that matches it. We use this in the expanded
;; "movsi" anonymous pattern.
;; FIXME: Can s/special_// when PR 20413 is fixed.
(define_special_predicate "cris_general_operand_or_gotless_symbol"
(ior (match_operand 0 "general_operand")
(and (match_code "const, symbol_ref, label_ref, unspec")
(match_test "cris_gotless_symbol (op)"))))
;; Since with -fPIC, not all symbols are valid PIC symbols or indeed
;; general_operands, we have to have a predicate that matches it for the
;; "movsi" expander.
;; FIXME: Can s/special_// when PR 20413 is fixed.
(define_special_predicate "cris_general_operand_or_symbol"
(ior (match_operand 0 "general_operand")
(and (match_code "const, symbol_ref, label_ref")
(match_test "cris_symbol (op)"))))
;; Since a PLT symbol is not a general_operand, we have to have a
;; predicate that matches it when we need it. We use this in the expanded
;; "call" and "call_value" anonymous patterns.
(define_predicate "cris_general_operand_or_plt_symbol"
(ior (match_operand 0 "general_operand")
(and (match_code "const")
(and (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
(not (match_test "TARGET_AVOID_GOTPLT"))))))
;; This matches a (MEM (general_operand)) or
;; (MEM (cris_general_operand_or_symbol)). The second one isn't a valid
;; memory_operand, so we need this predicate to recognize call
;; destinations before we change them to a PLT operand (by wrapping in
;; UNSPEC CRIS_UNSPEC_PLT).
(define_predicate "cris_mem_call_operand"
(and (match_code "mem")
(ior (match_operand 0 "memory_operand")
(match_test "cris_general_operand_or_symbol (XEXP (op, 0),
Pmode)"))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment