1 /* Allocate and read RTL for GNU C Compiler.
2 Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
30 #define obstack_chunk_alloc xmalloc
31 #define obstack_chunk_free free
34 #define DIR_SEPARATOR '/'
37 /* Obstack used for allocating RTL objects.
38 Between functions, this is the permanent_obstack.
39 While parsing and expanding a function, this is maybepermanent_obstack
40 so we can save it if it is an inline function.
41 During optimization and output, this is function_obstack. */
43 extern struct obstack *rtl_obstack;
45 /* Calculate the format for CONST_DOUBLE. This depends on the relative
46 widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
48 We need to go out to e0wwwww, since REAL_ARITHMETIC assumes 16-bits
49 per element in REAL_VALUE_TYPE.
51 This is duplicated in gengenrtl.c.
53 A number of places assume that there are always at least two 'w'
54 slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
56 #ifdef REAL_ARITHMETIC
57 #if LONG_DOUBLE_TYPE_SIZE == 96
58 #define REAL_WIDTH (11*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
59 #elif LONG_DOUBLE_TYPE_SIZE == 128
60 #define REAL_WIDTH (19*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
61 #elif HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
62 #define REAL_WIDTH (7*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
64 #endif /* REAL_ARITHMETIC */
67 #if HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE
69 #elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE
71 #elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE
74 #endif /* REAL_WIDTH */
77 #define CONST_DOUBLE_FORMAT "e0ww"
79 #define CONST_DOUBLE_FORMAT "e0ww"
81 #define CONST_DOUBLE_FORMAT "e0www"
83 #define CONST_DOUBLE_FORMAT "e0wwww"
85 #define CONST_DOUBLE_FORMAT "e0wwwww"
87 #define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
90 /* Indexed by rtx code, gives number of operands for an rtx with that code.
91 Does NOT include rtx header data (code and links). */
93 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
95 const int rtx_length[NUM_RTX_CODE + 1] = {
101 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
103 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
105 const char * const rtx_name[] = {
106 #include "rtl.def" /* rtl expressions are documented here */
111 /* Indexed by machine mode, gives the name of that machine mode.
112 This name does not include the letters "mode". */
114 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) NAME,
116 const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
117 #include "machmode.def"
118 /* Add an extra field to avoid a core dump if someone tries to convert
119 MAX_MACHINE_MODE to a string. */
125 /* Indexed by machine mode, gives the length of the mode, in bytes.
126 GET_MODE_CLASS uses this. */
128 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS,
130 const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
131 #include "machmode.def"
136 /* Indexed by machine mode, gives the length of the mode, in bytes.
137 GET_MODE_SIZE uses this. */
139 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE,
141 const int mode_size[(int) MAX_MACHINE_MODE] = {
142 #include "machmode.def"
147 /* Indexed by machine mode, gives the length of the mode's subunit.
148 GET_MODE_UNIT_SIZE uses this. */
150 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT,
152 const int mode_unit_size[(int) MAX_MACHINE_MODE] = {
153 #include "machmode.def" /* machine modes are documented here */
158 /* Indexed by machine mode, gives next wider natural mode
159 (QI -> HI -> SI -> DI, etc.) Widening multiply instructions
162 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
163 (unsigned char) WIDER,
165 const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
166 #include "machmode.def" /* machine modes are documented here */
171 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
172 ((SIZE) * BITS_PER_UNIT >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (SIZE) * BITS_PER_UNIT) - 1,
174 /* Indexed by machine mode, gives mask of significant bits in mode. */
176 const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
177 #include "machmode.def"
180 /* Indexed by mode class, gives the narrowest mode for each class.
181 The Q modes are always of width 1 (2 for complex) - it is impossible
182 for any mode to be narrower. */
184 const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = {
185 /* MODE_RANDOM */ VOIDmode,
186 /* MODE_INT */ QImode,
187 /* MODE_FLOAT */ QFmode,
188 /* MODE_PARTIAL_INT */ PQImode,
189 /* MODE_CC */ CCmode,
190 /* MODE_COMPLEX_INT */ CQImode,
191 /* MODE_COMPLEX_FLOAT */ QCmode
195 /* Indexed by rtx code, gives a sequence of operand-types for
196 rtx's of that code. The sequence is a C string in which
197 each character describes one operand. */
199 const char * const rtx_format[] = {
201 can cause a warning message
202 "0" field is unused (or used in a phase-dependent manner)
206 "n" like "i", but prints entries from `note_insn_name'
207 "w" an integer of width HOST_BITS_PER_WIDE_INT
209 "s" a pointer to a string
211 "S" like "s", but optional:
212 the containing rtx may end before this operand
213 "e" a pointer to an rtl expression
214 prints the expression
215 "E" a pointer to a vector that points to a number of rtl expressions
216 prints a list of the rtl expressions
217 "V" like "E", but optional:
218 the containing rtx may end before this operand
219 "u" a pointer to another insn
220 prints the uid of the insn.
221 "b" is a pointer to a bitmap header.
222 "t" is a tree pointer. */
224 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
225 #include "rtl.def" /* rtl expressions are defined here */
229 /* Indexed by rtx code, gives a character representing the "class" of
230 that rtx code. See rtl.def for documentation on the defined classes. */
232 const char rtx_class[] = {
233 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
234 #include "rtl.def" /* rtl expressions are defined here */
238 /* Names for kinds of NOTEs and REG_NOTEs. */
240 const char * const note_insn_name[] = { 0 , "NOTE_INSN_DELETED",
241 "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
242 "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
243 "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
244 "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
245 "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
246 "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
247 "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
248 "NOTE_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_START",
249 "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE",
250 "NOTE_INSN_BASIC_BLOCK" };
252 const char * const reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0",
253 "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL",
254 "REG_NONNEG", "REG_NO_CONFLICT", "REG_UNUSED",
255 "REG_CC_SETTER", "REG_CC_USER", "REG_LABEL",
256 "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
257 "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA",
258 "REG_BR_PRED", "REG_EH_CONTEXT",
259 "REG_FRAME_RELATED_EXPR", "REG_EH_REGION",
262 static void dump_and_abort PROTO((int, int, FILE *)) ATTRIBUTE_NORETURN;
263 static void read_name PROTO((char *, FILE *));
264 static const char *trim_filename PROTO((const char *));
266 /* Allocate an rtx vector of N elements.
267 Store the length, and initialize all elements to zero. */
276 rt = ggc_alloc_rtvec (n);
281 rt = (rtvec) obstack_alloc (rtl_obstack,
282 sizeof (struct rtvec_def)
283 + (( n - 1) * sizeof (rtx)));
285 /* clear out the vector */
286 for (i = 0; i < n; i++)
290 PUT_NUM_ELEM (rt, n);
294 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
295 all the rest is initialized to zero. */
304 rt = ggc_alloc_rtx (GET_RTX_LENGTH (code));
307 register struct obstack *ob = rtl_obstack;
308 register int nelts = GET_RTX_LENGTH (code);
309 register int length = sizeof (struct rtx_def)
310 + (nelts - 1) * sizeof (rtunion);
312 /* This function is called more than any other in GCC, so we
313 manipulate the obstack directly.
315 Even though rtx objects are word aligned, we may be sharing
316 an obstack with tree nodes, which may have to be double-word
317 aligned. So align our length to the alignment mask in the
320 length = (length + ob->alignment_mask) & ~ ob->alignment_mask;
322 if (ob->chunk_limit - ob->next_free < length)
323 _obstack_newchunk (ob, length);
324 rt = (rtx)ob->object_base;
325 ob->next_free += length;
326 ob->object_base = ob->next_free;
328 /* We want to clear everything up to the FLD array. Normally,
329 this is one int, but we don't want to assume that and it
330 isn't very portable anyway; this is. */
332 memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
339 /* Free the rtx X and all RTL allocated since X. */
346 obstack_free (rtl_obstack, x);
349 /* Create a new copy of an rtx.
350 Recursively copies the operands of the rtx,
351 except for those few rtx codes that are sharable. */
359 register RTX_CODE code;
360 register const char *format_ptr;
362 code = GET_CODE (orig);
375 /* SCRATCH must be shared because they represent distinct values. */
380 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
381 a LABEL_REF, it isn't sharable. */
382 if (GET_CODE (XEXP (orig, 0)) == PLUS
383 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
384 && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
388 /* A MEM with a constant address is not sharable. The problem is that
389 the constant address may need to be reloaded. If the mem is shared,
390 then reloading one copy of this mem will cause all copies to appear
391 to have been reloaded. */
397 copy = rtx_alloc (code);
399 /* Copy the various flags, and other information. We assume that
400 all fields need copying, and then clear the fields that should
401 not be copied. That is the sensible default behavior, and forces
402 us to explicitly document why we are *not* copying a flag. */
403 memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
405 /* We do not copy the USED flag, which is used as a mark bit during
406 walks over the RTL. */
409 /* We do not copy JUMP, CALL, or FRAME_RELATED for INSNs. */
410 if (GET_RTX_CLASS (code) == 'i')
414 copy->frame_related = 0;
417 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
419 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
421 switch (*format_ptr++)
424 XEXP (copy, i) = XEXP (orig, i);
425 if (XEXP (orig, i) != NULL)
426 XEXP (copy, i) = copy_rtx (XEXP (orig, i));
430 XEXP (copy, i) = XEXP (orig, i);
435 XVEC (copy, i) = XVEC (orig, i);
436 if (XVEC (orig, i) != NULL)
438 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
439 for (j = 0; j < XVECLEN (copy, i); j++)
440 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
446 bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack);
447 bitmap_copy (new_bits, XBITMAP (orig, i));
448 XBITMAP (copy, i) = new_bits;
453 XTREE (copy, i) = XTREE (orig, i);
457 XWINT (copy, i) = XWINT (orig, i);
461 XINT (copy, i) = XINT (orig, i);
466 XSTR (copy, i) = XSTR (orig, i);
470 /* Copy this through the wide int field; that's safest. */
471 X0WINT (copy, i) = X0WINT (orig, i);
481 /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
482 placed in the result directly, rather than being copied. */
485 copy_most_rtx (orig, may_share)
487 register rtx may_share;
491 register RTX_CODE code;
492 register const char *format_ptr;
494 if (orig == may_share)
497 code = GET_CODE (orig);
514 copy = rtx_alloc (code);
515 PUT_MODE (copy, GET_MODE (orig));
516 copy->in_struct = orig->in_struct;
517 copy->volatil = orig->volatil;
518 copy->unchanging = orig->unchanging;
519 copy->integrated = orig->integrated;
521 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
523 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
525 switch (*format_ptr++)
528 XEXP (copy, i) = XEXP (orig, i);
529 if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
530 XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
534 XEXP (copy, i) = XEXP (orig, i);
539 XVEC (copy, i) = XVEC (orig, i);
540 if (XVEC (orig, i) != NULL)
542 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
543 for (j = 0; j < XVECLEN (copy, i); j++)
545 = copy_most_rtx (XVECEXP (orig, i, j), may_share);
550 XWINT (copy, i) = XWINT (orig, i);
555 XINT (copy, i) = XINT (orig, i);
559 XTREE (copy, i) = XTREE (orig, i);
564 XSTR (copy, i) = XSTR (orig, i);
568 /* Copy this through the wide int field; that's safest. */
569 X0WINT (copy, i) = X0WINT (orig, i);
579 /* Create a new copy of an rtx. Only copy just one level. */
581 shallow_copy_rtx (orig)
585 register RTX_CODE code = GET_CODE (orig);
586 register rtx copy = rtx_alloc (code);
588 PUT_MODE (copy, GET_MODE (orig));
589 copy->in_struct = orig->in_struct;
590 copy->volatil = orig->volatil;
591 copy->unchanging = orig->unchanging;
592 copy->integrated = orig->integrated;
594 for (i = 0; i < GET_RTX_LENGTH (code); i++)
595 copy->fld[i] = orig->fld[i];
600 /* Subroutines of read_rtx. */
602 /* Dump code after printing a message. Used when read_rtx finds
606 dump_and_abort (expected_c, actual_c, infile)
607 int expected_c, actual_c;
614 "Expected character %c. Found character %c.",
615 expected_c, actual_c);
616 fprintf (stderr, " At file position: %ld\n", ftell (infile));
617 fprintf (stderr, "Following characters are:\n\t");
618 for (i = 0; i < 200; i++)
624 fprintf (stderr, "Aborting.\n");
628 /* Read chars from INFILE until a non-whitespace char
629 and return that. Comments, both Lisp style and C style,
630 are treated as whitespace.
631 Tools such as genflags use this function. */
634 read_skip_spaces (infile)
638 while ((c = getc (infile)))
640 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
644 while ((c = getc (infile)) && c != '\n' && c != EOF)
652 dump_and_abort ('*', c, infile);
655 while ((c = getc (infile)) && c != EOF)
657 if (prevc == '*' && c == '/')
667 /* Read an rtx code name into the buffer STR[].
668 It is terminated by any of the punctuation chars of rtx printed syntax. */
671 read_name (str, infile)
678 c = read_skip_spaces(infile);
683 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
685 if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
686 || c == '(' || c == '[')
696 fprintf (stderr, "missing name or number");
697 dump_and_abort (-1, -1, infile);
703 /* Provide a version of a function to read a long long if the system does
705 #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ)
711 HOST_WIDE_INT tmp_wide;
723 HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0');
724 if (new_wide < tmp_wide)
726 /* Return INT_MAX equiv on overflow. */
727 tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1;
735 tmp_wide = -tmp_wide;
740 /* Read an rtx in printed representation from INFILE
741 and return an actual rtx in core constructed accordingly.
742 read_rtx is not used in the compiler proper, but rather in
743 the utilities gen*.c that construct C code from machine descriptions. */
749 register int i, j, list_counter;
751 register const char *format_ptr;
752 /* tmp_char is a buffer used for reading decimal integers
753 and names of rtx types and machine modes.
754 Therefore, 256 must be enough. */
759 HOST_WIDE_INT tmp_wide;
761 /* Linked list structure for making RTXs: */
764 struct rtx_list *next;
765 rtx value; /* Value of this node... */
768 c = read_skip_spaces (infile); /* Should be open paren. */
770 dump_and_abort ('(', c, infile);
772 read_name (tmp_char, infile);
776 for (i=0; i < NUM_RTX_CODE; i++) /* @@ might speed this search up */
778 if (!(strcmp (tmp_char, GET_RTX_NAME (i))))
780 tmp_code = (RTX_CODE) i; /* get value for name */
784 if (tmp_code == UNKNOWN)
787 "Unknown rtx read in rtl.read_rtx(). Code name was %s .",
790 /* (NIL) stands for an expression that isn't there. */
793 /* Discard the closeparen. */
794 while ((c = getc (infile)) && c != ')');
798 return_rtx = rtx_alloc (tmp_code); /* if we end up with an insn expression
799 then we free this space below. */
800 format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
802 /* If what follows is `: mode ', read it and
803 store the mode in the rtx. */
805 i = read_skip_spaces (infile);
809 read_name (tmp_char, infile);
810 for (k = 0; k < NUM_MACHINE_MODES; k++)
811 if (!strcmp (GET_MODE_NAME (k), tmp_char))
814 PUT_MODE (return_rtx, (enum machine_mode) k );
819 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
820 switch (*format_ptr++)
822 /* 0 means a field for internal use only.
823 Don't expect it to be present in the input. */
829 XEXP (return_rtx, i) = read_rtx (infile);
833 /* 'V' is an optional vector: if a closeparen follows,
834 just store NULL for this element. */
835 c = read_skip_spaces (infile);
839 XVEC (return_rtx, i) = 0;
842 /* Now process the vector. */
846 register struct rtx_list *next_rtx, *rtx_list_link;
847 struct rtx_list *list_rtx = NULL;
849 c = read_skip_spaces (infile);
851 dump_and_abort ('[', c, infile);
853 /* add expressions to a list, while keeping a count */
856 while ((c = read_skip_spaces (infile)) && c != ']')
860 rtx_list_link = (struct rtx_list *)
861 alloca (sizeof (struct rtx_list));
862 rtx_list_link->value = read_rtx (infile);
864 list_rtx = rtx_list_link;
866 next_rtx->next = rtx_list_link;
867 next_rtx = rtx_list_link;
868 rtx_list_link->next = 0;
870 /* get vector length and allocate it */
871 XVEC (return_rtx, i) = (list_counter
872 ? rtvec_alloc (list_counter) : NULL_RTVEC);
873 if (list_counter > 0)
876 for (j = 0; j < list_counter; j++,
877 next_rtx = next_rtx->next)
878 XVECEXP (return_rtx, i, j) = next_rtx->value;
880 /* close bracket gotten */
885 /* 'S' is an optional string: if a closeparen follows,
886 just store NULL for this element. */
887 c = read_skip_spaces (infile);
891 XSTR (return_rtx, i) = 0;
898 register char *stringbuf;
900 c = read_skip_spaces (infile);
904 c = read_skip_spaces (infile);
907 dump_and_abort ('"', c, infile);
911 c = getc (infile); /* Read the string */
914 c = getc (infile); /* Read the string */
915 /* \; makes stuff for a C string constant containing
919 obstack_grow (rtl_obstack, "\\n\\t", 4);
926 obstack_1grow (rtl_obstack, c);
929 obstack_1grow (rtl_obstack, 0);
930 stringbuf = (char *) obstack_finish (rtl_obstack);
934 c = read_skip_spaces (infile);
936 dump_and_abort (')', c, infile);
938 XSTR (return_rtx, i) = stringbuf;
943 read_name (tmp_char, infile);
944 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
945 tmp_wide = atoi (tmp_char);
947 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
948 tmp_wide = atol (tmp_char);
950 /* Prefer atoll over atoq, since the former is in the ISO C9X draft.
951 But prefer not to use our hand-rolled function above either. */
952 #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
953 tmp_wide = atoll (tmp_char);
955 tmp_wide = atoq (tmp_char);
959 XWINT (return_rtx, i) = tmp_wide;
964 read_name (tmp_char, infile);
965 tmp_int = atoi (tmp_char);
966 XINT (return_rtx, i) = tmp_int;
971 "switch format wrong in rtl.read_rtx(). format was: %c.\n",
973 fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
977 c = read_skip_spaces (infile);
979 dump_and_abort (')', c, infile);
984 #if defined ENABLE_CHECKING && HAVE_GCC_VERSION(2,7)
986 rtl_check_failed_bounds (r, n, file, line, func)
993 error ("RTL check: access of elt %d of `%s' with last elt %d",
994 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r))-1);
995 fancy_abort (file, line, func);
999 rtl_check_failed_type1 (r, n, c1, file, line, func)
1007 error ("RTL check: expected elt %d type '%c', have '%c' (rtx %s)",
1008 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)));
1009 fancy_abort (file, line, func);
1013 rtl_check_failed_type2 (r, n, c1, c2, file, line, func)
1022 error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s)",
1024 GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE(r)));
1025 fancy_abort (file, line, func);
1029 rtl_check_failed_code1 (r, code, file, line, func)
1036 error ("RTL check: expected code `%s', have `%s'",
1037 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)));
1038 fancy_abort (file, line, func);
1042 rtl_check_failed_code2 (r, code1, code2, file, line, func)
1044 enum rtx_code code1, code2;
1049 error ("RTL check: expected code `%s' or `%s', have `%s'",
1050 GET_RTX_NAME (code1), GET_RTX_NAME (code2),
1051 GET_RTX_NAME (GET_CODE (r)));
1052 fancy_abort (file, line, func);
1055 /* XXX Maybe print the vector? */
1057 rtvec_check_failed_bounds (r, n, file, line, func)
1064 error ("RTL check: access of elt %d of vector with last elt %d",
1065 n, GET_NUM_ELEM (r)-1);
1066 fancy_abort (file, line, func);
1068 #endif /* ENABLE_CHECKING */
1070 /* These are utility functions used by fatal-error functions all over the
1071 code. rtl.c happens to be linked by all the programs that need them,
1072 so these are here. In the future we want to break out all error handling
1073 to its own module. */
1075 /* Given a partial pathname as input, return another pathname that
1076 shares no directory elements with the pathname of __FILE__. This
1077 is used by fancy_abort() to print `Internal compiler error in expr.c'
1078 instead of `Internal compiler error in ../../egcs/gcc/expr.c'. */
1080 trim_filename (name)
1083 static const char this_file[] = __FILE__;
1084 const char *p = name, *q = this_file;
1086 while (*p == *q && *p != 0 && *q != 0) p++, q++;
1087 while (p > name && p[-1] != DIR_SEPARATOR
1088 #ifdef DIR_SEPARATOR_2
1089 && p[-1] != DIR_SEPARATOR_2
1097 /* Report an internal compiler error in a friendly manner and without
1100 extern void fatal PVPROTO ((const char *, ...))
1101 ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
1104 fancy_abort (file, line, function)
1107 const char *function;
1109 if (function == NULL)
1112 "Internal compiler error in `%s', at %s:%d\n\
1113 Please submit a full bug report.\n\
1114 See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> \
1116 function, trim_filename (file), line);