Mercurial > hg > CbC > CbC_gcc
annotate gcc/rtl.c @ 138:fc828634a951
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 08 Nov 2018 14:17:14 +0900 |
parents | 84e7813d76e9 |
children | 1830386684a0 |
rev | line source |
---|---|
0 | 1 /* RTL utility routines. |
131 | 2 Copyright (C) 1987-2018 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. |
131 | 92 "r" a register. |
93 "p" is a poly_uint16 offset. */ | |
0 | 94 |
95 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT , | |
96 #include "rtl.def" /* rtl expressions are defined here */ | |
97 #undef DEF_RTL_EXPR | |
98 }; | |
99 | |
100 /* Indexed by rtx code, gives a character representing the "class" of | |
101 that rtx code. See rtl.def for documentation on the defined classes. */ | |
102 | |
103 const enum rtx_class rtx_class[NUM_RTX_CODE] = { | |
104 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS, | |
105 #include "rtl.def" /* rtl expressions are defined here */ | |
106 #undef DEF_RTL_EXPR | |
107 }; | |
108 | |
109 /* Indexed by rtx code, gives the size of the rtx in bytes. */ | |
110 | |
111 const unsigned char rtx_code_size[NUM_RTX_CODE] = { | |
112 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ | |
131 | 113 ((FORMAT)[0] == 'w' \ |
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))); | |
131 | 192 if (CONST_POLY_INT_P (x)) |
193 return (RTX_HDR_SIZE | |
194 + sizeof (struct const_poly_int_def) | |
195 + CONST_POLY_INT_COEFFS (x).extra_size ()); | |
0 | 196 if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_HAS_BLOCK_INFO_P (x)) |
197 return RTX_HDR_SIZE + sizeof (struct block_symbol); | |
198 return RTX_CODE_SIZE (GET_CODE (x)); | |
199 } | |
200 | |
111 | 201 /* Allocate an rtx of code CODE with EXTRA bytes in it. The CODE is |
202 stored in the rtx; all the rest is initialized to zero. */ | |
0 | 203 |
204 rtx | |
111 | 205 rtx_alloc_stat_v (RTX_CODE code MEM_STAT_DECL, int extra) |
0 | 206 { |
111 | 207 rtx rt = ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code) + extra |
208 PASS_MEM_STAT); | |
0 | 209 |
210 /* We want to clear everything up to the FLD array. Normally, this | |
211 is one int, but we don't want to assume that and it isn't very | |
212 portable anyway; this is. */ | |
213 | |
214 memset (rt, 0, RTX_HDR_SIZE); | |
215 PUT_CODE (rt, code); | |
216 | |
111 | 217 if (GATHER_STATISTICS) |
218 { | |
219 rtx_alloc_counts[code]++; | |
220 rtx_alloc_sizes[code] += RTX_CODE_SIZE (code); | |
221 } | |
0 | 222 |
223 return rt; | |
224 } | |
225 | |
111 | 226 /* Allocate an rtx of code CODE. The CODE is stored in the rtx; |
227 all the rest is initialized to zero. */ | |
228 | |
229 rtx | |
230 rtx_alloc (RTX_CODE code MEM_STAT_DECL) | |
231 { | |
232 return rtx_alloc_stat_v (code PASS_MEM_STAT, 0); | |
233 } | |
234 | |
235 /* Write the wide constant X to OUTFILE. */ | |
236 | |
237 void | |
238 cwi_output_hex (FILE *outfile, const_rtx x) | |
239 { | |
240 int i = CWI_GET_NUM_ELEM (x); | |
241 gcc_assert (i > 0); | |
242 if (CWI_ELT (x, i - 1) == 0) | |
243 /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is | |
244 non zero. We want all numbers to have a 0x prefix. */ | |
245 fprintf (outfile, "0x"); | |
246 fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, CWI_ELT (x, --i)); | |
247 while (--i >= 0) | |
248 fprintf (outfile, HOST_WIDE_INT_PRINT_PADDED_HEX, CWI_ELT (x, i)); | |
249 } | |
250 | |
0 | 251 |
252 /* Return true if ORIG is a sharable CONST. */ | |
253 | |
254 bool | |
255 shared_const_p (const_rtx orig) | |
256 { | |
257 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
|
258 |
0 | 259 /* CONST can be shared if it contains a SYMBOL_REF. If it contains |
260 a LABEL_REF, it isn't sharable. */ | |
131 | 261 poly_int64 offset; |
0 | 262 return (GET_CODE (XEXP (orig, 0)) == PLUS |
263 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF | |
131 | 264 && poly_int_rtx_p (XEXP (XEXP (orig, 0), 1), &offset)); |
0 | 265 } |
266 | |
267 | |
268 /* Create a new copy of an rtx. | |
269 Recursively copies the operands of the rtx, | |
270 except for those few rtx codes that are sharable. */ | |
271 | |
272 rtx | |
273 copy_rtx (rtx orig) | |
274 { | |
275 rtx copy; | |
276 int i, j; | |
277 RTX_CODE code; | |
278 const char *format_ptr; | |
279 | |
280 code = GET_CODE (orig); | |
281 | |
282 switch (code) | |
283 { | |
284 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
|
285 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
|
286 case VALUE: |
111 | 287 CASE_CONST_ANY: |
0 | 288 case SYMBOL_REF: |
289 case CODE_LABEL: | |
290 case PC: | |
291 case CC0: | |
111 | 292 case RETURN: |
293 case SIMPLE_RETURN: | |
0 | 294 case SCRATCH: |
295 /* SCRATCH must be shared because they represent distinct values. */ | |
296 return orig; | |
297 case CLOBBER: | |
111 | 298 /* Share clobbers of hard registers (like cc0), but do not share pseudo reg |
299 clobbers or clobbers of hard registers that originated as pseudos. | |
300 This is needed to allow safe register renaming. */ | |
301 if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER | |
302 && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0))) | |
0 | 303 return orig; |
304 break; | |
305 | |
131 | 306 case CLOBBER_HIGH: |
307 gcc_assert (REG_P (XEXP (orig, 0))); | |
308 return orig; | |
309 | |
0 | 310 case CONST: |
311 if (shared_const_p (orig)) | |
312 return orig; | |
313 break; | |
314 | |
315 /* A MEM with a constant address is not sharable. The problem is that | |
316 the constant address may need to be reloaded. If the mem is shared, | |
317 then reloading one copy of this mem will cause all copies to appear | |
318 to have been reloaded. */ | |
319 | |
320 default: | |
321 break; | |
322 } | |
323 | |
324 /* Copy the various flags, fields, and other information. We assume | |
325 that all fields need copying, and then clear the fields that should | |
326 not be copied. That is the sensible default behavior, and forces | |
327 us to explicitly document why we are *not* copying a flag. */ | |
328 copy = shallow_copy_rtx (orig); | |
329 | |
330 format_ptr = GET_RTX_FORMAT (GET_CODE (copy)); | |
331 | |
332 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) | |
333 switch (*format_ptr++) | |
334 { | |
335 case 'e': | |
336 if (XEXP (orig, i) != NULL) | |
337 XEXP (copy, i) = copy_rtx (XEXP (orig, i)); | |
338 break; | |
339 | |
340 case 'E': | |
341 case 'V': | |
342 if (XVEC (orig, i) != NULL) | |
343 { | |
344 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); | |
345 for (j = 0; j < XVECLEN (copy, i); j++) | |
346 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j)); | |
347 } | |
348 break; | |
349 | |
350 case 't': | |
351 case 'w': | |
352 case 'i': | |
131 | 353 case 'p': |
0 | 354 case 's': |
355 case 'S': | |
356 case 'T': | |
357 case 'u': | |
358 case 'B': | |
359 case '0': | |
360 /* These are left unchanged. */ | |
361 break; | |
362 | |
363 default: | |
364 gcc_unreachable (); | |
365 } | |
366 return copy; | |
367 } | |
368 | |
369 /* Create a new copy of an rtx. Only copy just one level. */ | |
370 | |
371 rtx | |
111 | 372 shallow_copy_rtx (const_rtx orig MEM_STAT_DECL) |
0 | 373 { |
374 const unsigned int size = rtx_size (orig); | |
111 | 375 rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT); |
376 memcpy (copy, orig, size); | |
377 switch (GET_CODE (orig)) | |
378 { | |
379 /* RTX codes copy_rtx_if_shared_1 considers are shareable, | |
380 the used flag is often used for other purposes. */ | |
381 case REG: | |
382 case DEBUG_EXPR: | |
383 case VALUE: | |
384 CASE_CONST_ANY: | |
385 case SYMBOL_REF: | |
386 case CODE_LABEL: | |
387 case PC: | |
388 case CC0: | |
389 case RETURN: | |
390 case SIMPLE_RETURN: | |
391 case SCRATCH: | |
392 break; | |
393 default: | |
394 /* For all other RTXes clear the used flag on the copy. */ | |
395 RTX_FLAG (copy, used) = 0; | |
396 break; | |
397 } | |
398 return copy; | |
0 | 399 } |
400 | |
401 /* Nonzero when we are generating CONCATs. */ | |
402 int generating_concat_p; | |
403 | |
404 /* Nonzero when we are expanding trees to RTL. */ | |
405 int currently_expanding_to_rtl; | |
406 | |
407 | |
408 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
409 /* 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
|
410 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
|
411 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
|
412 changing as well. */ |
0 | 413 |
414 int | |
415 rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb) | |
416 { | |
417 int i; | |
418 int j; | |
419 enum rtx_code code; | |
420 const char *fmt; | |
421 rtx nx, ny; | |
422 | |
423 if (x == y) | |
424 return 1; | |
425 if (x == 0 || y == 0) | |
426 return 0; | |
427 | |
428 /* Invoke the callback first. */ | |
429 if (cb != NULL | |
430 && ((*cb) (&x, &y, &nx, &ny))) | |
431 return rtx_equal_p_cb (nx, ny, cb); | |
432 | |
433 code = GET_CODE (x); | |
434 /* Rtx's of different codes cannot be equal. */ | |
435 if (code != GET_CODE (y)) | |
436 return 0; | |
437 | |
438 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. | |
439 (REG:SI x) and (REG:HI x) are NOT equivalent. */ | |
440 | |
441 if (GET_MODE (x) != GET_MODE (y)) | |
442 return 0; | |
443 | |
111 | 444 /* 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
|
445 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
|
446 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
447 |
0 | 448 /* Some RTL can be compared nonrecursively. */ |
449 switch (code) | |
450 { | |
451 case REG: | |
452 return (REGNO (x) == REGNO (y)); | |
453 | |
454 case LABEL_REF: | |
111 | 455 return label_ref_label (x) == label_ref_label (y); |
0 | 456 |
457 case SYMBOL_REF: | |
458 return XSTR (x, 0) == XSTR (y, 0); | |
459 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
460 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
|
461 case VALUE: |
0 | 462 case SCRATCH: |
111 | 463 CASE_CONST_UNIQUE: |
0 | 464 return 0; |
465 | |
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
|
466 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
|
467 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
|
468 == 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
|
469 |
111 | 470 case DEBUG_PARAMETER_REF: |
471 return DEBUG_PARAMETER_REF_DECL (x) | |
472 == DEBUG_PARAMETER_REF_DECL (y); | |
473 | |
474 case ENTRY_VALUE: | |
475 return rtx_equal_p_cb (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), cb); | |
476 | |
0 | 477 default: |
478 break; | |
479 } | |
480 | |
481 /* Compare the elements. If any pair of corresponding elements | |
482 fail to match, return 0 for the whole thing. */ | |
483 | |
484 fmt = GET_RTX_FORMAT (code); | |
485 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) | |
486 { | |
487 switch (fmt[i]) | |
488 { | |
489 case 'w': | |
490 if (XWINT (x, i) != XWINT (y, i)) | |
491 return 0; | |
492 break; | |
493 | |
494 case 'n': | |
495 case 'i': | |
496 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
|
497 { |
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
|
498 #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
|
499 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
|
500 || (code == ASM_INPUT && i == 1)) |
111 | 501 && 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
|
502 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
|
503 #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
|
504 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
|
505 } |
0 | 506 break; |
507 | |
131 | 508 case 'p': |
509 if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y))) | |
510 return 0; | |
511 break; | |
512 | |
0 | 513 case 'V': |
514 case 'E': | |
515 /* Two vectors must have the same length. */ | |
516 if (XVECLEN (x, i) != XVECLEN (y, i)) | |
517 return 0; | |
518 | |
519 /* And the corresponding elements must match. */ | |
520 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
|
521 if (rtx_equal_p_cb (XVECEXP (x, i, j), |
0 | 522 XVECEXP (y, i, j), cb) == 0) |
523 return 0; | |
524 break; | |
525 | |
526 case 'e': | |
527 if (rtx_equal_p_cb (XEXP (x, i), XEXP (y, i), cb) == 0) | |
528 return 0; | |
529 break; | |
530 | |
531 case 'S': | |
532 case 's': | |
533 if ((XSTR (x, i) || XSTR (y, i)) | |
534 && (! XSTR (x, i) || ! XSTR (y, i) | |
535 || strcmp (XSTR (x, i), XSTR (y, i)))) | |
536 return 0; | |
537 break; | |
538 | |
539 case 'u': | |
540 /* These are just backpointers, so they don't matter. */ | |
541 break; | |
542 | |
543 case '0': | |
544 case 't': | |
545 break; | |
546 | |
547 /* It is believed that rtx's at this level will never | |
548 contain anything but integers and other rtx's, | |
549 except for within LABEL_REFs and SYMBOL_REFs. */ | |
550 default: | |
551 gcc_unreachable (); | |
552 } | |
553 } | |
554 return 1; | |
555 } | |
556 | |
557 /* 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
|
558 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
|
559 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
|
560 changing as well. */ |
0 | 561 |
562 int | |
563 rtx_equal_p (const_rtx x, const_rtx y) | |
564 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
565 int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
566 int j; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
567 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
|
568 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
|
569 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
570 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
|
571 return 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
572 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
|
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 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
|
576 /* 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
|
577 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
|
578 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
579 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
580 /* (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
|
581 (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
|
582 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
583 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
|
584 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
585 |
111 | 586 /* 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
|
587 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
|
588 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
589 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
590 /* 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
|
591 switch (code) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
592 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
593 case REG: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
594 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
|
595 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
596 case LABEL_REF: |
111 | 597 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
|
598 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
599 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
|
600 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
|
601 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
602 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
|
603 case VALUE: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
604 case SCRATCH: |
111 | 605 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
|
606 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
607 |
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
|
608 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
|
609 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
|
610 == 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
|
611 |
111 | 612 case DEBUG_PARAMETER_REF: |
613 return DEBUG_PARAMETER_REF_DECL (x) | |
614 == DEBUG_PARAMETER_REF_DECL (y); | |
615 | |
616 case ENTRY_VALUE: | |
617 return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y)); | |
618 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
619 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
620 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
621 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
622 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
623 /* 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
|
624 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
|
625 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
626 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
|
627 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
|
628 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
629 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
|
630 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
631 case 'w': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
632 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
|
633 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
634 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
635 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
636 case 'n': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
637 case 'i': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
638 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
|
639 { |
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
|
640 #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
|
641 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
|
642 || (code == ASM_INPUT && i == 1)) |
111 | 643 && 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
|
644 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
|
645 #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
|
646 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
|
647 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
648 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
649 |
131 | 650 case 'p': |
651 if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y))) | |
652 return 0; | |
653 break; | |
654 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
655 case 'V': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
656 case 'E': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
657 /* 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
|
658 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
|
659 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
660 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
661 /* 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
|
662 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
|
663 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
|
664 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
665 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
666 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
667 case 'e': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
668 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
|
669 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
670 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
671 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
672 case 'S': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
673 case 's': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
674 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
|
675 && (! 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
|
676 || 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
|
677 return 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
678 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
679 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
680 case 'u': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
681 /* 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
|
682 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
683 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
684 case '0': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
685 case 't': |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
686 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
687 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
688 /* 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
|
689 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
|
690 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
|
691 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
692 gcc_unreachable (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
693 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
694 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
695 return 1; |
0 | 696 } |
697 | |
111 | 698 /* 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
|
699 |
111 | 700 bool |
701 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
|
702 { |
111 | 703 const_rtx first = RTVEC_ELT (vec, 0); |
704 /* Optimize the important special case of a vector of constants. | |
705 The main use of this function is to detect whether every element | |
706 of CONST_VECTOR is the same. */ | |
707 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
|
708 { |
111 | 709 CASE_CONST_UNIQUE: |
710 for (int i = 1, n = GET_NUM_ELEM (vec); i < n; ++i) | |
711 if (first != RTVEC_ELT (vec, i)) | |
712 return false; | |
713 return true; | |
714 | |
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
|
715 default: |
111 | 716 for (int i = 1, n = GET_NUM_ELEM (vec); i < n; ++i) |
717 if (!rtx_equal_p (first, RTVEC_ELT (vec, i))) | |
718 return false; | |
719 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
|
720 } |
111 | 721 } |
722 | |
723 /* Return an indication of which type of insn should have X as a body. | |
724 In generator files, this can be UNKNOWN if the answer is only known | |
725 at (GCC) runtime. Otherwise the value is CODE_LABEL, INSN, CALL_INSN | |
726 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
|
727 |
111 | 728 enum rtx_code |
729 classify_insn (rtx x) | |
730 { | |
731 if (LABEL_P (x)) | |
732 return CODE_LABEL; | |
733 if (GET_CODE (x) == CALL) | |
734 return CALL_INSN; | |
735 if (ANY_RETURN_P (x)) | |
736 return JUMP_INSN; | |
737 if (GET_CODE (x) == SET) | |
738 { | |
739 if (GET_CODE (SET_DEST (x)) == PC) | |
740 return JUMP_INSN; | |
741 else if (GET_CODE (SET_SRC (x)) == CALL) | |
742 return CALL_INSN; | |
743 else | |
744 return INSN; | |
745 } | |
746 if (GET_CODE (x) == PARALLEL) | |
747 { | |
748 int j; | |
749 bool has_return_p = false; | |
750 for (j = XVECLEN (x, 0) - 1; j >= 0; j--) | |
751 if (GET_CODE (XVECEXP (x, 0, j)) == CALL) | |
752 return CALL_INSN; | |
753 else if (ANY_RETURN_P (XVECEXP (x, 0, j))) | |
754 has_return_p = true; | |
755 else if (GET_CODE (XVECEXP (x, 0, j)) == SET | |
756 && GET_CODE (SET_DEST (XVECEXP (x, 0, j))) == PC) | |
757 return JUMP_INSN; | |
758 else if (GET_CODE (XVECEXP (x, 0, j)) == SET | |
759 && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL) | |
760 return CALL_INSN; | |
761 if (has_return_p) | |
762 return JUMP_INSN; | |
763 } | |
764 #ifdef GENERATOR_FILE | |
765 if (GET_CODE (x) == MATCH_OPERAND | |
766 || GET_CODE (x) == MATCH_OPERATOR | |
767 || GET_CODE (x) == MATCH_PARALLEL | |
768 || GET_CODE (x) == MATCH_OP_DUP | |
769 || GET_CODE (x) == MATCH_DUP | |
770 || GET_CODE (x) == PARALLEL) | |
771 return UNKNOWN; | |
772 #endif | |
773 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
|
774 } |
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
|
775 |
0 | 776 void |
777 dump_rtx_statistics (void) | |
778 { | |
779 int i; | |
780 int total_counts = 0; | |
781 int total_sizes = 0; | |
111 | 782 |
783 if (! GATHER_STATISTICS) | |
784 { | |
785 fprintf (stderr, "No RTX statistics\n"); | |
786 return; | |
787 } | |
788 | |
0 | 789 fprintf (stderr, "\nRTX Kind Count Bytes\n"); |
790 fprintf (stderr, "---------------------------------------\n"); | |
791 for (i = 0; i < LAST_AND_UNUSED_RTX_CODE; i++) | |
792 if (rtx_alloc_counts[i]) | |
793 { | |
794 fprintf (stderr, "%-20s %7d %10d\n", GET_RTX_NAME (i), | |
795 rtx_alloc_counts[i], rtx_alloc_sizes[i]); | |
796 total_counts += rtx_alloc_counts[i]; | |
797 total_sizes += rtx_alloc_sizes[i]; | |
798 } | |
799 if (rtvec_alloc_counts) | |
800 { | |
801 fprintf (stderr, "%-20s %7d %10d\n", "rtvec", | |
802 rtvec_alloc_counts, rtvec_alloc_sizes); | |
803 total_counts += rtvec_alloc_counts; | |
804 total_sizes += rtvec_alloc_sizes; | |
805 } | |
806 fprintf (stderr, "---------------------------------------\n"); | |
807 fprintf (stderr, "%-20s %7d %10d\n", | |
808 "Total", total_counts, total_sizes); | |
809 fprintf (stderr, "---------------------------------------\n"); | |
810 } | |
811 | |
812 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) | |
813 void | |
814 rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line, | |
815 const char *func) | |
816 { | |
817 internal_error | |
818 ("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d", | |
819 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r)) - 1, | |
820 func, trim_filename (file), line); | |
821 } | |
822 | |
823 void | |
824 rtl_check_failed_type1 (const_rtx r, int n, int c1, const char *file, int line, | |
825 const char *func) | |
826 { | |
827 internal_error | |
828 ("RTL check: expected elt %d type '%c', have '%c' (rtx %s) in %s, at %s:%d", | |
829 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)), | |
830 func, trim_filename (file), line); | |
831 } | |
832 | |
833 void | |
834 rtl_check_failed_type2 (const_rtx r, int n, int c1, int c2, const char *file, | |
835 int line, const char *func) | |
836 { | |
837 internal_error | |
838 ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s) in %s, at %s:%d", | |
839 n, c1, c2, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)), | |
840 func, trim_filename (file), line); | |
841 } | |
842 | |
843 void | |
844 rtl_check_failed_code1 (const_rtx r, enum rtx_code code, const char *file, | |
845 int line, const char *func) | |
846 { | |
847 internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d", | |
848 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)), func, | |
849 trim_filename (file), line); | |
850 } | |
851 | |
852 void | |
853 rtl_check_failed_code2 (const_rtx r, enum rtx_code code1, enum rtx_code code2, | |
854 const char *file, int line, const char *func) | |
855 { | |
856 internal_error | |
857 ("RTL check: expected code '%s' or '%s', have '%s' in %s, at %s:%d", | |
858 GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (GET_CODE (r)), | |
859 func, trim_filename (file), line); | |
860 } | |
861 | |
862 void | |
131 | 863 rtl_check_failed_code3 (const_rtx r, enum rtx_code code1, enum rtx_code code2, |
864 enum rtx_code code3, const char *file, int line, | |
865 const char *func) | |
866 { | |
867 internal_error | |
868 ("RTL check: expected code '%s', '%s' or '%s', have '%s' in %s, at %s:%d", | |
869 GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (code3), | |
870 GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); | |
871 } | |
872 | |
873 void | |
111 | 874 rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, machine_mode mode, |
0 | 875 bool not_mode, const char *file, int line, |
876 const char *func) | |
877 { | |
878 internal_error ((not_mode | |
879 ? ("RTL check: expected code '%s' and not mode '%s', " | |
880 "have code '%s' and mode '%s' in %s, at %s:%d") | |
881 : ("RTL check: expected code '%s' and mode '%s', " | |
882 "have code '%s' and mode '%s' in %s, at %s:%d")), | |
883 GET_RTX_NAME (code), GET_MODE_NAME (mode), | |
884 GET_RTX_NAME (GET_CODE (r)), GET_MODE_NAME (GET_MODE (r)), | |
885 func, trim_filename (file), line); | |
886 } | |
887 | |
888 /* Report that line LINE of FILE tried to access the block symbol fields | |
889 of a non-block symbol. FUNC is the function that contains the line. */ | |
890 | |
891 void | |
892 rtl_check_failed_block_symbol (const char *file, int line, const char *func) | |
893 { | |
894 internal_error | |
895 ("RTL check: attempt to treat non-block symbol as a block symbol " | |
896 "in %s, at %s:%d", func, trim_filename (file), line); | |
897 } | |
898 | |
899 /* XXX Maybe print the vector? */ | |
900 void | |
111 | 901 cwi_check_failed_bounds (const_rtx x, int n, const char *file, int line, |
902 const char *func) | |
903 { | |
904 internal_error | |
905 ("RTL check: access of hwi elt %d of vector with last elt %d in %s, at %s:%d", | |
906 n, CWI_GET_NUM_ELEM (x) - 1, func, trim_filename (file), line); | |
907 } | |
908 | |
909 /* XXX Maybe print the vector? */ | |
910 void | |
0 | 911 rtvec_check_failed_bounds (const_rtvec r, int n, const char *file, int line, |
912 const char *func) | |
913 { | |
914 internal_error | |
915 ("RTL check: access of elt %d of vector with last elt %d in %s, at %s:%d", | |
916 n, GET_NUM_ELEM (r) - 1, func, trim_filename (file), line); | |
917 } | |
918 #endif /* ENABLE_RTL_CHECKING */ | |
919 | |
920 #if defined ENABLE_RTL_FLAG_CHECKING | |
921 void | |
922 rtl_check_failed_flag (const char *name, const_rtx r, const char *file, | |
923 int line, const char *func) | |
924 { | |
925 internal_error | |
926 ("RTL flag check: %s used with unexpected rtx code '%s' in %s, at %s:%d", | |
927 name, GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line); | |
928 } | |
929 #endif /* ENABLE_RTL_FLAG_CHECKING */ |