OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [cris/] [predicates.md] - Diff between revs 38 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 154
;; Operand and operator predicates for the GCC CRIS port.
;; Operand and operator predicates for the GCC CRIS port.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;; This file is part of GCC.
;; This file is part of GCC.
;;
;;
;; GCC is free software; you can redistribute it and/or modify
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; any later version.
;;
;;
;; GCC is distributed in the hope that it will be useful,
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; GNU General Public License for more details.
;;
;;
;; You should have received a copy of the GNU General Public License
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; along with GCC; see the file COPYING3.  If not see
;; .
;; .
;; Operator predicates.
;; Operator predicates.
(define_predicate "cris_orthogonal_operator"
(define_predicate "cris_orthogonal_operator"
  (match_code "plus, minus, ior, and, umin"))
  (match_code "plus, minus, ior, and, umin"))
(define_predicate "cris_commutative_orth_op"
(define_predicate "cris_commutative_orth_op"
  (match_code "plus, ior, and, umin"))
  (match_code "plus, ior, and, umin"))
;; By the name, you might think we should include MULT.  We don't because
;; 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
;; it doesn't accept the same addressing modes as the others (only
;; registers) and there's also the problem of handling TARGET_MUL_BUG.
;; registers) and there's also the problem of handling TARGET_MUL_BUG.
(define_predicate "cris_operand_extend_operator"
(define_predicate "cris_operand_extend_operator"
  (match_code "plus, minus, umin"))
  (match_code "plus, minus, umin"))
(define_predicate "cris_additive_operand_extend_operator"
(define_predicate "cris_additive_operand_extend_operator"
  (match_code "plus, minus"))
  (match_code "plus, minus"))
(define_predicate "cris_extend_operator"
(define_predicate "cris_extend_operator"
  (match_code "zero_extend, sign_extend"))
  (match_code "zero_extend, sign_extend"))
(define_predicate "cris_plus_or_bound_operator"
(define_predicate "cris_plus_or_bound_operator"
  (match_code "plus, umin"))
  (match_code "plus, umin"))
;; Used as an operator to get a handle on a already-known-valid MEM rtx:es
;; 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
;; (no need to validate the address), where some address expression parts
;; have their own match_operand.
;; have their own match_operand.
(define_predicate "cris_mem_op"
(define_predicate "cris_mem_op"
  (match_code "mem"))
  (match_code "mem"))
(define_predicate "cris_load_multiple_op"
(define_predicate "cris_load_multiple_op"
  (and (match_code "parallel")
  (and (match_code "parallel")
       (match_test "cris_movem_load_rest_p (op, 0)")))
       (match_test "cris_movem_load_rest_p (op, 0)")))
(define_predicate "cris_store_multiple_op"
(define_predicate "cris_store_multiple_op"
  (and (match_code "parallel")
  (and (match_code "parallel")
       (match_test "cris_store_multiple_op_p (op)")))
       (match_test "cris_store_multiple_op_p (op)")))
;; Operand helper predicates.
;; Operand helper predicates.
(define_predicate "cris_bdap_const_operand"
(define_predicate "cris_bdap_const_operand"
  (and (match_code "label_ref, symbol_ref, const_int, const_double, const")
  (and (match_code "label_ref, symbol_ref, const_int, const_double, const")
       (ior (not (match_test "flag_pic"))
       (ior (not (match_test "flag_pic"))
            (match_test "cris_valid_pic_const (op)"))))
            (match_test "cris_valid_pic_const (op)"))))
(define_predicate "cris_simple_address_operand"
(define_predicate "cris_simple_address_operand"
  (ior (match_operand:SI 0 "register_operand")
  (ior (match_operand:SI 0 "register_operand")
       (and (match_code "post_inc")
       (and (match_code "post_inc")
            (match_test "register_operand (XEXP (op, 0), Pmode)"))))
            (match_test "register_operand (XEXP (op, 0), Pmode)"))))
