1 |
38 |
julius |
;; Constraint definitions for ARM and Thumb
|
2 |
|
|
;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
3 |
|
|
;; Contributed by ARM Ltd.
|
4 |
|
|
|
5 |
|
|
;; This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
;; GCC is free software; you can redistribute it and/or modify it
|
8 |
|
|
;; under the terms of the GNU General Public License as published
|
9 |
|
|
;; by the Free Software Foundation; either version 3, or (at your
|
10 |
|
|
;; option) any later version.
|
11 |
|
|
|
12 |
|
|
;; GCC is distributed in the hope that it will be useful, but WITHOUT
|
13 |
|
|
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
|
|
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
15 |
|
|
;; License for more details.
|
16 |
|
|
|
17 |
|
|
;; You should have received a copy of the GNU General Public License
|
18 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
19 |
|
|
;; .
|
20 |
|
|
|
21 |
|
|
;; The following register constraints have been used:
|
22 |
|
|
;; - in ARM state: f, v, w, y, z
|
23 |
|
|
;; - in Thumb state: h, k, b
|
24 |
|
|
;; - in both states: l, c
|
25 |
|
|
;; In ARM state, 'l' is an alias for 'r'
|
26 |
|
|
|
27 |
|
|
;; The following normal constraints have been used:
|
28 |
|
|
;; in ARM state: G, H, I, J, K, L, M
|
29 |
|
|
;; in Thumb state: I, J, K, L, M, N, O
|
30 |
|
|
|
31 |
|
|
;; The following multi-letter normal constraints have been used:
|
32 |
|
|
;; in ARM state: Da, Db, Dc
|
33 |
|
|
|
34 |
|
|
;; The following memory constraints have been used:
|
35 |
|
|
;; in ARM state: Q, Uq, Uv, Uy
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
(define_register_constraint "f" "TARGET_ARM ? FPA_REGS : NO_REGS"
|
39 |
|
|
"Legacy FPA registers @code{f0}-@code{f7}.")
|
40 |
|
|
|
41 |
|
|
(define_register_constraint "v" "TARGET_ARM ? CIRRUS_REGS : NO_REGS"
|
42 |
|
|
"The Cirrus Maverick co-processor registers.")
|
43 |
|
|
|
44 |
|
|
(define_register_constraint "w" "TARGET_ARM ? VFP_REGS : NO_REGS"
|
45 |
|
|
"The VFP registers @code{s0}-@code{s31}.")
|
46 |
|
|
|
47 |
|
|
(define_register_constraint "y" "TARGET_REALLY_IWMMXT ? IWMMXT_REGS : NO_REGS"
|
48 |
|
|
"The Intel iWMMX co-processor registers.")
|
49 |
|
|
|
50 |
|
|
(define_register_constraint "z"
|
51 |
|
|
"TARGET_REALLY_IWMMXT ? IWMMXT_GR_REGS : NO_REGS"
|
52 |
|
|
"The Intel iWMMX GR registers.")
|
53 |
|
|
|
54 |
|
|
(define_register_constraint "l" "TARGET_THUMB ? LO_REGS : GENERAL_REGS"
|
55 |
|
|
"In Thumb state the core registers @code{r0}-@code{r7}.")
|
56 |
|
|
|
57 |
|
|
(define_register_constraint "h" "TARGET_THUMB ? HI_REGS : NO_REGS"
|
58 |
|
|
"In Thumb state the core registers @code{r8}-@code{r15}.")
|
59 |
|
|
|
60 |
|
|
(define_register_constraint "k" "TARGET_THUMB ? STACK_REG : NO_REGS"
|
61 |
|
|
"@internal
|
62 |
|
|
Thumb only. The stack register.")
|
63 |
|
|
|
64 |
|
|
(define_register_constraint "b" "TARGET_THUMB ? BASE_REGS : NO_REGS"
|
65 |
|
|
"@internal
|
66 |
|
|
Thumb only. The union of the low registers and the stack register.")
|
67 |
|
|
|
68 |
|
|
(define_register_constraint "c" "CC_REG"
|
69 |
|
|
"@internal The condition code register.")
|
70 |
|
|
|
71 |
|
|
(define_constraint "I"
|
72 |
|
|
"In ARM state a constant that can be used as an immediate value in a Data
|
73 |
|
|
Processing instruction. In Thumb state a constant in the range 0-255."
|
74 |
|
|
(and (match_code "const_int")
|
75 |
|
|
(match_test "TARGET_ARM ? const_ok_for_arm (ival)
|
76 |
|
|
: ival >= 0 && ival <= 255")))
|
77 |
|
|
|
78 |
|
|
(define_constraint "J"
|
79 |
|
|
"In ARM state a constant in the range @minus{}4095-4095. In Thumb state
|
80 |
|
|
a constant in the range @minus{}255-@minus{}1."
|
81 |
|
|
(and (match_code "const_int")
|
82 |
|
|
(match_test "TARGET_ARM ? (ival >= -4095 && ival <= 4095)
|
83 |
|
|
: (ival >= -255 && ival <= -1)")))
|
84 |
|
|
|
85 |
|
|
(define_constraint "K"
|
86 |
|
|
"In ARM state a constant that satisfies the @code{I} constraint if inverted.
|
87 |
|
|
In Thumb state a constant that satisfies the @code{I} constraint multiplied
|
88 |
|
|
by any power of 2."
|
89 |
|
|
(and (match_code "const_int")
|
90 |
|
|
(match_test "TARGET_ARM ? const_ok_for_arm (~ival)
|
91 |
|
|
: thumb_shiftable_const (ival)")))
|
92 |
|
|
|
93 |
|
|
(define_constraint "L"
|
94 |
|
|
"In ARM state a constant that satisfies the @code{I} constraint if negated.
|
95 |
|
|
In Thumb state a constant in the range @minus{}7-7."
|
96 |
|
|
(and (match_code "const_int")
|
97 |
|
|
(match_test "TARGET_ARM ? const_ok_for_arm (-ival)
|
98 |
|
|
: (ival >= -7 && ival <= 7)")))
|
99 |
|
|
|
100 |
|
|
;; The ARM state version is internal...
|
101 |
|
|
;; @internal In ARM state a constant in the range 0-32 or any power of 2.
|
102 |
|
|
(define_constraint "M"
|
103 |
|
|
"In Thumb state a constant that is a multiple of 4 in the range 0-1020."
|
104 |
|
|
(and (match_code "const_int")
|
105 |
|
|
(match_test "TARGET_ARM ? ((ival >= 0 && ival <= 32)
|
106 |
|
|
|| ((ival & (ival - 1)) == 0))
|
107 |
|
|
: ((ival >= 0 && ival <= 1020) && ((ival & 3) == 0))")))
|
108 |
|
|
|
109 |
|
|
(define_constraint "N"
|
110 |
|
|
"In Thumb state a constant in the range 0-31."
|
111 |
|
|
(and (match_code "const_int")
|
112 |
|
|
(match_test "TARGET_THUMB && ival >= 0 && ival <= 31")))
|
113 |
|
|
|
114 |
|
|
(define_constraint "O"
|
115 |
|
|
"In Thumb state a constant that is a multiple of 4 in the range
|
116 |
|
|
@minus{}508-508."
|
117 |
|
|
(and (match_code "const_int")
|
118 |
|
|
(match_test "TARGET_THUMB && ival >= -508 && ival <= 508
|
119 |
|
|
&& ((ival & 3) == 0)")))
|
120 |
|
|
|
121 |
|
|
(define_constraint "G"
|
122 |
|
|
"In ARM state a valid FPA immediate constant."
|
123 |
|
|
(and (match_code "const_double")
|
124 |
|
|
(match_test "TARGET_ARM && arm_const_double_rtx (op)")))
|
125 |
|
|
|
126 |
|
|
(define_constraint "H"
|
127 |
|
|
"In ARM state a valid FPA immediate constant when negated."
|
128 |
|
|
(and (match_code "const_double")
|
129 |
|
|
(match_test "TARGET_ARM && neg_const_double_rtx_ok_for_fpa (op)")))
|
130 |
|
|
|
131 |
|
|
(define_constraint "Da"
|
132 |
|
|
"@internal
|
133 |
|
|
In ARM state a const_int, const_double or const_vector that can
|
134 |
|
|
be generated with two Data Processing insns."
|
135 |
|
|
(and (match_code "const_double,const_int,const_vector")
|
136 |
|
|
(match_test "TARGET_ARM && arm_const_double_inline_cost (op) == 2")))
|
137 |
|
|
|
138 |
|
|
(define_constraint "Db"
|
139 |
|
|
"@internal
|
140 |
|
|
In ARM state a const_int, const_double or const_vector that can
|
141 |
|
|
be generated with three Data Processing insns."
|
142 |
|
|
(and (match_code "const_double,const_int,const_vector")
|
143 |
|
|
(match_test "TARGET_ARM && arm_const_double_inline_cost (op) == 3")))
|
144 |
|
|
|
145 |
|
|
(define_constraint "Dc"
|
146 |
|
|
"@internal
|
147 |
|
|
In ARM state a const_int, const_double or const_vector that can
|
148 |
|
|
be generated with four Data Processing insns. This pattern is disabled
|
149 |
|
|
if optimizing for space or when we have load-delay slots to fill."
|
150 |
|
|
(and (match_code "const_double,const_int,const_vector")
|
151 |
|
|
(match_test "TARGET_ARM && arm_const_double_inline_cost (op) == 4
|
152 |
|
|
&& !(optimize_size || arm_ld_sched)")))
|
153 |
|
|
|
154 |
|
|
(define_memory_constraint "Uv"
|
155 |
|
|
"@internal
|
156 |
|
|
In ARM state a valid VFP load/store address."
|
157 |
|
|
(and (match_code "mem")
|
158 |
|
|
(match_test "TARGET_ARM && arm_coproc_mem_operand (op, FALSE)")))
|
159 |
|
|
|
160 |
|
|
(define_memory_constraint "Uy"
|
161 |
|
|
"@internal
|
162 |
|
|
In ARM state a valid iWMMX load/store address."
|
163 |
|
|
(and (match_code "mem")
|
164 |
|
|
(match_test "TARGET_ARM && arm_coproc_mem_operand (op, TRUE)")))
|
165 |
|
|
|
166 |
|
|
(define_memory_constraint "Uq"
|
167 |
|
|
"@internal
|
168 |
|
|
In ARM state an address valid in ldrsb instructions."
|
169 |
|
|
(and (match_code "mem")
|
170 |
|
|
(match_test "TARGET_ARM
|
171 |
|
|
&& arm_legitimate_address_p (GET_MODE (op), XEXP (op, 0),
|
172 |
|
|
SIGN_EXTEND, 0)")))
|
173 |
|
|
|
174 |
|
|
(define_memory_constraint "Q"
|
175 |
|
|
"@internal
|
176 |
|
|
In ARM state an address that is a single base register."
|
177 |
|
|
(and (match_code "mem")
|
178 |
|
|
(match_test "REG_P (XEXP (op, 0))")))
|
179 |
|
|
|
180 |
|
|
;; We used to have constraint letters for S and R in ARM state, but
|
181 |
|
|
;; all uses of these now appear to have been removed.
|
182 |
|
|
|
183 |
|
|
;; Additionally, we used to have a Q constraint in Thumb state, but
|
184 |
|
|
;; this wasn't really a valid memory constraint. Again, all uses of
|
185 |
|
|
;; this now seem to have been removed.
|