1 /* RTL utility routines.
2 Copyright (C) 1987-2020 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
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
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. */
29 #include "coretypes.h"
36 # include "diagnostic-core.h"
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
] = {
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 */
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
] = {
67 can cause a warning message
68 "0" field is unused (or used in a phase-dependent manner)
72 "n" like "i", but prints entries from `note_insn_name'
73 "w" an integer of width HOST_BITS_PER_WIDE_INT
75 "s" a pointer to a 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
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 "p" is a poly_uint16 offset. */
95 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
96 #include "rtl.def" /* rtl expressions are defined here */
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. */
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 */
109 /* Whether rtxs with the given code store data in the hwint field. */
111 #define RTX_CODE_HWINT_P_1(ENUM) \
112 ((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \
113 || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT)
114 #ifdef GENERATOR_FILE
115 #define RTX_CODE_HWINT_P(ENUM) \
116 (RTX_CODE_HWINT_P_1 (ENUM) || (ENUM) == EQ_ATTR_ALT)
118 #define RTX_CODE_HWINT_P RTX_CODE_HWINT_P_1
121 /* Indexed by rtx code, gives the size of the rtx in bytes. */
123 const unsigned char rtx_code_size
[NUM_RTX_CODE
] = {
124 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \
125 (RTX_CODE_HWINT_P (ENUM) \
126 ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \
128 ? RTX_HDR_SIZE + sizeof (reg_info) \
129 : RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)),
135 /* Names for kinds of NOTEs and REG_NOTEs. */
137 const char * const note_insn_name
[NOTE_INSN_MAX
] =
139 #define DEF_INSN_NOTE(NAME) #NAME,
140 #include "insn-notes.def"
144 const char * const reg_note_name
[REG_NOTE_MAX
] =
146 #define DEF_REG_NOTE(NAME) #NAME,
147 #include "reg-notes.def"
151 static size_t rtx_alloc_counts
[(int) LAST_AND_UNUSED_RTX_CODE
];
152 static size_t rtx_alloc_sizes
[(int) LAST_AND_UNUSED_RTX_CODE
];
153 static size_t rtvec_alloc_counts
;
154 static size_t rtvec_alloc_sizes
;
157 /* Allocate an rtx vector of N elements.
158 Store the length, and initialize all elements to zero. */
165 rt
= ggc_alloc_rtvec_sized (n
);
166 /* Clear out the vector. */
167 memset (&rt
->elem
[0], 0, n
* sizeof (rtx
));
169 PUT_NUM_ELEM (rt
, n
);
171 if (GATHER_STATISTICS
)
173 rtvec_alloc_counts
++;
174 rtvec_alloc_sizes
+= n
* sizeof (rtx
);
180 /* Create a bitwise copy of VEC. */
183 shallow_copy_rtvec (rtvec vec
)
188 n
= GET_NUM_ELEM (vec
);
189 newvec
= rtvec_alloc (n
);
190 memcpy (&newvec
->elem
[0], &vec
->elem
[0], sizeof (rtx
) * n
);
194 /* Return the number of bytes occupied by rtx value X. */
197 rtx_size (const_rtx x
)
199 if (CONST_WIDE_INT_P (x
))
201 + sizeof (struct hwivec_def
)
202 + ((CONST_WIDE_INT_NUNITS (x
) - 1)
203 * sizeof (HOST_WIDE_INT
)));
204 if (CONST_POLY_INT_P (x
))
206 + sizeof (struct const_poly_int_def
)
207 + CONST_POLY_INT_COEFFS (x
).extra_size ());
208 if (GET_CODE (x
) == SYMBOL_REF
&& SYMBOL_REF_HAS_BLOCK_INFO_P (x
))
209 return RTX_HDR_SIZE
+ sizeof (struct block_symbol
);
210 return RTX_CODE_SIZE (GET_CODE (x
));
213 /* Allocate an rtx of code CODE with EXTRA bytes in it. The CODE is
214 stored in the rtx; all the rest is initialized to zero. */
217 rtx_alloc_stat_v (RTX_CODE code MEM_STAT_DECL
, int extra
)
219 rtx rt
= ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code
) + extra
224 if (GATHER_STATISTICS
)
226 rtx_alloc_counts
[code
]++;
227 rtx_alloc_sizes
[code
] += RTX_CODE_SIZE (code
);
233 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
234 all the rest is initialized to zero. */
237 rtx_alloc (RTX_CODE code MEM_STAT_DECL
)
239 return rtx_alloc_stat_v (code PASS_MEM_STAT
, 0);
242 /* Write the wide constant X to OUTFILE. */
245 cwi_output_hex (FILE *outfile
, const_rtx x
)
247 int i
= CWI_GET_NUM_ELEM (x
);
249 if (CWI_ELT (x
, i
- 1) == 0)
250 /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is
251 non zero. We want all numbers to have a 0x prefix. */
252 fprintf (outfile
, "0x");
253 fprintf (outfile
, HOST_WIDE_INT_PRINT_HEX
, CWI_ELT (x
, --i
));
255 fprintf (outfile
, HOST_WIDE_INT_PRINT_PADDED_HEX
, CWI_ELT (x
, i
));
259 /* Return true if ORIG is a sharable CONST. */
262 shared_const_p (const_rtx orig
)
264 gcc_assert (GET_CODE (orig
) == CONST
);
266 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
267 a LABEL_REF, it isn't sharable. */
269 return (GET_CODE (XEXP (orig
, 0)) == PLUS
270 && GET_CODE (XEXP (XEXP (orig
, 0), 0)) == SYMBOL_REF
271 && poly_int_rtx_p (XEXP (XEXP (orig
, 0), 1), &offset
));
275 /* Create a new copy of an rtx.
276 Recursively copies the operands of the rtx,
277 except for those few rtx codes that are sharable. */
285 const char *format_ptr
;
287 code
= GET_CODE (orig
);
302 /* SCRATCH must be shared because they represent distinct values. */
305 /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
306 clobbers or clobbers of hard registers that originated as pseudos.
307 This is needed to allow safe register renaming. */
308 if (REG_P (XEXP (orig
, 0)) && REGNO (XEXP (orig
, 0)) < FIRST_PSEUDO_REGISTER
309 && ORIGINAL_REGNO (XEXP (orig
, 0)) == REGNO (XEXP (orig
, 0)))
314 if (shared_const_p (orig
))
318 /* A MEM with a constant address is not sharable. The problem is that
319 the constant address may need to be reloaded. If the mem is shared,
320 then reloading one copy of this mem will cause all copies to appear
321 to have been reloaded. */
327 /* Copy the various flags, fields, and other information. We assume
328 that all fields need copying, and then clear the fields that should
329 not be copied. That is the sensible default behavior, and forces
330 us to explicitly document why we are *not* copying a flag. */
331 copy
= shallow_copy_rtx (orig
);
333 format_ptr
= GET_RTX_FORMAT (GET_CODE (copy
));
335 for (i
= 0; i
< GET_RTX_LENGTH (GET_CODE (copy
)); i
++)
336 switch (*format_ptr
++)
339 if (XEXP (orig
, i
) != NULL
)
340 XEXP (copy
, i
) = copy_rtx (XEXP (orig
, i
));
345 if (XVEC (orig
, i
) != NULL
)
347 XVEC (copy
, i
) = rtvec_alloc (XVECLEN (orig
, i
));
348 for (j
= 0; j
< XVECLEN (copy
, i
); j
++)
349 XVECEXP (copy
, i
, j
) = copy_rtx (XVECEXP (orig
, i
, j
));
363 /* These are left unchanged. */
372 /* Create a new copy of an rtx. Only copy just one level. */
375 shallow_copy_rtx (const_rtx orig MEM_STAT_DECL
)
377 const unsigned int size
= rtx_size (orig
);
378 rtx
const copy
= ggc_alloc_rtx_def_stat (size PASS_MEM_STAT
);
379 memcpy (copy
, orig
, size
);
380 switch (GET_CODE (orig
))
382 /* RTX codes copy_rtx_if_shared_1 considers are shareable,
383 the used flag is often used for other purposes. */
397 /* For all other RTXes clear the used flag on the copy. */
398 RTX_FLAG (copy
, used
) = 0;
404 /* Nonzero when we are generating CONCATs. */
405 int generating_concat_p
;
407 /* Nonzero when we are expanding trees to RTL. */
408 int currently_expanding_to_rtl
;
412 /* Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL.
413 When the callback returns true, we continue with the new pair.
414 Whenever changing this function check if rtx_equal_p below doesn't need
418 rtx_equal_p_cb (const_rtx x
, const_rtx y
, rtx_equal_p_callback_function cb
)
428 if (x
== 0 || y
== 0)
431 /* Invoke the callback first. */
433 && ((*cb
) (&x
, &y
, &nx
, &ny
)))
434 return rtx_equal_p_cb (nx
, ny
, cb
);
437 /* Rtx's of different codes cannot be equal. */
438 if (code
!= GET_CODE (y
))
441 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
442 (REG:SI x) and (REG:HI x) are NOT equivalent. */
444 if (GET_MODE (x
) != GET_MODE (y
))
447 /* MEMs referring to different address space are not equivalent. */
448 if (code
== MEM
&& MEM_ADDR_SPACE (x
) != MEM_ADDR_SPACE (y
))
451 /* Some RTL can be compared nonrecursively. */
455 return (REGNO (x
) == REGNO (y
));
458 return label_ref_label (x
) == label_ref_label (y
);
461 return XSTR (x
, 0) == XSTR (y
, 0);
469 case DEBUG_IMPLICIT_PTR
:
470 return DEBUG_IMPLICIT_PTR_DECL (x
)
471 == DEBUG_IMPLICIT_PTR_DECL (y
);
473 case DEBUG_PARAMETER_REF
:
474 return DEBUG_PARAMETER_REF_DECL (x
)
475 == DEBUG_PARAMETER_REF_DECL (y
);
478 return rtx_equal_p_cb (ENTRY_VALUE_EXP (x
), ENTRY_VALUE_EXP (y
), cb
);
484 /* Compare the elements. If any pair of corresponding elements
485 fail to match, return 0 for the whole thing. */
487 fmt
= GET_RTX_FORMAT (code
);
488 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
493 if (XWINT (x
, i
) != XWINT (y
, i
))
499 if (XINT (x
, i
) != XINT (y
, i
))
501 #ifndef GENERATOR_FILE
502 if (((code
== ASM_OPERANDS
&& i
== 6)
503 || (code
== ASM_INPUT
&& i
== 1))
504 && XINT (x
, i
) == XINT (y
, i
))
512 if (maybe_ne (SUBREG_BYTE (x
), SUBREG_BYTE (y
)))
518 /* Two vectors must have the same length. */
519 if (XVECLEN (x
, i
) != XVECLEN (y
, i
))
522 /* And the corresponding elements must match. */
523 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
524 if (rtx_equal_p_cb (XVECEXP (x
, i
, j
),
525 XVECEXP (y
, i
, j
), cb
) == 0)
530 if (rtx_equal_p_cb (XEXP (x
, i
), XEXP (y
, i
), cb
) == 0)
536 if ((XSTR (x
, i
) || XSTR (y
, i
))
537 && (! XSTR (x
, i
) || ! XSTR (y
, i
)
538 || strcmp (XSTR (x
, i
), XSTR (y
, i
))))
543 /* These are just backpointers, so they don't matter. */
550 /* It is believed that rtx's at this level will never
551 contain anything but integers and other rtx's,
552 except for within LABEL_REFs and SYMBOL_REFs. */
560 /* Return 1 if X and Y are identical-looking rtx's.
561 This is the Lisp function EQUAL for rtx arguments.
562 Whenever changing this function check if rtx_equal_p_cb above doesn't need
566 rtx_equal_p (const_rtx x
, const_rtx y
)
575 if (x
== 0 || y
== 0)
579 /* Rtx's of different codes cannot be equal. */
580 if (code
!= GET_CODE (y
))
583 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
584 (REG:SI x) and (REG:HI x) are NOT equivalent. */
586 if (GET_MODE (x
) != GET_MODE (y
))
589 /* MEMs referring to different address space are not equivalent. */
590 if (code
== MEM
&& MEM_ADDR_SPACE (x
) != MEM_ADDR_SPACE (y
))
593 /* Some RTL can be compared nonrecursively. */
597 return (REGNO (x
) == REGNO (y
));
600 return label_ref_label (x
) == label_ref_label (y
);
603 return XSTR (x
, 0) == XSTR (y
, 0);
611 case DEBUG_IMPLICIT_PTR
:
612 return DEBUG_IMPLICIT_PTR_DECL (x
)
613 == DEBUG_IMPLICIT_PTR_DECL (y
);
615 case DEBUG_PARAMETER_REF
:
616 return DEBUG_PARAMETER_REF_DECL (x
)
617 == DEBUG_PARAMETER_REF_DECL (y
);
620 return rtx_equal_p (ENTRY_VALUE_EXP (x
), ENTRY_VALUE_EXP (y
));
626 /* Compare the elements. If any pair of corresponding elements
627 fail to match, return 0 for the whole thing. */
629 fmt
= GET_RTX_FORMAT (code
);
630 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
635 if (XWINT (x
, i
) != XWINT (y
, i
))
641 if (XINT (x
, i
) != XINT (y
, i
))
643 #ifndef GENERATOR_FILE
644 if (((code
== ASM_OPERANDS
&& i
== 6)
645 || (code
== ASM_INPUT
&& i
== 1))
646 && XINT (x
, i
) == XINT (y
, i
))
654 if (maybe_ne (SUBREG_BYTE (x
), SUBREG_BYTE (y
)))
660 /* Two vectors must have the same length. */
661 if (XVECLEN (x
, i
) != XVECLEN (y
, i
))
664 /* And the corresponding elements must match. */
665 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
666 if (rtx_equal_p (XVECEXP (x
, i
, j
), XVECEXP (y
, i
, j
)) == 0)
671 if (rtx_equal_p (XEXP (x
, i
), XEXP (y
, i
)) == 0)
677 if ((XSTR (x
, i
) || XSTR (y
, i
))
678 && (! XSTR (x
, i
) || ! XSTR (y
, i
)
679 || strcmp (XSTR (x
, i
), XSTR (y
, i
))))
684 /* These are just backpointers, so they don't matter. */
691 /* It is believed that rtx's at this level will never
692 contain anything but integers and other rtx's,
693 except for within LABEL_REFs and SYMBOL_REFs. */
701 /* Return true if all elements of VEC are equal. */
704 rtvec_all_equal_p (const_rtvec vec
)
706 const_rtx first
= RTVEC_ELT (vec
, 0);
707 /* Optimize the important special case of a vector of constants.
708 The main use of this function is to detect whether every element
709 of CONST_VECTOR is the same. */
710 switch (GET_CODE (first
))
713 for (int i
= 1, n
= GET_NUM_ELEM (vec
); i
< n
; ++i
)
714 if (first
!= RTVEC_ELT (vec
, i
))
719 for (int i
= 1, n
= GET_NUM_ELEM (vec
); i
< n
; ++i
)
720 if (!rtx_equal_p (first
, RTVEC_ELT (vec
, i
)))
726 /* Return an indication of which type of insn should have X as a body.
727 In generator files, this can be UNKNOWN if the answer is only known
728 at (GCC) runtime. Otherwise the value is CODE_LABEL, INSN, CALL_INSN
732 classify_insn (rtx x
)
736 if (GET_CODE (x
) == CALL
)
738 if (ANY_RETURN_P (x
))
740 if (GET_CODE (x
) == ASM_OPERANDS
&& ASM_OPERANDS_LABEL_VEC (x
))
742 if (GET_CODE (x
) == SET
)
744 if (GET_CODE (SET_DEST (x
)) == PC
)
746 else if (GET_CODE (SET_SRC (x
)) == CALL
)
751 if (GET_CODE (x
) == PARALLEL
)
754 bool has_return_p
= false;
755 for (j
= XVECLEN (x
, 0) - 1; j
>= 0; j
--)
756 if (GET_CODE (XVECEXP (x
, 0, j
)) == CALL
)
758 else if (ANY_RETURN_P (XVECEXP (x
, 0, j
)))
760 else if (GET_CODE (XVECEXP (x
, 0, j
)) == SET
761 && GET_CODE (SET_DEST (XVECEXP (x
, 0, j
))) == PC
)
763 else if (GET_CODE (XVECEXP (x
, 0, j
)) == SET
764 && GET_CODE (SET_SRC (XVECEXP (x
, 0, j
))) == CALL
)
768 if (GET_CODE (XVECEXP (x
, 0, 0)) == ASM_OPERANDS
769 && ASM_OPERANDS_LABEL_VEC (XVECEXP (x
, 0, 0)))
772 #ifdef GENERATOR_FILE
773 if (GET_CODE (x
) == MATCH_OPERAND
774 || GET_CODE (x
) == MATCH_OPERATOR
775 || GET_CODE (x
) == MATCH_PARALLEL
776 || GET_CODE (x
) == MATCH_OP_DUP
777 || GET_CODE (x
) == MATCH_DUP
778 || GET_CODE (x
) == PARALLEL
)
784 /* Comparator of indices based on rtx_alloc_counts. */
787 rtx_count_cmp (const void *p1
, const void *p2
)
789 const unsigned *n1
= (const unsigned *)p1
;
790 const unsigned *n2
= (const unsigned *)p2
;
792 return rtx_alloc_counts
[*n1
] - rtx_alloc_counts
[*n2
];
796 dump_rtx_statistics (void)
798 int total_counts
= 0;
801 if (! GATHER_STATISTICS
)
803 fprintf (stderr
, "No RTX statistics\n");
807 fprintf (stderr
, "\nRTX Kind Count Bytes\n");
808 fprintf (stderr
, "-------------------------------------------\n");
810 auto_vec
<unsigned> indices (LAST_AND_UNUSED_RTX_CODE
);
811 for (unsigned i
= 0; i
< LAST_AND_UNUSED_RTX_CODE
; i
++)
812 indices
.quick_push (i
);
813 indices
.qsort (rtx_count_cmp
);
815 for (unsigned i
= 0; i
< LAST_AND_UNUSED_RTX_CODE
; i
++)
817 unsigned j
= indices
[i
];
818 if (rtx_alloc_counts
[j
])
820 fprintf (stderr
, "%-24s " PRsa (6) " " PRsa (9) "\n",
822 SIZE_AMOUNT (rtx_alloc_counts
[j
]),
823 SIZE_AMOUNT (rtx_alloc_sizes
[j
]));
824 total_counts
+= rtx_alloc_counts
[j
];
825 total_sizes
+= rtx_alloc_sizes
[j
];
829 if (rtvec_alloc_counts
)
831 fprintf (stderr
, "%-24s " PRsa (6) " " PRsa (9) "\n", "rtvec",
832 SIZE_AMOUNT (rtvec_alloc_counts
),
833 SIZE_AMOUNT (rtvec_alloc_sizes
));
834 total_counts
+= rtvec_alloc_counts
;
835 total_sizes
+= rtvec_alloc_sizes
;
837 fprintf (stderr
, "-----------------------------------------------\n");
838 fprintf (stderr
, "%-24s " PRsa (6) " " PRsa (9) "\n",
839 "Total", SIZE_AMOUNT (total_counts
),
840 SIZE_AMOUNT (total_sizes
));
841 fprintf (stderr
, "-----------------------------------------------\n");
844 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
846 rtl_check_failed_bounds (const_rtx r
, int n
, const char *file
, int line
,
850 ("RTL check: access of elt %d of '%s' with last elt %d in %s, at %s:%d",
851 n
, GET_RTX_NAME (GET_CODE (r
)), GET_RTX_LENGTH (GET_CODE (r
)) - 1,
852 func
, trim_filename (file
), line
);
856 rtl_check_failed_type1 (const_rtx r
, int n
, int c1
, const char *file
, int line
,
860 ("RTL check: expected elt %d type '%c', have '%c' (rtx %s) in %s, at %s:%d",
861 n
, c1
, GET_RTX_FORMAT (GET_CODE (r
))[n
], GET_RTX_NAME (GET_CODE (r
)),
862 func
, trim_filename (file
), line
);
866 rtl_check_failed_type2 (const_rtx r
, int n
, int c1
, int c2
, const char *file
,
867 int line
, const char *func
)
870 ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s) in %s, at %s:%d",
871 n
, c1
, c2
, GET_RTX_FORMAT (GET_CODE (r
))[n
], GET_RTX_NAME (GET_CODE (r
)),
872 func
, trim_filename (file
), line
);
876 rtl_check_failed_code1 (const_rtx r
, enum rtx_code code
, const char *file
,
877 int line
, const char *func
)
879 internal_error ("RTL check: expected code '%s', have '%s' in %s, at %s:%d",
880 GET_RTX_NAME (code
), GET_RTX_NAME (GET_CODE (r
)), func
,
881 trim_filename (file
), line
);
885 rtl_check_failed_code2 (const_rtx r
, enum rtx_code code1
, enum rtx_code code2
,
886 const char *file
, int line
, const char *func
)
889 ("RTL check: expected code '%s' or '%s', have '%s' in %s, at %s:%d",
890 GET_RTX_NAME (code1
), GET_RTX_NAME (code2
), GET_RTX_NAME (GET_CODE (r
)),
891 func
, trim_filename (file
), line
);
895 rtl_check_failed_code3 (const_rtx r
, enum rtx_code code1
, enum rtx_code code2
,
896 enum rtx_code code3
, const char *file
, int line
,
900 ("RTL check: expected code '%s', '%s' or '%s', have '%s' in %s, at %s:%d",
901 GET_RTX_NAME (code1
), GET_RTX_NAME (code2
), GET_RTX_NAME (code3
),
902 GET_RTX_NAME (GET_CODE (r
)), func
, trim_filename (file
), line
);
906 rtl_check_failed_code_mode (const_rtx r
, enum rtx_code code
, machine_mode mode
,
907 bool not_mode
, const char *file
, int line
,
910 internal_error ((not_mode
911 ? ("RTL check: expected code '%s' and not mode '%s', "
912 "have code '%s' and mode '%s' in %s, at %s:%d")
913 : ("RTL check: expected code '%s' and mode '%s', "
914 "have code '%s' and mode '%s' in %s, at %s:%d")),
915 GET_RTX_NAME (code
), GET_MODE_NAME (mode
),
916 GET_RTX_NAME (GET_CODE (r
)), GET_MODE_NAME (GET_MODE (r
)),
917 func
, trim_filename (file
), line
);
920 /* Report that line LINE of FILE tried to access the block symbol fields
921 of a non-block symbol. FUNC is the function that contains the line. */
924 rtl_check_failed_block_symbol (const char *file
, int line
, const char *func
)
927 ("RTL check: attempt to treat non-block symbol as a block symbol "
928 "in %s, at %s:%d", func
, trim_filename (file
), line
);
931 /* XXX Maybe print the vector? */
933 cwi_check_failed_bounds (const_rtx x
, int n
, const char *file
, int line
,
937 ("RTL check: access of hwi elt %d of vector with last elt %d in %s, at %s:%d",
938 n
, CWI_GET_NUM_ELEM (x
) - 1, func
, trim_filename (file
), line
);
941 /* XXX Maybe print the vector? */
943 rtvec_check_failed_bounds (const_rtvec r
, int n
, const char *file
, int line
,
947 ("RTL check: access of elt %d of vector with last elt %d in %s, at %s:%d",
948 n
, GET_NUM_ELEM (r
) - 1, func
, trim_filename (file
), line
);
950 #endif /* ENABLE_RTL_CHECKING */
952 #if defined ENABLE_RTL_FLAG_CHECKING
954 rtl_check_failed_flag (const char *name
, const_rtx r
, const char *file
,
955 int line
, const char *func
)
958 ("RTL flag check: %s used with unexpected rtx code '%s' in %s, at %s:%d",
959 name
, GET_RTX_NAME (GET_CODE (r
)), func
, trim_filename (file
), line
);
961 #endif /* ENABLE_RTL_FLAG_CHECKING */