(define_predicate "cris_simple_operand"
(define_predicate "cris_simple_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (and (match_code "mem")
       (and (match_code "mem")
            (match_test "cris_simple_address_operand (XEXP (op, 0),
            (match_test "cris_simple_address_operand (XEXP (op, 0),
                                                      Pmode)"))))
                                                      Pmode)"))))
;; The caller needs to use :SI.
;; The caller needs to use :SI.
(define_predicate "cris_bdap_sign_extend_operand"
(define_predicate "cris_bdap_sign_extend_operand"
; Disabled until 
; Disabled until 
; or  is committed.
; or  is committed.
  (match_test "0"))
  (match_test "0"))
;  (and (match_code "sign_extend")
;  (and (match_code "sign_extend")
;       (and (match_test "MEM_P (XEXP (op, 0))")
;       (and (match_test "MEM_P (XEXP (op, 0))")
;           (match_test "cris_simple_address_operand (XEXP (XEXP (op, 0), 0),
;           (match_test "cris_simple_address_operand (XEXP (XEXP (op, 0), 0),
;                                                     Pmode)"))))
;                                                     Pmode)"))))
;; FIXME: Should not have to test for 1.
;; FIXME: Should not have to test for 1.
(define_predicate "cris_scale_int_operand"
(define_predicate "cris_scale_int_operand"
  (and (match_code "const_int")
  (and (match_code "const_int")
       (ior (ior (match_test "op == GEN_INT (4)")
       (ior (ior (match_test "op == GEN_INT (4)")
                 (match_test "op == const2_rtx"))
                 (match_test "op == const2_rtx"))
            (match_test "op == const1_rtx"))))
            (match_test "op == const1_rtx"))))
;; FIXME: Should be able to assume (reg int).
;; FIXME: Should be able to assume (reg int).
(define_predicate "cris_biap_mult_operand"
(define_predicate "cris_biap_mult_operand"
  (and (match_code "mult")
  (and (match_code "mult")
       (ior (and (match_test "register_operand (XEXP (op, 0), Pmode)")
       (ior (and (match_test "register_operand (XEXP (op, 0), Pmode)")
                 (match_test "cris_scale_int_operand (XEXP (op, 1), Pmode)"))
                 (match_test "cris_scale_int_operand (XEXP (op, 1), Pmode)"))
            (and (match_test "cris_scale_int_operand (XEXP (op, 0), Pmode)")
            (and (match_test "cris_scale_int_operand (XEXP (op, 0), Pmode)")
                 (match_test "register_operand (XEXP (op, 1), Pmode)")))))
                 (match_test "register_operand (XEXP (op, 1), Pmode)")))))
;; Operand predicates.
;; Operand predicates.
;; This checks a part of an address, the one that is not a plain register
;; This checks a part of an address, the one that is not a plain register
;; for an addressing mode using BDAP.
;; for an addressing mode using BDAP.
;; Allowed operands are either:
;; Allowed operands are either:
;; a) a register
;; a) a register
;; b) a CONST operand (but not a symbol when generating PIC)
;; 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.
;; c) a [r] or [r+] in SImode, or sign-extend from HI or QI.
(define_predicate "cris_bdap_operand"
(define_predicate "cris_bdap_operand"
  (ior (match_operand 0 "cris_bdap_const_operand")
  (ior (match_operand 0 "cris_bdap_const_operand")
       (ior (match_operand:SI 0 "cris_simple_operand")
       (ior (match_operand:SI 0 "cris_simple_operand")
            (match_operand:SI 0 "cris_bdap_sign_extend_operand"))))
            (match_operand:SI 0 "cris_bdap_sign_extend_operand"))))
;; This is similar to cris_bdap_operand:
;; This is similar to cris_bdap_operand:
;; It checks a part of an address, the one that is not a plain register
;; It checks a part of an address, the one that is not a plain register
;; for an addressing mode using BDAP or BIAP.
;; for an addressing mode using BDAP or BIAP.
;; Allowed operands are either:
;; Allowed operands are either:
;; a) a register
;; a) a register
;; b) a CONST operand (but not a symbol when generating PIC)
;; b) a CONST operand (but not a symbol when generating PIC)
;; c) a mult of (1, 2 or 4) and a register
;; 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.  */
;; d) a [r] or [r+] in SImode, or sign-extend from HI or QI.  */
(define_predicate "cris_bdap_biap_operand"
(define_predicate "cris_bdap_biap_operand"
  (ior (match_operand 0 "cris_bdap_operand")
  (ior (match_operand 0 "cris_bdap_operand")
       (match_operand 0 "cris_biap_mult_operand")))
       (match_operand 0 "cris_biap_mult_operand")))
;; Since with -fPIC, not all symbols are valid PIC symbols or indeed
;; 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
;; general_operands, we have to have a predicate that matches it for the
;; "movsi" expander.
;; "movsi" expander.
;; FIXME: Can s/special_// when PR 20413 is fixed.
;; FIXME: Can s/special_// when PR 20413 is fixed.
(define_special_predicate "cris_general_operand_or_symbol"
(define_special_predicate "cris_general_operand_or_symbol"
  (ior (match_operand 0 "general_operand")
  (ior (match_operand 0 "general_operand")
       (and (match_code "const, symbol_ref, label_ref")
       (and (match_code "const, symbol_ref, label_ref")
            ; The following test is actually just an assertion.
            ; The following test is actually just an assertion.
            (match_test "cris_pic_symbol_type_of (op) != cris_no_symbol"))))
            (match_test "cris_pic_symbol_type_of (op) != cris_no_symbol"))))
;; Since a PLT symbol is not a general_operand, we have to have a
;; 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
;; predicate that matches it when we need it.  We use this in the expanded
;; "call" and "call_value" anonymous patterns.
;; "call" and "call_value" anonymous patterns.
(define_predicate "cris_general_operand_or_plt_symbol"
(define_predicate "cris_general_operand_or_plt_symbol"
  (ior (match_operand 0 "general_operand")
  (ior (match_operand 0 "general_operand")
       (and (match_code "const")
       (and (match_code "const")
            (and (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
            (and (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
                 (not (match_test "TARGET_AVOID_GOTPLT"))))))
                 (not (match_test "TARGET_AVOID_GOTPLT"))))))
;; This matches a (MEM (general_operand)) or
;; This matches a (MEM (general_operand)) or
;; (MEM (cris_general_operand_or_symbol)).  The second one isn't a valid
;; (MEM (cris_general_operand_or_symbol)).  The second one isn't a valid
;; memory_operand, so we need this predicate to recognize call
;; memory_operand, so we need this predicate to recognize call
;; destinations before we change them to a PLT operand (by wrapping in
;; destinations before we change them to a PLT operand (by wrapping in
;; UNSPEC CRIS_UNSPEC_PLT).
;; UNSPEC CRIS_UNSPEC_PLT).
(define_predicate "cris_mem_call_operand"
(define_predicate "cris_mem_call_operand"
  (and (match_code "mem")
  (and (match_code "mem")
       (ior (match_operand 0 "memory_operand")
       (ior (match_operand 0 "memory_operand")
            (match_test "cris_general_operand_or_symbol (XEXP (op, 0),
            (match_test "cris_general_operand_or_symbol (XEXP (op, 0),
                                                         Pmode)"))))
                                                         Pmode)"))))
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.