2013-05-28 Steve Ellcey <sellcey@mips.com>
[official-gcc.git] / gcc / rtl.c
blobb2d88f783b77e093c4bc1de9e7ad34c023727e6c
1 /* RTL utility routines.
2 Copyright (C) 1987-2013 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
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
28 #include "system.h"
29 #include "coretypes.h"
30 #include "tm.h"
31 #include "rtl.h"
32 #include "ggc.h"
33 #ifdef GENERATOR_FILE
34 # include "errors.h"
35 #else
36 # include "diagnostic-core.h"
37 #endif
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). */
43 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
45 const unsigned char rtx_length[NUM_RTX_CODE] = {
46 #include "rtl.def"
49 #undef DEF_RTL_EXPR
51 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
53 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
55 const char * const rtx_name[NUM_RTX_CODE] = {
56 #include "rtl.def" /* rtl expressions are documented here */
59 #undef DEF_RTL_EXPR
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. */
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.
91 "t" is a tree pointer. */
93 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
94 #include "rtl.def" /* rtl expressions are defined here */
95 #undef DEF_RTL_EXPR
98 /* Indexed by rtx code, gives a character representing the "class" of
99 that rtx code. See rtl.def for documentation on the defined classes. */
101 const enum rtx_class rtx_class[NUM_RTX_CODE] = {
102 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
103 #include "rtl.def" /* rtl expressions are defined here */
104 #undef DEF_RTL_EXPR
107 /* Indexed by rtx code, gives the size of the rtx in bytes. */
109 const unsigned char rtx_code_size[NUM_RTX_CODE] = {
110 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \
111 (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \
112 || (ENUM) == CONST_FIXED) \
113 ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \
114 : RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)),
116 #include "rtl.def"
117 #undef DEF_RTL_EXPR
120 /* Names for kinds of NOTEs and REG_NOTEs. */
122 const char * const note_insn_name[NOTE_INSN_MAX] =
124 #define DEF_INSN_NOTE(NAME) #NAME,
125 #include "insn-notes.def"
126 #undef DEF_INSN_NOTE
129 const char * const reg_note_name[REG_NOTE_MAX] =
131 #define DEF_REG_NOTE(NAME) #NAME,
132 #include "reg-notes.def"
133 #undef DEF_REG_NOTE
136 static int rtx_alloc_counts[(int) LAST_AND_UNUSED_RTX_CODE];
137 static int rtx_alloc_sizes[(int) LAST_AND_UNUSED_RTX_CODE];
138 static int rtvec_alloc_counts;
139 static int rtvec_alloc_sizes;
142 /* Allocate an rtx vector of N elements.
143 Store the length, and initialize all elements to zero. */
145 rtvec
146 rtvec_alloc (int n)
148 rtvec rt;
150 rt = ggc_alloc_rtvec_sized (n);
151 /* Clear out the vector. */
152 memset (&rt->elem[0], 0, n * sizeof (rtx));
154 PUT_NUM_ELEM (rt, n);
156 if (GATHER_STATISTICS)
158 rtvec_alloc_counts++;
159 rtvec_alloc_sizes += n * sizeof (rtx);
162 return rt;
165 /* Create a bitwise copy of VEC. */
167 rtvec
168 shallow_copy_rtvec (rtvec vec)
170 rtvec newvec;
171 int n;
173 n = GET_NUM_ELEM (vec);
174 newvec = rtvec_alloc (n);
175 memcpy (&newvec->elem[0], &vec->elem[0], sizeof (rtx) * n);
176 return newvec;
179 /* Return the number of bytes occupied by rtx value X. */
181 unsigned int
182 rtx_size (const_rtx x)
184 if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_HAS_BLOCK_INFO_P (x))
185 return RTX_HDR_SIZE + sizeof (struct block_symbol);
186 return RTX_CODE_SIZE (GET_CODE (x));
189 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
190 all the rest is initialized to zero. */
193 rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL)
195 rtx rt = ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code) PASS_MEM_STAT);
197 /* We want to clear everything up to the FLD array. Normally, this
198 is one int, but we don't want to assume that and it isn't very
199 portable anyway; this is. */
201 memset (rt, 0, RTX_HDR_SIZE);
202 PUT_CODE (rt, code);
204 if (GATHER_STATISTICS)
206 rtx_alloc_counts[code]++;
207 rtx_alloc_sizes[code] += RTX_CODE_SIZE (code);
210 return rt;
214 /* Return true if ORIG is a sharable CONST. */
216 bool
217 shared_const_p (const_rtx orig)
219 gcc_assert (GET_CODE (orig) == CONST);
221 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
222 a LABEL_REF, it isn't sharable. */
223 return (GET_CODE (XEXP (orig, 0)) == PLUS
224 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
225 && CONST_INT_P(XEXP (XEXP (orig, 0), 1)));
229 /* Create a new copy of an rtx.
230 Recursively copies the operands of the rtx,
231 except for those few rtx codes that are sharable. */
234 copy_rtx (rtx orig)
236 rtx copy;
237 int i, j;
238 RTX_CODE code;
239 const char *format_ptr;
241 code = GET_CODE (orig);
243 switch (code)
245 case REG:
246 case DEBUG_EXPR:
247 case VALUE:
248 CASE_CONST_ANY:
249 case SYMBOL_REF:
250 case CODE_LABEL:
251 case PC:
252 case CC0:
253 case RETURN:
254 case SIMPLE_RETURN:
255 case SCRATCH:
256 /* SCRATCH must be shared because they represent distinct values. */
257 return orig;
258 case CLOBBER:
259 /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
260 clobbers or clobbers of hard registers that originated as pseudos.
261 This is needed to allow safe register renaming. */
262 if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
263 && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0)))
264 return orig;
265 break;
267 case CONST:
268 if (shared_const_p (orig))
269 return orig;
270 break;
272 /* A MEM with a constant address is not sharable. The problem is that
273 the constant address may need to be reloaded. If the mem is shared,
274 then reloading one copy of this mem will cause all copies to appear
275 to have been reloaded. */
277 default:
278 break;
281 /* Copy the various flags, fields, and other information. We assume
282 that all fields need copying, and then clear the fields that should
283 not be copied. That is the sensible default behavior, and forces
284 us to explicitly document why we are *not* copying a flag. */
285 copy = shallow_copy_rtx (orig);
287 /* We do not copy the USED flag, which is used as a mark bit during
288 walks over the RTL. */
289 RTX_FLAG (copy, used) = 0;
291 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
293 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
294 switch (*format_ptr++)
296 case 'e':
297 if (XEXP (orig, i) != NULL)
298 XEXP (copy, i) = copy_rtx (XEXP (orig, i));
299 break;
301 case 'E':
302 case 'V':
303 if (XVEC (orig, i) != NULL)
305 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
306 for (j = 0; j < XVECLEN (copy, i); j++)
307 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
309 break;
311 case 't':
312 case 'w':
313 case 'i':
314 case 's':
315 case 'S':
316 case 'T':
317 case 'u':
318 case 'B':
319 case '0':
320 /* These are left unchanged. */
321 break;
323 default:
324 gcc_unreachable ();
326 return copy;
329 /* Create a new copy of an rtx. Only copy just one level. */
332 shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL)
334 const unsigned int size = rtx_size (orig);
335 rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT);
336 return (rtx) memcpy (copy, orig, size);
339 /* Nonzero when we are generating CONCATs. */
340 int generating_concat_p;
342 /* Nonzero when we are expanding trees to RTL. */
343 int currently_expanding_to_rtl;
347 /* Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL.
348 When the callback returns true, we continue with the new pair.
349 Whenever changing this function check if rtx_equal_p below doesn't need
350 changing as well. */
353 rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
355 int i;
356 int j;
357 enum rtx_code code;
358 const char *fmt;
359 rtx nx, ny;
361 if (x == y)
362 return 1;
363 if (x == 0 || y == 0)
364 return 0;
366 /* Invoke the callback first. */
367 if (cb != NULL
368 && ((*cb) (&x, &y, &nx, &ny)))
369 return rtx_equal_p_cb (nx, ny, cb);
371 code = GET_CODE (x);
372 /* Rtx's of different codes cannot be equal. */
373 if (code != GET_CODE (y))
374 return 0;
376 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
377 (REG:SI x) and (REG:HI x) are NOT equivalent. */
379 if (GET_MODE (x) != GET_MODE (y))
380 return 0;
382 /* MEMs referring to different address space are not equivalent. */
383 if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
384 return 0;
386 /* Some RTL can be compared nonrecursively. */
387 switch (code)
389 case REG:
390 return (REGNO (x) == REGNO (y));
392 case LABEL_REF:
393 return XEXP (x, 0) == XEXP (y, 0);
395 case SYMBOL_REF:
396 return XSTR (x, 0) == XSTR (y, 0);
398 case DEBUG_EXPR:
399 case VALUE:
400 case SCRATCH:
401 CASE_CONST_UNIQUE:
402 return 0;
404 case DEBUG_IMPLICIT_PTR:
405 return DEBUG_IMPLICIT_PTR_DECL (x)
406 == DEBUG_IMPLICIT_PTR_DECL (y);
408 case DEBUG_PARAMETER_REF:
409 return DEBUG_PARAMETER_REF_DECL (x)
410 == DEBUG_PARAMETER_REF_DECL (x);
412 case ENTRY_VALUE:
413 return rtx_equal_p_cb (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), cb);
415 default:
416 break;
419 /* Compare the elements. If any pair of corresponding elements
420 fail to match, return 0 for the whole thing. */
422 fmt = GET_RTX_FORMAT (code);
423 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
425 switch (fmt[i])
427 case 'w':
428 if (XWINT (x, i) != XWINT (y, i))
429 return 0;
430 break;
432 case 'n':
433 case 'i':
434 if (XINT (x, i) != XINT (y, i))
436 #ifndef GENERATOR_FILE
437 if (((code == ASM_OPERANDS && i == 6)
438 || (code == ASM_INPUT && i == 1))
439 && XINT (x, i) == XINT (y, i))
440 break;
441 #endif
442 return 0;
444 break;
446 case 'V':
447 case 'E':
448 /* Two vectors must have the same length. */
449 if (XVECLEN (x, i) != XVECLEN (y, i))
450 return 0;
452 /* And the corresponding elements must match. */
453 for (j = 0; j < XVECLEN (x, i); j++)
454 if (rtx_equal_p_cb (XVECEXP (x, i, j),
455 XVECEXP (y, i, j), cb) == 0)
456 return 0;
457 break;
459 case 'e':
460 if (rtx_equal_p_cb (XEXP (x, i), XEXP (y, i), cb) == 0)
461 return 0;
462 break;
464 case 'S':
465 case 's':
466 if ((XSTR (x, i) || XSTR (y, i))
467 && (! XSTR (x, i) || ! XSTR (y, i)
468 || strcmp (XSTR (x, i), XSTR (y, i))))
469 return 0;
470 break;
472 case 'u':
473 /* These are just backpointers, so they don't matter. */
474 break;
476 case '0':
477 case 't':
478 break;
480 /* It is believed that rtx's at this level will never
481 contain anything but integers and other rtx's,
482 except for within LABEL_REFs and SYMBOL_REFs. */
483 default:
484 gcc_unreachable ();
487 return 1;
490 /* Return 1 if X and Y are identical-looking rtx's.
491 This is the Lisp function EQUAL for rtx arguments.
492 Whenever changing this function check if rtx_equal_p_cb above doesn't need
493 changing as well. */
496 rtx_equal_p (const_rtx x, const_rtx y)
498 int i;
499 int j;
500 enum rtx_code code;
501 const char *fmt;
503 if (x == y)
504 return 1;
505 if (x == 0 || y == 0)
506 return 0;
508 code = GET_CODE (x);
509 /* Rtx's of different codes cannot be equal. */
510 if (code != GET_CODE (y))
511 return 0;
513 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
514 (REG:SI x) and (REG:HI x) are NOT equivalent. */
516 if (GET_MODE (x) != GET_MODE (y))
517 return 0;
519 /* MEMs referring to different address space are not equivalent. */
520 if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
521 return 0;
523 /* Some RTL can be compared nonrecursively. */
524 switch (code)
526 case REG:
527 return (REGNO (x) == REGNO (y));
529 case LABEL_REF:
530 return XEXP (x, 0) == XEXP (y, 0);
532 case SYMBOL_REF:
533 return XSTR (x, 0) == XSTR (y, 0);
535 case DEBUG_EXPR:
536 case VALUE:
537 case SCRATCH:
538 CASE_CONST_UNIQUE:
539 return 0;
541 case DEBUG_IMPLICIT_PTR:
542 return DEBUG_IMPLICIT_PTR_DECL (x)
543 == DEBUG_IMPLICIT_PTR_DECL (y);
545 case DEBUG_PARAMETER_REF:
546 return DEBUG_PARAMETER_REF_DECL (x)
547 == DEBUG_PARAMETER_REF_DECL (y);
549 case ENTRY_VALUE:
550 return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
552 default:
553 break;
556 /* Compare the elements. If any pair of corresponding elements
557 fail to match, return 0 for the whole thing. */
559 fmt = GET_RTX_FORMAT (code);
560 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
562 switch (fmt[i])
564 case 'w':
565 if (XWINT (x, i) != XWINT (y, i))
566 return 0;
567 break;
569 case 'n':
570 case 'i':
571 if (XINT (x, i) != XINT (y, i))
573 #ifndef GENERATOR_FILE
574 if (((code == ASM_OPERANDS && i == 6)
575 || (code == ASM_INPUT && i == 1))
576 && XINT (x, i) == XINT (y, i))
577 break;
578 #endif
579 return 0;
581 break;
583 case 'V':
584 case 'E':
585 /* Two vectors must have the same length. */
586 if (XVECLEN (x, i) != XVECLEN (y, i))
587 return 0;
589 /* And the corresponding elements must match. */
590 for (j = 0; j < XVECLEN (x, i); j++)
591 if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
592 return 0;
593 break;
595 case 'e':
596 if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
597 return 0;
598 break;
600 case 'S':
601 case 's':
602 if ((XSTR (x, i) || XSTR (y, i))
603 && (! XSTR (x, i) || ! XSTR (y, i)
604 || strcmp (XSTR (x, i), XSTR (y, i))))
605 return 0;
606 break;
608 case 'u':
609 /* These are just backpointers, so they don't matter. */
610 break;
612 case '0':
613 case 't':
614 break;
616 /* It is believed that rtx's at this level will never
617 contain anything but integers and other rtx's,
618 except for within LABEL_REFs and SYMBOL_REFs. */
619 default:
620 gcc_unreachable ();
623 return 1;
626 /* Iteratively hash rtx X. */
628 hashval_t
629 iterative_hash_rtx (const_rtx x, hashval_t hash)
631 enum rtx_code code;
632 enum machine_mode mode;
633 int i, j;
634 const char *fmt;
636 if (x == NULL_RTX)
637 return hash;
638 code = GET_CODE (x);
639 hash = iterative_hash_object (code, hash);
640 mode = GET_MODE (x);
641 hash = iterative_hash_object (mode, hash);
642 switch (code)
644 case REG:
645 i = REGNO (x);
646 return iterative_hash_object (i, hash);
647 case CONST_INT:
648 return iterative_hash_object (INTVAL (x), hash);
649 case SYMBOL_REF:
650 if (XSTR (x, 0))
651 return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
652 hash);
653 return hash;
654 case LABEL_REF:
655 case DEBUG_EXPR:
656 case VALUE:
657 case SCRATCH:
658 case CONST_DOUBLE:
659 case CONST_FIXED:
660 case DEBUG_IMPLICIT_PTR:
661 case DEBUG_PARAMETER_REF:
662 return hash;
663 default:
664 break;
667 fmt = GET_RTX_FORMAT (code);
668 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
669 switch (fmt[i])
671 case 'w':
672 hash = iterative_hash_object (XWINT (x, i), hash);
673 break;
674 case 'n':
675 case 'i':
676 hash = iterative_hash_object (XINT (x, i), hash);
677 break;
678 case 'V':
679 case 'E':
680 j = XVECLEN (x, i);
681 hash = iterative_hash_object (j, hash);
682 for (j = 0; j < XVECLEN (x, i); j++)
683 hash = iterative_hash_rtx (XVECEXP (x, i, j), hash);
684 break;
685 case 'e':
686 hash = iterative_hash_rtx (XEXP (x, i), hash);
687 break;
688 case 'S':
689 case 's':
690 if (XSTR (x, i))
691 hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
692 hash);
693 break;
694 default:
695 break;
697 return hash;
700 void
701 dump_rtx_statistics (void)
703 int i;
704 int total_counts = 0;
705 int total_sizes = 0;
707 if (! GATHER_STATISTICS)
709 fprintf (stderr, "No RTX statistics\n");
710 return;
713 fprintf (stderr, "\nRTX Kind Count Bytes\n");
714 fprintf (stderr, "---------------------------------------\n");
715 for (i = 0; i < LAST_AND_UNUSED_RTX_CODE; i++)
716 if (rtx_alloc_counts[i])
718 fprintf (stderr, "%-20s %7d %10d\n", GET_RTX_NAME (i),
719 rtx_alloc_counts[i], rtx_alloc_sizes[i]);
720 total_counts += rtx_alloc_counts[i];
721 total_sizes += rtx_alloc_sizes[i];
723 if (rtvec_alloc_counts)
725 fprintf (stderr, "%-20s %7d %10d\n", "rtvec",
726 rtvec_alloc_counts, rtvec_alloc_sizes);
727 total_counts += rtvec_alloc_counts;
728 total_sizes += rtvec_alloc_sizes;
730 fprintf (stderr, "---------------------------------------\n");
731 fprintf (stderr, "%-20s %7d %10d\n",
732 "Total", total_counts, total_sizes);
733 fprintf (stderr, "---------------------------------------\n");
736 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
737 void
738 rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line,
739 const char *func)
741 internal_error
742 ("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d",
743 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r)) - 1,
744 func, trim_filename (file), line);
747 void
748 rtl_check_failed_type1 (const_rtx r, int n, int c1, const char *file, int line,
749 const char *func)
751 internal_error
752 ("RTL check: expected elt %d type '%c', have '%c' (rtx %s) in %s, at %s:%d",
753 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)),
754 func, trim_filename (file), line);
757 void
758 rtl_check_failed_type2 (const_rtx r, int n, int c1, int c2, const char *file,
759 int line, const char *func)
761 internal_error
762 ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s) in %s, at %s:%d",
763 n, c1, c2, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)),
764 func, trim_filename (file), line);
767 void
768 rtl_check_failed_code1 (const_rtx r, enum rtx_code code, const char *file,
769 int line, const char *func)
771 internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d",
772 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)), func,
773 trim_filename (file), line);
776 void
777 rtl_check_failed_code2 (const_rtx r, enum rtx_code code1, enum rtx_code code2,
778 const char *file, int line, const char *func)
780 internal_error
781 ("RTL check: expected code '%s' or '%s', have '%s' in %s, at %s:%d",
782 GET_RTX_NAME (code1), GET_RTX_NAME (code2), GET_RTX_NAME (GET_CODE (r)),
783 func, trim_filename (file), line);
786 void
787 rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, enum machine_mode mode,
788 bool not_mode, const char *file, int line,
789 const char *func)
791 internal_error ((not_mode
792 ? ("RTL check: expected code '%s' and not mode '%s', "
793 "have code '%s' and mode '%s' in %s, at %s:%d")
794 : ("RTL check: expected code '%s' and mode '%s', "
795 "have code '%s' and mode '%s' in %s, at %s:%d")),
796 GET_RTX_NAME (code), GET_MODE_NAME (mode),
797 GET_RTX_NAME (GET_CODE (r)), GET_MODE_NAME (GET_MODE (r)),
798 func, trim_filename (file), line);
801 /* Report that line LINE of FILE tried to access the block symbol fields
802 of a non-block symbol. FUNC is the function that contains the line. */
804 void
805 rtl_check_failed_block_symbol (const char *file, int line, const char *func)
807 internal_error
808 ("RTL check: attempt to treat non-block symbol as a block symbol "
809 "in %s, at %s:%d", func, trim_filename (file), line);
812 /* XXX Maybe print the vector? */
813 void
814 rtvec_check_failed_bounds (const_rtvec r, int n, const char *file, int line,
815 const char *func)
817 internal_error
818 ("RTL check: access of elt %d of vector with last elt %d in %s, at %s:%d",
819 n, GET_NUM_ELEM (r) - 1, func, trim_filename (file), line);
821 #endif /* ENABLE_RTL_CHECKING */
823 #if defined ENABLE_RTL_FLAG_CHECKING
824 void
825 rtl_check_failed_flag (const char *name, const_rtx r, const char *file,
826 int line, const char *func)
828 internal_error
829 ("RTL flag check: %s used with unexpected rtx code '%s' in %s, at %s:%d",
830 name, GET_RTX_NAME (GET_CODE (r)), func, trim_filename (file), line);
832 #endif /* ENABLE_RTL_FLAG_CHECKING */