Mercurial > hg > CbC > CbC_gcc
annotate gcc/rtl.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
rev | line source |
---|---|
0 | 1 /* RTL utility routines. |
111 | 2 Copyright (C) 1987-2017 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
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 | |
9 version. | |
10 | |
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 | |
14 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 /* This file is compiled twice: once for the generator programs | |
21 once for the compiler. */ | |
22 #ifdef GENERATOR_FILE | |
23 #include "bconfig.h" | |
24 #else | |
25 #include "config.h" | |
26 #endif | |
27 | |
28 #include "system.h" | |
29 #include "coretypes.h" | |
30 #include "tm.h" | |
31 #include "rtl.h" | |
32 #ifdef GENERATOR_FILE | |
33 # include "errors.h" | |
34 #else | |
111 | 35 # include "rtlhash.h" |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
36 # include "diagnostic-core.h" |
0 | 37 #endif |
38 | |
39 | |
40 /* Indexed by rtx code, gives number of operands for an rtx with that code. | |
41 Does NOT include rtx header data (code and links). */ | |
42 | |
43 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 , | |
44 | |
45 const unsigned char rtx_length[NUM_RTX_CODE] = { | |
46 #include "rtl.def" | |
47 }; | |
48 | |
49 #undef DEF_RTL_EXPR | |
50 | |
51 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */ | |
52 | |
53 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME , | |
54 | |
55 const char * const rtx_name[NUM_RTX_CODE] = { | |
56 #include "rtl.def" /* rtl expressions are documented here */ | |
57 }; | |
58 | |
59 #undef DEF_RTL_EXPR | |
60 | |
61 /* Indexed by rtx code, gives a sequence of operand-types for | |
62 rtx's of that code. The sequence is a C string in which | |
63 each character describes one operand. */ | |
64 | |
65 const char * const rtx_format[NUM_RTX_CODE] = { | |
66 /* "*" undefined. | |
67 can cause a warning message | |
68 "0" field is unused (or used in a phase-dependent manner) | |
69 prints nothing | |
70 "i" an integer | |
71 prints the integer | |
72 "n" like "i", but prints entries from `note_insn_name' | |
73 "w" an integer of width HOST_BITS_PER_WIDE_INT | |
74 prints the integer | |
75 "s" a pointer to a string | |
76 prints the string | |
77 "S" like "s", but optional: | |
78 the containing rtx may end before this operand | |
79 "T" like "s", but treated specially by the RTL reader; | |
80 only found in machine description patterns. | |
81 "e" a pointer to an rtl expression | |
82 prints the expression | |
83 "E" a pointer to a vector that points to a number of rtl expressions | |
84 prints a list of the rtl expressions | |
85 "V" like "E", but optional: | |
86 the containing rtx may end before this operand | |
87 "u" a pointer to another insn | |
88 prints the uid of the insn. | |
89 "b" is a pointer to a bitmap header. | |
90 "B" is a basic block pointer. | |
111 | 91 "t" is a tree pointer. |
92 "r" a register. */ | |
0 | 93 |
94 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT , | |
95 #include "rtl.def" /* rtl expressions are defined here */ | |
96 #undef DEF_RTL_EXPR | |
97 }; | |
98 | |
99 /* Indexed by rtx code, gives a character representing the "class" of | |
100 that rtx code. See rtl.def for documentation on the defined classes. */ | |
101 | |
102 const enum rtx_class rtx_class[NUM_RTX_CODE] = { | |
103 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS, | |
104 #include "rtl.def" /* rtl expressions are defined here */ | |
105 #undef DEF_RTL_EXPR | |
106 }; | |
107 | |
108 /* Indexed by rtx code, gives the size of the rtx in bytes. */ | |
109 | |
110 const unsigned char rtx_code_size[NUM_RTX_CODE] = { | |
111 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ | |
111 | 112 (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \ |
113 || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT) \ | |
0 | 114 ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \ |
111 | 115 : (ENUM) == REG \ |
116 ? RTX_HDR_SIZE + sizeof (reg_info) \ | |
0 | 117 : RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)), |
118 | |
119 #include "rtl.def" | |
120 #undef DEF_RTL_EXPR | |
121 }; | |
122 | |
123 /* Names for kinds of NOTEs and REG_NOTEs. */ | |
124 | |
125 const char * const note_insn_name[NOTE_INSN_MAX] = | |
126 { | |
127 #define DEF_INSN_NOTE(NAME) #NAME, | |
128 #include "insn-notes.def" | |
129 #undef DEF_INSN_NOTE | |
130 }; | |
131 | |
132 const char * const reg_note_name[REG_NOTE_MAX] = | |
133 { | |
134 #define DEF_REG_NOTE(NAME) #NAME, | |
135 #include "reg-notes.def" | |
136 #undef DEF_REG_NOTE | |
137 }; | |
138 | |
139 static int rtx_alloc_counts[(int) LAST_AND_UNUSED_RTX_CODE]; | |
140 static int rtx_alloc_sizes[(int) LAST_AND_UNUSED_RTX_CODE]; | |
141 static int rtvec_alloc_counts; | |
142 static int rtvec_alloc_sizes; | |
143 | |
144 | |
145 /* Allocate an rtx vector of N elements. | |
146 Store the length, and initialize all elements to zero. */ | |
147 | |
148 rtvec | |
149 rtvec_alloc (int n) | |
150 { | |
151 rtvec rt; | |
152 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
153 rt = ggc_alloc_rtvec_sized (n); |
0 | 154 /* Clear out the vector. */ |
155 memset (&rt->elem[0], 0, n * sizeof (rtx)); | |
156 | |
157 PUT_NUM_ELEM (rt, n); | |
158 | |
111 | 159 if (GATHER_STATISTICS) |
160 { | |
161 rtvec_alloc_counts++; | |
162 rtvec_alloc_sizes += n * sizeof (rtx); | |
163 } | |
0 | 164 |
165 return rt; | |
166 } | |
167 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
168 /* Create a bitwise copy of VEC. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
169 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
170 rtvec |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
171 shallow_copy_rtvec (rtvec vec) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
172 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
173 rtvec newvec; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
174 int n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
175 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
176 n = GET_NUM_ELEM (vec); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
177 newvec = rtvec_alloc (n); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
178 memcpy (&newvec->elem[0], &vec->elem[0], sizeof (rtx) * n); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
179 return newvec; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
180 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
181 |
0 | 182 /* Return the number of bytes occupied by rtx value X. */ |
183 | |
184 unsigned int | |
185 rtx_size (const_rtx x) | |
186 { | |
111 | 187 if (CONST_WIDE_INT_P (x)) |
188 return (RTX_HDR_SIZE | |
189 + sizeof (struct hwivec_def) | |
190 + ((CONST_WIDE_INT_NUNITS (x) - 1) | |
191 * sizeof (HOST_WIDE_INT))); | |
0 | 192 if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_HAS_BLOCK_INFO_P (x)) |
193 return RTX_HDR_SIZE + sizeof (struct block_symbol); | |
194 return RTX_CODE_SIZE (GET_CODE (x)); | |
195 } | |
196 | |
111 | 197 /* Allocate an rtx of code CODE with EXTRA bytes in it. The CODE is |
198 stored in the rtx; all the rest is initialized to zero. */ | |
0 | 199 |
200 rtx | |
111 | 201 rtx_alloc_stat_v (RTX_CODE code MEM_STAT_DECL, int extra) |
0 | 202 { |
111 | 203 rtx rt = ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code) + extra |
204 PASS_MEM_STAT); | |
0 | 205 |
206 /* We want to clear everything up to the FLD array. Normally, this | |
207 is one int, but we don't want to assume that and it isn't very | |
208 portable anyway; this is. */ | |
209 | |
210 memset (rt, 0, RTX_HDR_SIZE); | |
211 PUT_CODE (rt, code); | |
212 | |
111 | 213 if (GATHER_STATISTICS) |
214 { | |
215 rtx_alloc_counts[code]++; | |
216 rtx_alloc_sizes[code] += RTX_CODE_SIZE (code); | |
217 } | |
0 | 218 |
219 return rt; | |
220 } | |
221 | |
111 | 222 /* Allocate an rtx of code CODE. The CODE is stored in the rtx; |
223 all the rest is initialized to zero. */ | |
224 | |
225 rtx | |
226 rtx_alloc (RTX_CODE code MEM_STAT_DECL) | |
227 { | |
228 return rtx_alloc_stat_v (code PASS_MEM_STAT, 0); | |
229 } | |
230 | |
231 /* Write the wide constant X to OUTFILE. */ | |
232 | |
233 void | |
234 cwi_output_hex (FILE *outfile, const_rtx x) | |
235 { | |
236 int i = CWI_GET_NUM_ELEM (x); | |
237 gcc_assert (i > 0); | |
238 if (CWI_ELT (x, i - 1) == 0) | |
239 /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is | |
240 non zero. We want all numbers to have a 0x prefix. */ | |
241 fprintf (outfile, "0x"); | |
242 fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, CWI_ELT (x, --i)); | |
243 while (--i >= 0) | |
244 fprintf (outfile, HOST_WIDE_INT_PRINT_PADDED_HEX, CWI_ELT (x, i)); | |
245 } | |
246 | |
0 | 247 |
248 /* Return true if ORIG is a sharable CONST. */ | |
249 | |
250 bool | |
251 shared_const_p (const_rtx orig) | |
252 { | |
253 gcc_assert (GET_CODE (orig) == CONST); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
254 |
0 | 255 /* CONST can be shared if it contains a SYMBOL_REF. If it contains |
256 a LABEL_REF, it isn't sharable. */ | |
257 return (GET_CODE (XEXP (orig, 0)) == PLUS | |
258 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF | |
111 | 259 && CONST_INT_P (XEXP (XEXP (orig, 0), 1))); |
0 | 260 } |
261 | |
262 | |
263 /* Create a new copy of an rtx. | |
264 Recursively copies the operands of the rtx, | |
265 except for those few rtx codes that are sharable. */ | |
266 | |
267 rtx | |
268 copy_rtx (rtx orig) | |
269 { | |
270 rtx copy; | |
271 int i, j; | |
272 RTX_CODE code; | |
273 const char *format_ptr; | |
274 | |
275 code = GET_CODE (orig); | |
276 | |
277 switch (code) | |
278 { | |
279 case REG: | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
280 case DEBUG_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
281 case VALUE: |
111 | 282 CASE_CONST_ANY: |
0 | 283 case SYMBOL_REF: |
284 case CODE_LABEL: | |
285 case PC: | |
286 case CC0: | |
111 | 287 case RETURN: |
288 case SIMPLE_RETURN: | |
0 | 289 case SCRATCH: |
290 /* SCRATCH must be shared because they represent distinct values. */ | |
291 return orig; | |
292 case CLOBBER: | |
111 | 293 /* Share clobbers of hard registers (like cc0), but do not share pseudo reg |
294 clobbers or clobbers of hard registers that originated as pseudos. | |
295 This is needed to allow safe register renaming. */ | |
296 if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER | |
297 && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0))) | |
0 | 298 return orig; |
299 break; | |
300 | |
301 case CONST: | |
302 if (shared_const_p (orig)) | |
303 return orig; | |
304 break; | |
305 | |
306 /* A MEM with a constant address is not sharable. The problem is that | |
307 the constant address may need to be reloaded. If the mem is shared, | |
308 then reloading one copy of this mem will cause all copies to appear | |
309 to have been reloaded. */ | |
310 | |
311 default: | |
312 break; | |
313 } | |
314 | |
315 /* Copy the various flags, fields, and other information. We assume | |
316 that all fields need copying, and then clear the fields that should | |
317 not be copied. That is the sensible default behavior, and forces | |
318 us to explicitly document why we are *not* copying a flag. */ | |
319 copy = shallow_copy_rtx (orig); | |
320 | |
321 format_ptr = GET_RTX_FORMAT (GET_CODE (copy)); | |
322 | |
323 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) | |
324 switch (*format_ptr++) | |
325 { | |
326 case 'e': | |
327 if (XEXP (orig, i) != NULL) | |
328 XEXP (copy, i) = copy_rtx (XEXP (orig, i)); | |
329 break; | |
330 | |
331 case 'E': | |
332 case 'V': | |
333 if (XVEC (orig, i) != NULL) | |
334 { | |
335 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); | |
336 for (j = 0; j < XVECLEN (copy, i); j++) | |
337 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j)); | |
338 } | |
339 break; | |
340 | |
341 case 't': | |
342 case 'w': | |
343 case 'i': | |
344 case 's': | |
345 case 'S': | |
346 case 'T': | |
347 case 'u': | |
348 case 'B': | |
349 case '0': | |
350 /* These are left unchanged. */ | |
351 break; | |
352 | |
353 default: | |
354 gcc_unreachable (); | |
355 } | |
356 return copy; | |
357 } | |
358 | |
359 /* Create a new copy of an rtx. Only copy just one level. */ | |
360 | |
361 rtx | |
111 | 362 shallow_copy_rtx (const_rtx orig MEM_STAT_DECL) |
0 | 363 { |
364 const unsigned int size = rtx_size (orig); | |
111 | 365 rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT); |
366 memcpy (copy, orig, size); | |
367 switch (GET_CODE (orig)) | |
368 { | |
369 /* RTX codes copy_rtx_if_shared_1 considers are shareable, | |
370 the used flag is often used for other purposes. */ | |
371 case REG: | |
372 case DEBUG_EXPR: | |
373 case VALUE: | |
374 CASE_CONST_ANY: | |
375 case SYMBOL_REF: | |
376 case CODE_LABEL: | |
377 case PC: | |
378 case CC0: | |
379 case RETURN: | |
380 case SIMPLE_RETURN: | |
381 case SCRATCH: | |
382 break; | |
383 default: | |
384 /* For all other RTXes clear the used flag on the copy. */ | |
385 RTX_FLAG (copy, used) = 0; | |
386 break; | |
387 } | |
388 return copy; | |
0 | 389 } |
390 | |
391 /* Nonzero when we are generating CONCATs. */ | |
392 int generating_concat_p; | |
393 | |
394 /* Nonzero when we are expanding trees to RTL. */ | |
395 int currently_expanding_to_rtl; | |
396 | |
397 | |
398 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
399 /* Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
400 When the callback returns true, we continue with the new pair. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
401 Whenever changing this function check if rtx_equal_p below doesn't need |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
402 changing as well. */ |
0 | 403 |
404 int | |
405 rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb) | |
406 { | |
407 int i; | |
408 int j; | |
409 enum rtx_code code; | |
410 const char *fmt; | |
411 rtx nx, ny; | |
412 | |
413 if (x == y) | |
414 return 1; | |
415 if (x == 0 || y == 0) | |
416 return 0; | |
417 | |
418 /* Invoke the callback first. */ | |
419 if (cb != NULL | |
420 && ((*cb) (&x, &y, &nx, &ny))) | |
421 return rtx_equal_p_cb (nx, ny, cb); | |
422 | |
423 code = GET_CODE (x); | |
424 /* Rtx's of different codes cannot be equal. */ | |
425 if (code != GET_CODE (y)) | |
426 return 0; | |
427 | |
428 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. | |
429 (REG:SI x) and (REG:HI x) are NOT equivalent. */ | |
430 | |
431 if (GET_MODE (x) != GET_MODE (y)) | |
432 return 0; | |
433 | |
111 | 434 /* MEMs referring to different address space are not equivalent. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
435 if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
436 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
437 |
0 | 438 /* Some RTL can be compared nonrecursively. */ |
439 switch (code) | |
440 { | |
441 case REG: | |
442 return (REGNO (x) == REGNO (y)); | |
443 | |
444 case LABEL_REF: | |
111 | 445 return label_ref_label (x) == label_ref_label (y); |
0 | 446 |
447 case SYMBOL_REF: | |
448 return XSTR (x, 0) == XSTR (y, 0); | |
449 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
450 case DEBUG_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
451 case VALUE: |
0 | 452 case SCRATCH: |
111 | 453 CASE_CONST_UNIQUE: |
0 | 454 return 0; |
455 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
456 case DEBUG_IMPLICIT_PTR: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
457 return DEBUG_IMPLICIT_PTR_DECL (x) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
458 == DEBUG_IMPLICIT_PTR_DECL (y); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
459 |
111 | 460 case DEBUG_PARAMETER_REF: |
461 return DEBUG_PARAMETER_REF_DECL (x) | |
462 == DEBUG_PARAMETER_REF_DECL (y); | |
463 | |
464 case ENTRY_VALUE: | |
465 return rtx_equal_p_cb (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), cb); | |
466 | |
0 | 467 default: |
468 break; | |
469 } | |
470 | |
471 /* Compare the elements. If any pair of corresponding elements | |
472 fail to match, return 0 for the whole thing. */ | |
473 | |
474 fmt = GET_RTX_FORMAT (code); | |
475 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) | |
476 { | |
477 switch (fmt[i]) | |
478 { | |
479 case 'w': | |
480 if (XWINT (x, i) != XWINT (y, i)) | |
481 return 0; | |
482 break; | |
483 | |
484 case 'n': | |
485 case 'i': | |
486 if (XINT (x, i) != XINT (y, i)) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
487 { |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
488 #ifndef GENERATOR_FILE |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
489 if (((code == ASM_OPERANDS && i == 6) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
490 || (code == ASM_INPUT && i == 1)) |
111 | 491 && XINT (x, i) == XINT (y, i)) |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
492 break; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
493 #endif |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
494 return 0; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
495 } |
0 | 496 break; |
497 | |
498 case 'V': | |
499 case 'E': | |
500 /* Two vectors must have the same length. */ | |
501 if (XVECLEN (x, i) != XVECLEN (y, i)) | |
502 return 0; | |
503 | |
504 /* And the corresponding elements must match. */ | |
505 for (j = 0; j < XVECLEN (x, i); j++) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
506 if (rtx_equal_p_cb (XVECEXP (x, i, j), |
0 | 507 XVECEXP (y, i, j), cb) == 0) |
508 return 0; | |
509 break; | |
510 | |
511 case 'e': | |
512 if (rtx_equal_p_cb (XEXP (x, i), XEXP (y, i), cb) == 0) | |
513 return 0; | |
514 break; | |
515 | |
516 case 'S': | |
517 case 's': | |
518 if ((XSTR (x, i) || XSTR (y, i)) | |
519 && (! XSTR (x, i) || ! XSTR (y, i) | |
520 || strcmp (XSTR (x, i), XSTR (y, i)))) | |
521 return 0; | |
522 break; | |
523 | |
524 case 'u': | |
525 /* These are just backpointers, so they don't matter. */ | |
526 break; | |
527 | |
528 case '0': | |
529 case 't': | |
530 break; | |
531 | |
532 /* It is believed that rtx's at this level will never | |
533 contain anything but integers and other rtx's, | |
534 except for within LABEL_REFs and SYMBOL_REFs. */ | |
535 default: | |
536 gcc_unreachable (); | |
537 } | |
538 } | |
539 return 1; | |
540 } | |
541 | |
542 /* Return 1 if X and Y are identical-looking rtx's. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
543 This is the Lisp function EQUAL for rtx arguments. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
544 Whenever changing this function check if rtx_equal_p_cb above doesn't need |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
545 changing as well. */ |
0 | 546 |
547 int | |
548 rtx_equal_p (const_rtx x, const_rtx y) | |
549 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
550 int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
551 int j; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
552 enum rtx_code code; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
553 const char *fmt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
554 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
555 if (x == y) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
556 return 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
557 if (x == 0 || y == 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
558 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
559 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
560 code = GET_CODE (x); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
561 /* Rtx's of different codes cannot be equal. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
562 if (code != GET_CODE (y)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
563 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
564 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
565 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
566 (REG:SI x) and (REG:HI x) are NOT equivalent. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
567 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
568 if (GET_MODE (x) != GET_MODE (y)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
569 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
570 |
111 | 571 /* MEMs referring to different address space are not equivalent. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
572 if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
573 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
574 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
575 /* Some RTL can be compared nonrecursively. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
576 switch (code) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
577 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
578 case REG: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
579 return (REGNO (x) == REGNO (y)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
580 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
581 case LABEL_REF: |
111 | 582 return label_ref_label (x) == label_ref_label (y); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
583 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
584 case SYMBOL_REF: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
585 return XSTR (x, 0) == XSTR (y, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
586 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
587 case DEBUG_EXPR: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
588 case VALUE: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
589 case SCRATCH: |
111 | 590 CASE_CONST_UNIQUE: |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
591 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
592 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
593 case DEBUG_IMPLICIT_PTR: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
594 return DEBUG_IMPLICIT_PTR_DECL (x) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
595 == DEBUG_IMPLICIT_PTR_DECL (y); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
596 |
111 | 597 case DEBUG_PARAMETER_REF: |
598 return DEBUG_PARAMETER_REF_DECL (x) | |
599 == DEBUG_PARAMETER_REF_DECL (y); | |
600 | |
601 case ENTRY_VALUE: | |
602 return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y)); | |
603 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
604 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
605 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
606 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
607 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
608 /* Compare the elements. If any pair of corresponding elements |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
609 fail to match, return 0 for the whole thing. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
610 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
611 fmt = GET_RTX_FORMAT (code); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
612 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
613 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
614 switch (fmt[i]) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
615 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
616 case 'w': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
617 if (XWINT (x, i) != XWINT (y, i)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
618 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
619 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
620 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
621 case 'n': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
622 case 'i': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
623 if (XINT (x, i) != XINT (y, i)) |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
624 { |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
625 #ifndef GENERATOR_FILE |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
626 if (((code == ASM_OPERANDS && i == 6) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
627 || (code == ASM_INPUT && i == 1)) |
111 | 628 && XINT (x, i) == XINT (y, i)) |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
629 break; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
630 #endif |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
631 return 0; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
632 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
633 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
634 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
635 case 'V': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
636 case 'E': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
637 /* Two vectors must have the same length. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
638 if (XVECLEN (x, i) != XVECLEN (y, i)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
639 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
640 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
641 /* And the corresponding elements must match. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
642 for (j = 0; j < XVECLEN (x, i); j++) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
643 if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
644 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
645 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
646 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
647 case 'e': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
648 if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
649 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
650 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
651 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
652 case 'S': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
653 case 's': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
654 if ((XSTR (x, i) || XSTR (y, i)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
655 && (! XSTR (x, i) || ! XSTR (y, i) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
656 || strcmp (XSTR (x, i), XSTR (y, i)))) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
657 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
658 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
659 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
660 case 'u': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
661 /* These are just backpointers, so they don't matter. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
662 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
663 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
664 case '0': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
665 case 't': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
666 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
667 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
668 /* It is believed that rtx's at this level will never |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
669 contain anything but integers and other rtx's, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
670 except for within LABEL_REFs and SYMBOL_REFs. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
671 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
672 gcc_unreachable (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
673 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
674 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
675 return 1; |
0 | 676 } |
677 | |
111 | 678 /* Return true if all elements of VEC are equal. */ |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
679 |
111 | 680 bool |
681 rtvec_all_equal_p (const_rtvec vec) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
682 { |
111 | 683 const_rtx first = RTVEC_ELT (vec, 0); |
684 /* Optimize the important special case of a vector of constants. | |
685 The main use of this function is to detect whether every element | |
686 of CONST_VECTOR is the same. */ | |
687 switch (GET_CODE (first)) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
688 { |
111 | 689 CASE_CONST_UNIQUE: |
690 for (int i = 1, n = GET_NUM_ELEM (vec); i < n; ++i) | |
691 if (first != RTVEC_ELT (vec, i)) | |
692 return false; | |
693 return true; | |
694 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
695 default: |
111 | 696 for (int i = 1, n = GET_NUM_ELEM (vec); i < n; ++i) |
697 if (!rtx_equal_p (first, RTVEC_ELT (vec, i))) | |
698 return false; | |
699 return true; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
700 } |
111 | 701 } |
702 | |
703 /* Return an indication of which type of insn should have X as a body. | |
704 In generator files, this can be UNKNOWN if the answer is only known | |
705 at (GCC) runtime. Otherwise the value is CODE_LABEL, INSN, CALL_INSN | |
706 or JUMP_INSN. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
707 |
111 | 708 enum rtx_code |
709 classify_insn (rtx x) | |
710 { | |
711 if (LABEL_P (x)) | |
712 return CODE_LABEL; | |
713 if (GET_CODE (x) == CALL) | |
714 return CALL_INSN; | |
715 if (ANY_RETURN_P (x)) | |
716 return JUMP_INSN; | |
717 if (GET_CODE (x) == SET) | |
718 { | |
719 if (GET_CODE (SET_DEST (x)) == PC) | |
720 return JUMP_INSN; | |
721 else if (GET_CODE (SET_SRC (x)) == CALL) | |
722 return CALL_INSN; | |
723 else | |
724 return INSN; | |
725 } | |
726 if (GET_CODE (x) == PARALLEL) | |
727 { | |
728 int j; | |
729 bool has_return_p = false; | |
730 for (j = XVECLEN (x, 0) - 1; j >= 0; j--) | |
731 if (GET_CODE (XVECEXP (x, 0, j)) == CALL) | |
732 return CALL_INSN; | |
733 else if (ANY_RETURN_P (XVECEXP (x, 0, j))) | |
734 has_return_p = true; | |
735 else if (GET_CODE (XVECEXP (x, 0, j)) == SET | |
736 && GET_CODE (SET_DEST (XVECEXP (x, 0, j))) == PC) | |
737 return JUMP_INSN; | |
738 else if (GET_CODE (XVECEXP (x, 0, j)) == SET | |
739 && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL) | |
740 return CALL_INSN; | |
741 if (has_return_p) | |
742 return JUMP_INSN; | |
743 } | |
744 #ifdef GENERATOR_FILE | |
745 if (GET_CODE (x) == MATCH_OPERAND | |
746 || GET_CODE (x) == MATCH_OPERATOR | |
747 || GET_CODE (x) == MATCH_PARALLEL | |
748 || GET_CODE (x) == MATCH_OP_DUP | |
749 || GET_CODE (x) == MATCH_DUP | |
750 || GET_CODE (x) == PARALLEL) | |
751 return UNKNOWN; | |
752 #endif | |
753 return INSN; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
754 } |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
755 |
0 | 756 void |
757 dump_rtx_statistics (void) | |
758 { | |
759 int i; | |
760 int total_counts = 0; | |
761 int total_sizes = 0; | |
111 | 762 |
763 if (! GATHER_STATISTICS) | |
764 { | |
765 fprintf (stderr, "No RTX statistics\n"); | |
766 return; | |
767 } | |
768 | |
0 | 769 fprintf (stderr, "\nRTX Kind Count Bytes\n"); |
770 fprintf (stderr, "---------------------------------------\n"); | |
771 for (i = 0; i < LAST_AND_UNUSED_RTX_CODE; i++) | |
772 if (rtx_alloc_counts[i]) | |
773 { | |
774 fprintf (stderr, "%-20s %7d %10d\n", GET_RTX_NAME (i), | |
775 rtx_alloc_counts[i], rtx_alloc_sizes[i]); | |
776 total_counts += rtx_alloc_counts[i]; | |
777 total_sizes += rtx_alloc_sizes[i]; | |
778 } | |
779 if (rtvec_alloc_counts) | |
780 { | |
781 fprintf (stderr, "%-20s %7d %10d\n", "rtvec", | |
782 rtvec_alloc_counts, rtvec_alloc_sizes); | |
783 total_counts += rtvec_alloc_counts; | |
784 total_sizes += rtvec_alloc_sizes; | |
785 } | |
786 fprintf (stderr, "---------------------------------------\n"); | |
787 fprintf (stderr, "%-20s %7d %10d\n", | |
788 "Total", total_counts, total_sizes); | |
789 fprintf (stderr, "---------------------------------------\n"); | |
790 } | |
791 | |
792 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) | |
793 void | |
794 rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line, | |
795 const char *func) | |
796 { | |
797 internal_error | |
798 ("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d", | |
799 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r)) - 1, | |
800 func, trim_filename (file), line); | |
801 } | |
802 | |
803 void | |
804 rtl_check_failed_type1 (const_rtx r, int n, int c1, const char *file, int line, | |
805 const char *func) | |
806 { | |
807 internal_error | |
808 ("RTL check: expected elt %d type '%c', have '%c' (rtx %s) in %s, at %s:%d", | |
809 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)), | |
810 func, trim_filename (file), line); | |
811 } | |
812 | |
813 void | |
814 rtl_check_failed_type2 (const_rtx r, int n, int c1, int c2, const char *file, | |
815 int line, const char *func) | |
816 { | |
817 internal_error | |
818 ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s) in %s, at %s:%d", | |
819 n, c1, c2, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)), | |
820 func, trim_filename (file), line); | |
821 } | |
822 | |
823 void | |
824 rtl_check_failed_code1 (const_rtx r, enum rtx_code code, const char *file, | |
825 int line, const char *func) | |
826 { | |
827 internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d", | |
828 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)), func, | |
829 trim_filename (file), line); | |
830 } | |
831 | |
832 void | |
833 rtl_check_failed_code2 (const_rtx r, enum rtx_code code1, enum rtx_code code2, | |
834 const char *file, int line, const char *func) | |
835 { | |
836 internal_error | |
837 ("RTL check: expected code '%s' or '%s', have '%s' in %s, at %s:%d", | |
838 GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (GET_CODE (r)), | |
839 func, trim_filename (file), line); | |
840 } | |
841 | |
842 void | |
111 | 843 rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, machine_mode mode, |
0 | 844 bool not_mode, const char *file, int line, |
845 const char *func) | |
846 { | |
847 internal_error ((not_mode | |
848 ? ("RTL check: expected code '%s' and not mode '%s', " | |
849 "have code '%s' and mode '%s' in %s, at %s:%d") | |
850 : ("RTL check: expected code '%s' and mode '%s', " | |
851 "have code '%s' and mode '%s' in %s, at %s:%d")), | |
852 GET_RTX_NAME (code), GET_MODE_NAME (mode), | |
853 GET_RTX_NAME (GET_CODE (r)), GET_MODE_NAME (GET_MODE (r)), | |
854 func, trim_filename (file), line); | |
855 } | |
856 | |
857 /* Report that line LINE of FILE tried to access the block symbol fields | |
858 of a non-block symbol. FUNC is the function that contains the line. */ | |
859 | |
860 void | |
861 rtl_check_failed_block_symbol (const char *file, int line, const char *func) | |
862 { | |
863 internal_error | |
864 ("RTL check: attempt to treat non-block symbol as a block symbol " | |
865 "in %s, at %s:%d", func, trim_filename (file), line); | |
866 } | |
867 | |
868 /* XXX Maybe print the vector? */ | |
869 void | |
111 | 870 cwi_check_failed_bounds (const_rtx x, int n, const char *file, int line, |
871 const char *func) | |
872 { | |
873 internal_error | |
874 ("RTL check: access of hwi elt %d of vector with last elt %d in %s, at %s:%d", | |
875 n, CWI_GET_NUM_ELEM (x) - 1, func, trim_filename (file), line); | |
876 } | |
877 | |
878 /* XXX Maybe print the vector? */ | |
879 void | |
0 | 880 rtvec_check_failed_bounds (const_rtvec r, int n, const char *file, int line, |
881 const char *func) | |
882 { | |
883 internal_error | |
884 ("RTL check: access of elt %d of vector with last elt %d in %s, at %s:%d", | |
885 n, GET_NUM_ELEM (r) - 1, func, trim_filename (file), line); | |
886 } | |
887 #endif /* ENABLE_RTL_CHECKING */ | |
888 | |
889 #if defined ENABLE_RTL_FLAG_CHECKING | |
890 void | |
891 rtl_check_failed_flag (const char *name, const_rtx r, const char *file, | |
892 int line, const char *func) | |
893 { | |
894 internal_error | |
895 ("RTL flag check: %s used with unexpected rtx code '%s' in %s, at %s:%d", | |
896 name, GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); | |
897 } | |
898 #endif /* ENABLE_RTL_FLAG_CHECKING */ |