1 |
38 |
julius |
;; Constraint definitions for MIPS.
|
2 |
|
|
;; Copyright (C) 2006, 2007 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 |
|
|
;; .
|
19 |
|
|
|
20 |
|
|
;; Register constraints
|
21 |
|
|
|
22 |
|
|
(define_register_constraint "d" "BASE_REG_CLASS"
|
23 |
|
|
"An address register. This is equivalent to @code{r} unless
|
24 |
|
|
generating MIPS16 code.")
|
25 |
|
|
|
26 |
|
|
(define_register_constraint "t" "T_REG"
|
27 |
|
|
"@internal")
|
28 |
|
|
|
29 |
|
|
(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
|
30 |
|
|
"A floating-point register (if available).")
|
31 |
|
|
|
32 |
|
|
(define_register_constraint "h" "HI_REG"
|
33 |
|
|
"The @code{hi} register.")
|
34 |
|
|
|
35 |
|
|
(define_register_constraint "l" "LO_REG"
|
36 |
|
|
"The @code{lo} register.")
|
37 |
|
|
|
38 |
|
|
(define_register_constraint "x" "MD_REGS"
|
39 |
|
|
"The @code{hi} and @code{lo} registers.")
|
40 |
|
|
|
41 |
|
|
(define_register_constraint "b" "ALL_REGS"
|
42 |
|
|
"@internal")
|
43 |
|
|
|
44 |
|
|
(define_register_constraint "c" "TARGET_ABICALLS ? PIC_FN_ADDR_REG
|
45 |
|
|
: TARGET_MIPS16 ? M16_NA_REGS
|
46 |
|
|
: GR_REGS"
|
47 |
|
|
"A register suitable for use in an indirect jump. This will always be
|
48 |
|
|
@code{$25} for @option{-mabicalls}.")
|
49 |
|
|
|
50 |
|
|
(define_register_constraint "e" "LEA_REGS"
|
51 |
|
|
"@internal")
|
52 |
|
|
|
53 |
|
|
(define_register_constraint "j" "PIC_FN_ADDR_REG"
|
54 |
|
|
"@internal")
|
55 |
|
|
|
56 |
|
|
(define_register_constraint "v" "V1_REG"
|
57 |
|
|
"@internal")
|
58 |
|
|
|
59 |
|
|
(define_register_constraint "y" "GR_REGS"
|
60 |
|
|
"Equivalent to @code{r}; retained for backwards compatibility.")
|
61 |
|
|
|
62 |
|
|
(define_register_constraint "z" "ST_REGS"
|
63 |
|
|
"A floating-point condition code register.")
|
64 |
|
|
|
65 |
|
|
(define_register_constraint "A" "DSP_ACC_REGS"
|
66 |
|
|
"@internal")
|
67 |
|
|
|
68 |
|
|
(define_register_constraint "a" "ACC_REGS"
|
69 |
|
|
"@internal")
|
70 |
|
|
|
71 |
|
|
(define_register_constraint "B" "COP0_REGS"
|
72 |
|
|
"@internal")
|
73 |
|
|
|
74 |
|
|
(define_register_constraint "C" "COP2_REGS"
|
75 |
|
|
"@internal")
|
76 |
|
|
|
77 |
|
|
(define_register_constraint "D" "COP3_REGS"
|
78 |
|
|
"@internal")
|
79 |
|
|
|
80 |
|
|
;; Integer constraints
|
81 |
|
|
|
82 |
|
|
(define_constraint "I"
|
83 |
|
|
"A signed 16-bit constant (for arithmetic instructions)."
|
84 |
|
|
(and (match_code "const_int")
|
85 |
|
|
(match_test "SMALL_OPERAND (ival)")))
|
86 |
|
|
|
87 |
|
|
(define_constraint "J"
|
88 |
|
|
"Integer zero."
|
89 |
|
|
(and (match_code "const_int")
|
90 |
|
|
(match_test "ival == 0")))
|
91 |
|
|
|
92 |
|
|
(define_constraint "K"
|
93 |
|
|
"An unsigned 16-bit constant (for logic instructions)."
|
94 |
|
|
(and (match_code "const_int")
|
95 |
|
|
(match_test "SMALL_OPERAND_UNSIGNED (ival)")))
|
96 |
|
|
|
97 |
|
|
(define_constraint "L"
|
98 |
|
|
"A signed 32-bit constant in which the lower 16 bits are zero.
|
99 |
|
|
Such constants can be loaded using @code{lui}."
|
100 |
|
|
(and (match_code "const_int")
|
101 |
|
|
(match_test "LUI_OPERAND (ival)")))
|
102 |
|
|
|
103 |
|
|
(define_constraint "M"
|
104 |
|
|
"A constant that cannot be loaded using @code{lui}, @code{addiu}
|
105 |
|
|
or @code{ori}."
|
106 |
|
|
(and (match_code "const_int")
|
107 |
|
|
(match_test "!SMALL_OPERAND (ival)")
|
108 |
|
|
(match_test "!SMALL_OPERAND_UNSIGNED (ival)")
|
109 |
|
|
(match_test "!LUI_OPERAND (ival)")))
|
110 |
|
|
|
111 |
|
|
(define_constraint "N"
|
112 |
|
|
"A constant in the range -65535 to -1 (inclusive)."
|
113 |
|
|
(and (match_code "const_int")
|
114 |
|
|
(match_test "ival >= -0xffff && ival < 0")))
|
115 |
|
|
|
116 |
|
|
(define_constraint "O"
|
117 |
|
|
"A signed 15-bit constant."
|
118 |
|
|
(and (match_code "const_int")
|
119 |
|
|
(match_test "ival >= -0x4000 && ival < 0x4000")))
|
120 |
|
|
|
121 |
|
|
(define_constraint "P"
|
122 |
|
|
"A constant in the range 1 to 65535 (inclusive)."
|
123 |
|
|
(and (match_code "const_int")
|
124 |
|
|
(match_test "ival > 0 && ival < 0x10000")))
|
125 |
|
|
|
126 |
|
|
;; Floating-point constraints
|
127 |
|
|
|
128 |
|
|
(define_constraint "G"
|
129 |
|
|
"Floating-point zero."
|
130 |
|
|
(and (match_code "const_double")
|
131 |
|
|
(match_test "op == CONST0_RTX (mode)")))
|
132 |
|
|
|
133 |
|
|
;; General constraints
|
134 |
|
|
|
135 |
|
|
(define_constraint "Q"
|
136 |
|
|
"@internal"
|
137 |
|
|
(match_operand 0 "const_arith_operand"))
|
138 |
|
|
|
139 |
|
|
(define_memory_constraint "R"
|
140 |
|
|
"An address that can be used in a non-macro load or store."
|
141 |
|
|
(and (match_code "mem")
|
142 |
|
|
(match_test "mips_fetch_insns (op) == 1")))
|
143 |
|
|
|
144 |
|
|
(define_constraint "S"
|
145 |
|
|
"@internal
|
146 |
|
|
A constant call address."
|
147 |
|
|
(and (match_operand 0 "call_insn_operand")
|
148 |
|
|
(match_test "CONSTANT_P (op)")))
|
149 |
|
|
|
150 |
|
|
(define_constraint "T"
|
151 |
|
|
"@internal
|
152 |
|
|
A constant @code{move_operand} that cannot be safely loaded into @code{$25}
|
153 |
|
|
using @code{la}."
|
154 |
|
|
(and (match_operand 0 "move_operand")
|
155 |
|
|
(match_test "CONSTANT_P (op)")
|
156 |
|
|
(match_test "mips_dangerous_for_la25_p (op)")))
|
157 |
|
|
|
158 |
|
|
(define_constraint "U"
|
159 |
|
|
"@internal
|
160 |
|
|
A constant @code{move_operand} that can be safely loaded into @code{$25}
|
161 |
|
|
using @code{la}."
|
162 |
|
|
(and (match_operand 0 "move_operand")
|
163 |
|
|
(match_test "CONSTANT_P (op)")
|
164 |
|
|
(match_test "!mips_dangerous_for_la25_p (op)")))
|
165 |
|
|
|
166 |
|
|
(define_memory_constraint "W"
|
167 |
|
|
"@internal
|
168 |
|
|
A memory address based on a member of @code{BASE_REG_CLASS}. This is
|
169 |
|
|
true for all non-mips16 references (although it can sometimes be implicit
|
170 |
|
|
if @samp{!TARGET_EXPLICIT_RELOCS}). For MIPS16, it excludes stack and
|
171 |
|
|
constant-pool references."
|
172 |
|
|
(and (match_code "mem")
|
173 |
|
|
(match_operand 0 "memory_operand")
|
174 |
|
|
(ior (match_test "!TARGET_MIPS16")
|
175 |
|
|
(and (not (match_operand 0 "stack_operand"))
|
176 |
|
|
(not (match_test "CONSTANT_P (XEXP (op, 0))"))))))
|
177 |
|
|
|
178 |
|
|
(define_constraint "YG"
|
179 |
|
|
"@internal
|
180 |
|
|
A vector zero."
|
181 |
|
|
(and (match_code "const_vector")
|
182 |
|
|
(match_test "op == CONST0_RTX (mode)")))
|
183 |
|
|
|
184 |
|
|
(define_constraint "YA"
|
185 |
|
|
"@internal
|
186 |
|
|
An unsigned 6-bit constant."
|
187 |
|
|
(and (match_code "const_int")
|
188 |
|
|
(match_test "UIMM6_OPERAND (ival)")))
|
189 |
|
|
|
190 |
|
|
(define_constraint "YB"
|
191 |
|
|
"@internal
|
192 |
|
|
A signed 10-bit constant."
|
193 |
|
|
(and (match_code "const_int")
|
194 |
|
|
(match_test "IMM10_OPERAND (ival)")))
|