1 /* Allocate and read RTL for GNU C Compiler.
2 Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
29 #define obstack_chunk_alloc xmalloc
30 #define obstack_chunk_free free
33 #define DIR_SEPARATOR '/'
36 /* Obstack used for allocating RTL objects.
37 Between functions, this is the permanent_obstack.
38 While parsing and expanding a function, this is maybepermanent_obstack
39 so we can save it if it is an inline function.
40 During optimization and output, this is function_obstack. */
42 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.
47 We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and
48 max(LONG_DOUBLE_TYPE_SIZE)==128.
49 This is duplicated in gengenrtl.c.
50 A number of places assume that there are always at least two 'w'
51 slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
52 #if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE
53 #define CONST_DOUBLE_FORMAT "e0ww"
54 #elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE
55 #define CONST_DOUBLE_FORMAT "e0ww"
56 #elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE
57 #define CONST_DOUBLE_FORMAT "e0www"
58 #elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE
59 #define CONST_DOUBLE_FORMAT "e0wwww"
61 #define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
64 /* Indexed by rtx code, gives number of operands for an rtx with that code.
65 Does NOT include rtx header data (code and links). */
67 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
69 const int rtx_length[NUM_RTX_CODE + 1] = {
75 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
77 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
79 const char * const rtx_name[] = {
80 #include "rtl.def" /* rtl expressions are documented here */
85 /* Indexed by machine mode, gives the name of that machine mode.
86 This name does not include the letters "mode". */
88 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) NAME,
90 const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
91 #include "machmode.def"
92 /* Add an extra field to avoid a core dump if someone tries to convert
93 MAX_MACHINE_MODE to a string. */
99 /* Indexed by machine mode, gives the length of the mode, in bytes.
100 GET_MODE_CLASS uses this. */
102 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS,
104 const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
105 #include "machmode.def"
110 /* Indexed by machine mode, gives the length of the mode, in bytes.
111 GET_MODE_SIZE uses this. */
113 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE,
115 const int mode_size[(int) MAX_MACHINE_MODE] = {
116 #include "machmode.def"
121 /* Indexed by machine mode, gives the length of the mode's subunit.
122 GET_MODE_UNIT_SIZE uses this. */
124 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT,
126 const int mode_unit_size[(int) MAX_MACHINE_MODE] = {
127 #include "machmode.def" /* machine modes are documented here */
132 /* Indexed by machine mode, gives next wider natural mode
133 (QI -> HI -> SI -> DI, etc.) Widening multiply instructions
136 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
137 (unsigned char) WIDER,
139 const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
140 #include "machmode.def" /* machine modes are documented here */
145 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
146 ((SIZE) * BITS_PER_UNIT >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (SIZE) * BITS_PER_UNIT) - 1,
148 /* Indexed by machine mode, gives mask of significant bits in mode. */
150 const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
151 #include "machmode.def"
154 /* Indexed by mode class, gives the narrowest mode for each class.
155 The Q modes are always of width 1 (2 for complex) - it is impossible
156 for any mode to be narrower. */
158 const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = {
159 /* MODE_RANDOM */ VOIDmode,
160 /* MODE_INT */ QImode,
161 /* MODE_FLOAT */ QFmode,
162 /* MODE_PARTIAL_INT */ PQImode,
163 /* MODE_CC */ CCmode,
164 /* MODE_COMPLEX_INT */ CQImode,
165 /* MODE_COMPLEX_FLOAT */ QCmode
169 /* Indexed by rtx code, gives a sequence of operand-types for
170 rtx's of that code. The sequence is a C string in which
171 each character describes one operand. */
173 const char * const rtx_format[] = {
175 can cause a warning message
176 "0" field is unused (or used in a phase-dependent manner)
180 "n" like "i", but prints entries from `note_insn_name'
181 "w" an integer of width HOST_BITS_PER_WIDE_INT
183 "s" a pointer to a string
185 "S" like "s", but optional:
186 the containing rtx may end before this operand
187 "e" a pointer to an rtl expression
188 prints the expression
189 "E" a pointer to a vector that points to a number of rtl expressions
190 prints a list of the rtl expressions
191 "V" like "E", but optional:
192 the containing rtx may end before this operand
193 "u" a pointer to another insn
194 prints the uid of the insn.
195 "b" is a pointer to a bitmap header.
196 "t" is a tree pointer. */
198 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
199 #include "rtl.def" /* rtl expressions are defined here */
203 /* Indexed by rtx code, gives a character representing the "class" of
204 that rtx code. See rtl.def for documentation on the defined classes. */
206 const char rtx_class[] = {
207 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
208 #include "rtl.def" /* rtl expressions are defined here */
212 /* Names for kinds of NOTEs and REG_NOTEs. */
214 const char * const note_insn_name[] = { 0 , "NOTE_INSN_DELETED",
215 "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
216 "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
217 "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
218 "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
219 "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
220 "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
221 "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
222 "NOTE_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_START",
223 "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE",
224 "NOTE_INSN_BASIC_BLOCK" };
226 const char * const reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0",
227 "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL",
228 "REG_NONNEG", "REG_NO_CONFLICT", "REG_UNUSED",
229 "REG_CC_SETTER", "REG_CC_USER", "REG_LABEL",
230 "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
231 "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA",
232 "REG_BR_PRED", "REG_EH_CONTEXT",
233 "REG_FRAME_RELATED_EXPR", "REG_EH_REGION",
236 static void dump_and_abort PROTO((int, int, FILE *)) ATTRIBUTE_NORETURN;
237 static void read_name PROTO((char *, FILE *));
239 /* Allocate an rtx vector of N elements.
240 Store the length, and initialize all elements to zero. */
249 rt = (rtvec) obstack_alloc (rtl_obstack,
250 sizeof (struct rtvec_def)
251 + (( n - 1) * sizeof (rtx)));
253 /* clear out the vector */
254 PUT_NUM_ELEM (rt, n);
256 for (i = 0; i < n; i++)
262 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
263 all the rest is initialized to zero. */
270 register struct obstack *ob = rtl_obstack;
271 register int nelts = GET_RTX_LENGTH (code);
272 register int length = sizeof (struct rtx_def)
273 + (nelts - 1) * sizeof (rtunion);
275 /* This function is called more than any other in GCC,
276 so we manipulate the obstack directly.
278 Even though rtx objects are word aligned, we may be sharing an obstack
279 with tree nodes, which may have to be double-word aligned. So align
280 our length to the alignment mask in the obstack. */
282 length = (length + ob->alignment_mask) & ~ ob->alignment_mask;
284 if (ob->chunk_limit - ob->next_free < length)
285 _obstack_newchunk (ob, length);
286 rt = (rtx)ob->object_base;
287 ob->next_free += length;
288 ob->object_base = ob->next_free;
290 /* We want to clear everything up to the FLD array. Normally, this is
291 one int, but we don't want to assume that and it isn't very portable
294 memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
301 /* Free the rtx X and all RTL allocated since X. */
307 obstack_free (rtl_obstack, x);
310 /* Create a new copy of an rtx.
311 Recursively copies the operands of the rtx,
312 except for those few rtx codes that are sharable. */
320 register RTX_CODE code;
321 register const char *format_ptr;
323 code = GET_CODE (orig);
336 /* SCRATCH must be shared because they represent distinct values. */
341 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
342 a LABEL_REF, it isn't sharable. */
343 if (GET_CODE (XEXP (orig, 0)) == PLUS
344 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
345 && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
349 /* A MEM with a constant address is not sharable. The problem is that
350 the constant address may need to be reloaded. If the mem is shared,
351 then reloading one copy of this mem will cause all copies to appear
352 to have been reloaded. */
358 copy = rtx_alloc (code);
360 /* Copy the various flags, and other information. We assume that
361 all fields need copying, and then clear the fields that should
362 not be copied. That is the sensible default behavior, and forces
363 us to explicitly document why we are *not* copying a flag. */
364 memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
366 /* We do not copy the USED flag, which is used as a mark bit during
367 walks over the RTL. */
370 /* We do not copy JUMP, CALL, or FRAME_RELATED for INSNs. */
371 if (GET_RTX_CLASS (code) == 'i')
375 copy->frame_related = 0;
378 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
380 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
382 switch (*format_ptr++)
385 XEXP (copy, i) = XEXP (orig, i);
386 if (XEXP (orig, i) != NULL)
387 XEXP (copy, i) = copy_rtx (XEXP (orig, i));
391 XEXP (copy, i) = XEXP (orig, i);
396 XVEC (copy, i) = XVEC (orig, i);
397 if (XVEC (orig, i) != NULL)
399 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
400 for (j = 0; j < XVECLEN (copy, i); j++)
401 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
407 bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack);
408 bitmap_copy (new_bits, XBITMAP (orig, i));
409 XBITMAP (copy, i) = new_bits;
414 XTREE (copy, i) = XTREE (orig, i);
418 XWINT (copy, i) = XWINT (orig, i);
422 XINT (copy, i) = XINT (orig, i);
427 XSTR (copy, i) = XSTR (orig, i);
431 /* Copy this through the wide int field; that's safest. */
432 X0WINT (copy, i) = X0WINT (orig, i);
442 /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
443 placed in the result directly, rather than being copied. */
446 copy_most_rtx (orig, may_share)
448 register rtx may_share;
452 register RTX_CODE code;
453 register const char *format_ptr;
455 if (orig == may_share)
458 code = GET_CODE (orig);
475 copy = rtx_alloc (code);
476 PUT_MODE (copy, GET_MODE (orig));
477 copy->in_struct = orig->in_struct;
478 copy->volatil = orig->volatil;
479 copy->unchanging = orig->unchanging;
480 copy->integrated = orig->integrated;
482 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
484 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
486 switch (*format_ptr++)
489 XEXP (copy, i) = XEXP (orig, i);
490 if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
491 XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
495 XEXP (copy, i) = XEXP (orig, i);
500 XVEC (copy, i) = XVEC (orig, i);
501 if (XVEC (orig, i) != NULL)
503 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
504 for (j = 0; j < XVECLEN (copy, i); j++)
506 = copy_most_rtx (XVECEXP (orig, i, j), may_share);
511 XWINT (copy, i) = XWINT (orig, i);
516 XINT (copy, i) = XINT (orig, i);
520 XTREE (copy, i) = XTREE (orig, i);
525 XSTR (copy, i) = XSTR (orig, i);
529 /* Copy this through the wide int field; that's safest. */
530 X0WINT (copy, i) = X0WINT (orig, i);
540 /* Create a new copy of an rtx. Only copy just one level. */
542 shallow_copy_rtx (orig)
546 register RTX_CODE code = GET_CODE (orig);
547 register rtx copy = rtx_alloc (code);
549 PUT_MODE (copy, GET_MODE (orig));
550 copy->in_struct = orig->in_struct;
551 copy->volatil = orig->volatil;
552 copy->unchanging = orig->unchanging;
553 copy->integrated = orig->integrated;
555 for (i = 0; i < GET_RTX_LENGTH (code); i++)
556 copy->fld[i] = orig->fld[i];
561 /* Subroutines of read_rtx. */
563 /* Dump code after printing a message. Used when read_rtx finds
567 dump_and_abort (expected_c, actual_c, infile)
568 int expected_c, actual_c;
575 "Expected character %c. Found character %c.",
576 expected_c, actual_c);
577 fprintf (stderr, " At file position: %ld\n", ftell (infile));
578 fprintf (stderr, "Following characters are:\n\t");
579 for (i = 0; i < 200; i++)
585 fprintf (stderr, "Aborting.\n");
589 /* Read chars from INFILE until a non-whitespace char
590 and return that. Comments, both Lisp style and C style,
591 are treated as whitespace.
592 Tools such as genflags use this function. */
595 read_skip_spaces (infile)
599 while ((c = getc (infile)))
601 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
605 while ((c = getc (infile)) && c != '\n' && c != EOF)
613 dump_and_abort ('*', c, infile);
616 while ((c = getc (infile)) && c != EOF)
618 if (prevc == '*' && c == '/')
628 /* Read an rtx code name into the buffer STR[].
629 It is terminated by any of the punctuation chars of rtx printed syntax. */
632 read_name (str, infile)
639 c = read_skip_spaces(infile);
644 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
646 if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
647 || c == '(' || c == '[')
657 fprintf (stderr, "missing name or number");
658 dump_and_abort (-1, -1, infile);
664 /* Provide a version of a function to read a long long if the system does
666 #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ)
672 HOST_WIDE_INT tmp_wide;
684 HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0');
685 if (new_wide < tmp_wide)
687 /* Return INT_MAX equiv on overflow. */
688 tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1;
696 tmp_wide = -tmp_wide;
701 /* Read an rtx in printed representation from INFILE
702 and return an actual rtx in core constructed accordingly.
703 read_rtx is not used in the compiler proper, but rather in
704 the utilities gen*.c that construct C code from machine descriptions. */
710 register int i, j, list_counter;
712 register const char *format_ptr;
713 /* tmp_char is a buffer used for reading decimal integers
714 and names of rtx types and machine modes.
715 Therefore, 256 must be enough. */
720 HOST_WIDE_INT tmp_wide;
722 /* Linked list structure for making RTXs: */
725 struct rtx_list *next;
726 rtx value; /* Value of this node... */
729 c = read_skip_spaces (infile); /* Should be open paren. */
731 dump_and_abort ('(', c, infile);
733 read_name (tmp_char, infile);
737 for (i=0; i < NUM_RTX_CODE; i++) /* @@ might speed this search up */
739 if (!(strcmp (tmp_char, GET_RTX_NAME (i))))
741 tmp_code = (RTX_CODE) i; /* get value for name */
745 if (tmp_code == UNKNOWN)
748 "Unknown rtx read in rtl.read_rtx(). Code name was %s .",
751 /* (NIL) stands for an expression that isn't there. */
754 /* Discard the closeparen. */
755 while ((c = getc (infile)) && c != ')');
759 return_rtx = rtx_alloc (tmp_code); /* if we end up with an insn expression
760 then we free this space below. */
761 format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
763 /* If what follows is `: mode ', read it and
764 store the mode in the rtx. */
766 i = read_skip_spaces (infile);
770 read_name (tmp_char, infile);
771 for (k = 0; k < NUM_MACHINE_MODES; k++)
772 if (!strcmp (GET_MODE_NAME (k), tmp_char))
775 PUT_MODE (return_rtx, (enum machine_mode) k );
780 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
781 switch (*format_ptr++)
783 /* 0 means a field for internal use only.
784 Don't expect it to be present in the input. */
790 XEXP (return_rtx, i) = read_rtx (infile);
794 /* 'V' is an optional vector: if a closeparen follows,
795 just store NULL for this element. */
796 c = read_skip_spaces (infile);
800 XVEC (return_rtx, i) = 0;
803 /* Now process the vector. */
807 register struct rtx_list *next_rtx, *rtx_list_link;
808 struct rtx_list *list_rtx = NULL;
810 c = read_skip_spaces (infile);
812 dump_and_abort ('[', c, infile);
814 /* add expressions to a list, while keeping a count */
817 while ((c = read_skip_spaces (infile)) && c != ']')
821 rtx_list_link = (struct rtx_list *)
822 alloca (sizeof (struct rtx_list));
823 rtx_list_link->value = read_rtx (infile);
825 list_rtx = rtx_list_link;
827 next_rtx->next = rtx_list_link;
828 next_rtx = rtx_list_link;
829 rtx_list_link->next = 0;
831 /* get vector length and allocate it */
832 XVEC (return_rtx, i) = (list_counter
833 ? rtvec_alloc (list_counter) : NULL_RTVEC);
834 if (list_counter > 0)
837 for (j = 0; j < list_counter; j++,
838 next_rtx = next_rtx->next)
839 XVECEXP (return_rtx, i, j) = next_rtx->value;
841 /* close bracket gotten */
846 /* 'S' is an optional string: if a closeparen follows,
847 just store NULL for this element. */
848 c = read_skip_spaces (infile);
852 XSTR (return_rtx, i) = 0;
859 register char *stringbuf;
861 c = read_skip_spaces (infile);
865 c = read_skip_spaces (infile);
868 dump_and_abort ('"', c, infile);
872 c = getc (infile); /* Read the string */
875 c = getc (infile); /* Read the string */
876 /* \; makes stuff for a C string constant containing
880 obstack_grow (rtl_obstack, "\\n\\t", 4);
887 obstack_1grow (rtl_obstack, c);
890 obstack_1grow (rtl_obstack, 0);
891 stringbuf = (char *) obstack_finish (rtl_obstack);
895 c = read_skip_spaces (infile);
897 dump_and_abort (')', c, infile);
899 XSTR (return_rtx, i) = stringbuf;
904 read_name (tmp_char, infile);
905 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
906 tmp_wide = atoi (tmp_char);
908 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
909 tmp_wide = atol (tmp_char);
911 /* Prefer atoll over atoq, since the former is in the ISO C9X draft.
912 But prefer not to use our hand-rolled function above either. */
913 #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
914 tmp_wide = atoll (tmp_char);
916 tmp_wide = atoq (tmp_char);
920 XWINT (return_rtx, i) = tmp_wide;
925 read_name (tmp_char, infile);
926 tmp_int = atoi (tmp_char);
927 XINT (return_rtx, i) = tmp_int;
932 "switch format wrong in rtl.read_rtx(). format was: %c.\n",
934 fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
938 c = read_skip_spaces (infile);
940 dump_and_abort (')', c, infile);
945 #if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6)
947 rtl_check_failed_bounds (r, n, file, line, func)
954 error ("RTL check: access of elt %d of `%s' with last elt %d",
955 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r))-1);
956 fancy_abort (file, line, func);
960 rtl_check_failed_type1 (r, n, c1, file, line, func)
968 error ("RTL check: expected elt %d type '%c', have '%c' (rtx %s)",
969 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)));
970 fancy_abort (file, line, func);
974 rtl_check_failed_type2 (r, n, c1, c2, file, line, func)
983 error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s)",
985 GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE(r)));
986 fancy_abort (file, line, func);
989 /* XXX Maybe print the vector? */
991 rtvec_check_failed_bounds (r, n, file, line, func)
998 error ("RTL check: access of elt %d of vector with last elt %d",
999 n, GET_NUM_ELEM (r)-1);
1000 fancy_abort (file, line, func);
1002 #endif /* ENABLE_CHECKING */
1004 /* These are utility functions used by fatal-error functions all over the
1005 code. rtl.c happens to be linked by all the programs that need them,
1006 so these are here. In the future we want to break out all error handling
1007 to its own module. */
1009 /* Given a partial pathname as input, return another pathname that
1010 shares no directory elements with the pathname of __FILE__. This
1011 is used by fancy_abort() to print `Internal compiler error in expr.c'
1012 instead of `Internal compiler error in ../../egcs/gcc/expr.c'. */
1014 trim_filename (name)
1017 static const char this_file[] = __FILE__;
1018 const char *p = name, *q = this_file;
1020 while (*p == *q && *p != 0 && *q != 0) p++, q++;
1021 while (p > name && p[-1] != DIR_SEPARATOR
1022 #ifdef DIR_SEPARATOR_2
1023 && p[-1] != DIR_SEPARATOR_2
1031 /* Report an internal compiler error in a friendly manner and without
1034 extern void fatal PVPROTO ((const char *, ...))
1035 ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
1038 fancy_abort (file, line, function)
1041 const char *function;
1043 if (function == NULL)
1046 "Internal compiler error in `%s', at %s:%d\n\
1047 Please submit a full bug report.\n\
1048 See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> \
1050 function, trim_filename (file), line);