]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/common.md
[Ada] Replace low-level membership tests with high-level routines
[thirdparty/gcc.git] / gcc / common.md
1 ;; Common GCC machine description file, shared by all targets.
2 ;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
3 ;;
4 ;; This file is part of GCC.
5 ;;
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 3, or (at your option)
9 ;; any later version.
10 ;;
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.
15 ;;
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/>. */
19
20 (define_register_constraint "r" "GENERAL_REGS"
21 "Matches any general register.")
22
23 (define_memory_constraint "TARGET_MEM_CONSTRAINT"
24 "Matches any valid memory."
25 (and (match_code "mem")
26 (match_test "memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0),
27 MEM_ADDR_SPACE (op))")))
28
29 (define_memory_constraint "o"
30 "Matches an offsettable memory reference."
31 (and (match_code "mem")
32 (match_test "offsettable_nonstrict_memref_p (op)")))
33
34 ;; "V" matches TARGET_MEM_CONSTRAINTs that are rejected by "o".
35 ;; This means that it is not a memory constraint in the usual sense,
36 ;; since reloading the address into a base register would make the
37 ;; address offsettable.
38 (define_constraint "V"
39 "Matches a non-offsettable memory reference."
40 (and (match_code "mem")
41 (match_test "memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0),
42 MEM_ADDR_SPACE (op))")
43 (not (match_test "offsettable_nonstrict_memref_p (op)"))))
44
45 ;; Like "V", this is not a memory constraint, since reloading the address
46 ;; into a base register would cause it not to match.
47 (define_constraint "<"
48 "Matches a pre-dec or post-dec operand."
49 (and (match_code "mem")
50 (ior (match_test "GET_CODE (XEXP (op, 0)) == PRE_DEC")
51 (match_test "GET_CODE (XEXP (op, 0)) == POST_DEC"))))
52
53 ;; See the comment for "<".
54 (define_constraint ">"
55 "Matches a pre-inc or post-inc operand."
56 (and (match_code "mem")
57 (ior (match_test "GET_CODE (XEXP (op, 0)) == PRE_INC")
58 (match_test "GET_CODE (XEXP (op, 0)) == POST_INC"))))
59
60 (define_address_constraint "p"
61 "Matches a general address."
62 (match_test "address_operand (op, VOIDmode)"))
63
64 (define_constraint "i"
65 "Matches a general integer constant."
66 (and (match_test "CONSTANT_P (op)")
67 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
68
69 (define_constraint "s"
70 "Matches a symbolic integer constant."
71 (and (match_test "CONSTANT_P (op)")
72 (match_test "!CONST_SCALAR_INT_P (op)")
73 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
74
75 (define_constraint "n"
76 "Matches a non-symbolic integer constant."
77 (and (match_test "CONST_SCALAR_INT_P (op)")
78 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
79
80 (define_constraint "E"
81 "Matches a floating-point constant."
82 (ior (match_test "CONST_DOUBLE_AS_FLOAT_P (op)")
83 (match_test "GET_CODE (op) == CONST_VECTOR
84 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
85
86 ;; There is no longer a distinction between "E" and "F".
87 (define_constraint "F"
88 "Matches a floating-point constant."
89 (ior (match_test "CONST_DOUBLE_AS_FLOAT_P (op)")
90 (match_test "GET_CODE (op) == CONST_VECTOR
91 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
92
93 (define_constraint "X"
94 "Matches anything."
95 (match_test "true"))