1 ;; Predicate definitions for DEC VAX.
2 ;; Copyright (C) 2007 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 ;; Boston, MA 02110-1301, USA.
21 ;; Special case of a symbolic operand that's used as a
24 (define_predicate "symbolic_operand"
25 (match_code "const,symbol_ref,label_ref"))
27 (define_predicate "local_symbolic_operand"
28 (match_code "const,symbol_ref,label_ref")
30 if (GET_CODE (op) == LABEL_REF)
32 if (GET_CODE (op) == SYMBOL_REF)
33 return !flag_pic || SYMBOL_REF_LOCAL_P (op);
34 if (GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
36 return !flag_pic || SYMBOL_REF_LOCAL_P (XEXP (XEXP (op, 0), 0));
39 (define_predicate "external_symbolic_operand"
40 (and (match_code "symbol_ref")
41 (not (match_operand 0 "local_symbolic_operand" ""))))
43 (define_predicate "external_const_operand"
44 (and (match_code "const")
45 (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
46 && !SYMBOL_REF_LOCAL_P (XEXP (XEXP (op, 0), 0))")))
48 (define_predicate "nonsymbolic_operand"
49 (and (ior (match_test "!flag_pic")
50 (not (match_operand 0 "symbolic_operand")))
51 (match_operand 0 "general_operand" "")))
53 (define_predicate "external_memory_operand"
56 rtx addr = XEXP (op, 0);
58 addr = XEXP (addr, 0);
59 if (GET_CODE (addr) == PLUS)
60 addr = XEXP (addr, 1);
62 addr = XEXP (addr, 0);
63 if (GET_CODE (addr) == PLUS)
64 addr = XEXP (addr, 1);
65 return external_symbolic_operand (addr, SImode)
66 || external_const_operand (addr, SImode);
69 (define_predicate "indirect_memory_operand"
75 if (GET_CODE (op) == PLUS)
80 (define_predicate "indexed_memory_operand"
84 return GET_CODE (op) != PRE_DEC && GET_CODE (op) != POST_INC
85 && mode_dependent_address_p (op);
88 (define_predicate "illegal_addsub_di_memory_operand"
89 (and (match_code "mem")
90 (ior (and (match_test "flag_pic")
91 (match_operand 0 "external_memory_operand" ""))
92 (ior (match_operand 0 "indexed_memory_operand" "")
93 (ior (match_operand 0 "indirect_memory_operand" "")
94 (match_test "GET_CODE (XEXP (op, 0)) == PRE_DEC"))))))
96 (define_predicate "nonimmediate_addsub_di_operand"
97 (and (match_code "subreg,reg,mem")
98 (and (match_operand:DI 0 "nonimmediate_operand" "")
99 (not (match_operand:DI 0 "illegal_addsub_di_memory_operand")))))
101 (define_predicate "general_addsub_di_operand"
102 (and (match_code "const_int,const_double,subreg,reg,mem")
103 (and (match_operand:DI 0 "general_operand" "")
104 (not (match_operand:DI 0 "illegal_addsub_di_memory_operand")))))