1 ;; Predicate definitions for DEC VAX.
2 ;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify it under
7 ;; the terms of the GNU General Public License as published by the Free
8 ;; Software Foundation; either version 3, or (at your option) any later
11 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ;; Special case of a symbolic operand that's used as a
23 (define_predicate "symbolic_operand"
24 (match_code "const,symbol_ref,label_ref"))
26 (define_predicate "local_symbolic_operand"
27 (match_code "const,symbol_ref,label_ref")
29 if (GET_CODE (op) == LABEL_REF)
31 if (GET_CODE (op) == SYMBOL_REF)
32 return !flag_pic || SYMBOL_REF_LOCAL_P (op);
33 if (GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
35 return !flag_pic || SYMBOL_REF_LOCAL_P (XEXP (XEXP (op, 0), 0));
38 (define_predicate "external_symbolic_operand"
39 (and (match_code "symbol_ref")
40 (not (match_operand 0 "local_symbolic_operand" ""))))
42 (define_predicate "external_const_operand"
43 (and (match_code "const")
44 (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
45 && !SYMBOL_REF_LOCAL_P (XEXP (XEXP (op, 0), 0))")))
47 (define_predicate "nonsymbolic_operand"
48 (and (ior (match_test "!flag_pic")
49 (not (match_operand 0 "symbolic_operand")))
50 (match_operand 0 "general_operand" "")))
52 (define_predicate "external_memory_operand"
55 rtx addr = XEXP (op, 0);
57 addr = XEXP (addr, 0);
58 if (GET_CODE (addr) == PLUS)
59 addr = XEXP (addr, 1);
61 addr = XEXP (addr, 0);
62 if (GET_CODE (addr) == PLUS)
63 addr = XEXP (addr, 1);
64 return external_symbolic_operand (addr, SImode)
65 || external_const_operand (addr, SImode);
68 (define_predicate "indirect_memory_operand"
74 if (GET_CODE (op) == PLUS)
79 (define_predicate "indexed_memory_operand"
82 rtx addr = XEXP (op, 0);
83 return GET_CODE (addr) != PRE_DEC && GET_CODE (addr) != POST_INC
84 && mode_dependent_address_p (addr, MEM_ADDR_SPACE (op));
87 (define_predicate "illegal_blk_memory_operand"
88 (and (match_code "mem")
89 (ior (and (match_test "flag_pic")
90 (match_operand 0 "external_memory_operand" ""))
91 (ior (match_operand 0 "indexed_memory_operand" "")
92 (ior (match_operand 0 "indirect_memory_operand" "")
93 (match_test "GET_CODE (XEXP (op, 0)) == PRE_DEC"))))))
95 (define_predicate "illegal_addsub_di_memory_operand"
96 (and (match_code "mem")
97 (ior (and (match_test "flag_pic")
98 (match_operand 0 "external_memory_operand" ""))
99 (ior (match_operand 0 "indexed_memory_operand" "")
100 (ior (match_operand 0 "indirect_memory_operand" "")
101 (match_test "GET_CODE (XEXP (op, 0)) == PRE_DEC"))))))
103 (define_predicate "nonimmediate_addsub_di_operand"
104 (and (match_code "subreg,reg,mem")
105 (and (match_operand:DI 0 "nonimmediate_operand" "")
106 (not (match_operand:DI 0 "illegal_addsub_di_memory_operand")))))
108 (define_predicate "general_addsub_di_operand"
109 (and (match_code "const_int,const_double,subreg,reg,mem")
110 (and (match_operand:DI 0 "general_operand" "")
111 (not (match_operand:DI 0 "illegal_addsub_di_memory_operand")))))