]>
Commit | Line | Data |
---|---|---|
6f29feb1 | 1 | /* Allocate and read RTL for GNU C Compiler. |
c5c76735 JL |
2 | Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999 |
3 | Free Software Foundation, Inc. | |
6f29feb1 JW |
4 | |
5 | This file is part of GNU CC. | |
6 | ||
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) | |
10 | any later version. | |
11 | ||
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. | |
16 | ||
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 | |
e99215a3 RK |
19 | the Free Software Foundation, 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. */ | |
6f29feb1 JW |
21 | |
22 | ||
23 | #include "config.h" | |
670ee920 | 24 | #include "system.h" |
6f29feb1 | 25 | #include "rtl.h" |
a19a1b5d | 26 | #include "real.h" |
0dfa1860 | 27 | #include "bitmap.h" |
a3770a81 | 28 | #include "ggc.h" |
6f29feb1 JW |
29 | #include "obstack.h" |
30 | #define obstack_chunk_alloc xmalloc | |
31 | #define obstack_chunk_free free | |
6f29feb1 | 32 | |
987009bf ZW |
33 | #ifndef DIR_SEPARATOR |
34 | #define DIR_SEPARATOR '/' | |
35 | #endif | |
36 | ||
6f29feb1 JW |
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. */ | |
42 | ||
43 | extern struct obstack *rtl_obstack; | |
6f29feb1 | 44 | \f |
aa0b4465 ZW |
45 | |
46 | /* Calculate the format for CONST_DOUBLE. This depends on the relative | |
47 | widths of HOST_WIDE_INT and REAL_VALUE_TYPE. | |
48 | We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and | |
49 | max(LONG_DOUBLE_TYPE_SIZE)==128. | |
50 | This is duplicated in gengenrtl.c. | |
51 | A number of places assume that there are always at least two 'w' | |
52 | slots in a CONST_DOUBLE, so we provide them even if one would suffice. */ | |
53 | #if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE | |
54 | #define CONST_DOUBLE_FORMAT "e0ww" | |
55 | #elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE | |
56 | #define CONST_DOUBLE_FORMAT "e0ww" | |
57 | #elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE | |
58 | #define CONST_DOUBLE_FORMAT "e0www" | |
59 | #elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE | |
60 | #define CONST_DOUBLE_FORMAT "e0wwww" | |
61 | #else | |
62 | #define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */ | |
63 | #endif | |
64 | ||
6f29feb1 | 65 | /* Indexed by rtx code, gives number of operands for an rtx with that code. |
aa0b4465 | 66 | Does NOT include rtx header data (code and links). */ |
6f29feb1 | 67 | |
aa0b4465 ZW |
68 | #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 , |
69 | ||
70 | const int rtx_length[NUM_RTX_CODE + 1] = { | |
71 | #include "rtl.def" | |
72 | }; | |
73 | ||
74 | #undef DEF_RTL_EXPR | |
6f29feb1 JW |
75 | |
76 | /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */ | |
77 | ||
78 | #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME , | |
79 | ||
5f06c983 | 80 | const char * const rtx_name[] = { |
6f29feb1 JW |
81 | #include "rtl.def" /* rtl expressions are documented here */ |
82 | }; | |
83 | ||
84 | #undef DEF_RTL_EXPR | |
85 | ||
86 | /* Indexed by machine mode, gives the name of that machine mode. | |
87 | This name does not include the letters "mode". */ | |
88 | ||
89 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) NAME, | |
90 | ||
a4ec8d12 | 91 | const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = { |
6f29feb1 | 92 | #include "machmode.def" |
913f68c1 JC |
93 | /* Add an extra field to avoid a core dump if someone tries to convert |
94 | MAX_MACHINE_MODE to a string. */ | |
95 | "" | |
6f29feb1 JW |
96 | }; |
97 | ||
98 | #undef DEF_MACHMODE | |
99 | ||
100 | /* Indexed by machine mode, gives the length of the mode, in bytes. | |
101 | GET_MODE_CLASS uses this. */ | |
102 | ||
103 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS, | |
104 | ||
aa0b4465 | 105 | const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = { |
6f29feb1 JW |
106 | #include "machmode.def" |
107 | }; | |
108 | ||
109 | #undef DEF_MACHMODE | |
110 | ||
111 | /* Indexed by machine mode, gives the length of the mode, in bytes. | |
112 | GET_MODE_SIZE uses this. */ | |
113 | ||
114 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE, | |
115 | ||
aa0b4465 | 116 | const int mode_size[(int) MAX_MACHINE_MODE] = { |
6f29feb1 JW |
117 | #include "machmode.def" |
118 | }; | |
119 | ||
120 | #undef DEF_MACHMODE | |
121 | ||
122 | /* Indexed by machine mode, gives the length of the mode's subunit. | |
123 | GET_MODE_UNIT_SIZE uses this. */ | |
124 | ||
125 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT, | |
126 | ||
aa0b4465 | 127 | const int mode_unit_size[(int) MAX_MACHINE_MODE] = { |
6f29feb1 JW |
128 | #include "machmode.def" /* machine modes are documented here */ |
129 | }; | |
130 | ||
131 | #undef DEF_MACHMODE | |
132 | ||
133 | /* Indexed by machine mode, gives next wider natural mode | |
134 | (QI -> HI -> SI -> DI, etc.) Widening multiply instructions | |
135 | use this. */ | |
136 | ||
137 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \ | |
913f68c1 | 138 | (unsigned char) WIDER, |
6f29feb1 | 139 | |
aa0b4465 | 140 | const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = { |
6f29feb1 JW |
141 | #include "machmode.def" /* machine modes are documented here */ |
142 | }; | |
143 | ||
144 | #undef DEF_MACHMODE | |
145 | ||
913f68c1 JC |
146 | #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \ |
147 | ((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 | ||
149 | /* Indexed by machine mode, gives mask of significant bits in mode. */ | |
150 | ||
aa0b4465 | 151 | const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = { |
913f68c1 JC |
152 | #include "machmode.def" |
153 | }; | |
154 | ||
aa0b4465 ZW |
155 | /* Indexed by mode class, gives the narrowest mode for each class. |
156 | The Q modes are always of width 1 (2 for complex) - it is impossible | |
157 | for any mode to be narrower. */ | |
158 | ||
159 | const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = { | |
160 | /* MODE_RANDOM */ VOIDmode, | |
161 | /* MODE_INT */ QImode, | |
162 | /* MODE_FLOAT */ QFmode, | |
163 | /* MODE_PARTIAL_INT */ PQImode, | |
164 | /* MODE_CC */ CCmode, | |
165 | /* MODE_COMPLEX_INT */ CQImode, | |
166 | /* MODE_COMPLEX_FLOAT */ QCmode | |
167 | }; | |
168 | ||
4a39a918 | 169 | |
6f29feb1 JW |
170 | /* Indexed by rtx code, gives a sequence of operand-types for |
171 | rtx's of that code. The sequence is a C string in which | |
6dc42e49 | 172 | each character describes one operand. */ |
6f29feb1 | 173 | |
aa0b4465 | 174 | const char * const rtx_format[] = { |
6f29feb1 JW |
175 | /* "*" undefined. |
176 | can cause a warning message | |
177 | "0" field is unused (or used in a phase-dependent manner) | |
178 | prints nothing | |
179 | "i" an integer | |
180 | prints the integer | |
181 | "n" like "i", but prints entries from `note_insn_name' | |
c166a311 CH |
182 | "w" an integer of width HOST_BITS_PER_WIDE_INT |
183 | prints the integer | |
6f29feb1 JW |
184 | "s" a pointer to a string |
185 | prints the string | |
186 | "S" like "s", but optional: | |
187 | the containing rtx may end before this operand | |
188 | "e" a pointer to an rtl expression | |
189 | prints the expression | |
190 | "E" a pointer to a vector that points to a number of rtl expressions | |
191 | prints a list of the rtl expressions | |
192 | "V" like "E", but optional: | |
193 | the containing rtx may end before this operand | |
194 | "u" a pointer to another insn | |
0dfa1860 MM |
195 | prints the uid of the insn. |
196 | "b" is a pointer to a bitmap header. | |
197 | "t" is a tree pointer. */ | |
6f29feb1 JW |
198 | |
199 | #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT , | |
200 | #include "rtl.def" /* rtl expressions are defined here */ | |
201 | #undef DEF_RTL_EXPR | |
202 | }; | |
203 | ||
204 | /* Indexed by rtx code, gives a character representing the "class" of | |
205 | that rtx code. See rtl.def for documentation on the defined classes. */ | |
206 | ||
1f9a015e | 207 | const char rtx_class[] = { |
6f29feb1 JW |
208 | #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS, |
209 | #include "rtl.def" /* rtl expressions are defined here */ | |
210 | #undef DEF_RTL_EXPR | |
211 | }; | |
212 | ||
213 | /* Names for kinds of NOTEs and REG_NOTEs. */ | |
214 | ||
1f9a015e | 215 | const char * const note_insn_name[] = { 0 , "NOTE_INSN_DELETED", |
6f29feb1 JW |
216 | "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END", |
217 | "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END", | |
218 | "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP", | |
bdac5f58 | 219 | "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP", |
196cedd0 | 220 | "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG", |
3d195391 | 221 | "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG", |
f6e3c1bb | 222 | "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END", |
0dfa1860 | 223 | "NOTE_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_START", |
e881bb1b RH |
224 | "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE", |
225 | "NOTE_INSN_BASIC_BLOCK" }; | |
6f29feb1 | 226 | |
1f9a015e | 227 | const char * const reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0", |
6f29feb1 JW |
228 | "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL", |
229 | "REG_NONNEG", "REG_NO_CONFLICT", "REG_UNUSED", | |
230 | "REG_CC_SETTER", "REG_CC_USER", "REG_LABEL", | |
f6e3c1bb | 231 | "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB", |
c107334d | 232 | "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", |
07ebc930 | 233 | "REG_BR_PRED", "REG_EH_CONTEXT", |
e6cfb550 AM |
234 | "REG_FRAME_RELATED_EXPR", "REG_EH_REGION", |
235 | "REG_EH_RETHROW" }; | |
6f29feb1 | 236 | |
bf94d1ec | 237 | static void dump_and_abort PROTO((int, int, FILE *)) ATTRIBUTE_NORETURN; |
956d6950 JL |
238 | static void read_name PROTO((char *, FILE *)); |
239 | \f | |
6f29feb1 JW |
240 | /* Allocate an rtx vector of N elements. |
241 | Store the length, and initialize all elements to zero. */ | |
242 | ||
243 | rtvec | |
244 | rtvec_alloc (n) | |
245 | int n; | |
246 | { | |
247 | rtvec rt; | |
a3770a81 RH |
248 | |
249 | if (ggc_p) | |
250 | rt = ggc_alloc_rtvec (n); | |
251 | else | |
252 | { | |
253 | int i; | |
254 | ||
255 | rt = (rtvec) obstack_alloc (rtl_obstack, | |
256 | sizeof (struct rtvec_def) | |
257 | + (( n - 1) * sizeof (rtx))); | |
258 | ||
259 | /* clear out the vector */ | |
260 | for (i = 0; i < n; i++) | |
261 | rt->elem[i] = 0; | |
262 | } | |
6f29feb1 | 263 | |
395d53bb | 264 | PUT_NUM_ELEM (rt, n); |
6f29feb1 JW |
265 | return rt; |
266 | } | |
267 | ||
268 | /* Allocate an rtx of code CODE. The CODE is stored in the rtx; | |
269 | all the rest is initialized to zero. */ | |
270 | ||
271 | rtx | |
272 | rtx_alloc (code) | |
273 | RTX_CODE code; | |
274 | { | |
275 | rtx rt; | |
6f29feb1 | 276 | |
a3770a81 RH |
277 | if (ggc_p) |
278 | rt = ggc_alloc_rtx (GET_RTX_LENGTH (code)); | |
279 | else | |
280 | { | |
281 | register struct obstack *ob = rtl_obstack; | |
282 | register int nelts = GET_RTX_LENGTH (code); | |
283 | register int length = sizeof (struct rtx_def) | |
284 | + (nelts - 1) * sizeof (rtunion); | |
285 | ||
286 | /* This function is called more than any other in GCC, so we | |
287 | manipulate the obstack directly. | |
288 | ||
289 | Even though rtx objects are word aligned, we may be sharing | |
290 | an obstack with tree nodes, which may have to be double-word | |
291 | aligned. So align our length to the alignment mask in the | |
292 | obstack. */ | |
293 | ||
294 | length = (length + ob->alignment_mask) & ~ ob->alignment_mask; | |
295 | ||
296 | if (ob->chunk_limit - ob->next_free < length) | |
297 | _obstack_newchunk (ob, length); | |
298 | rt = (rtx)ob->object_base; | |
299 | ob->next_free += length; | |
300 | ob->object_base = ob->next_free; | |
301 | ||
302 | /* We want to clear everything up to the FLD array. Normally, | |
303 | this is one int, but we don't want to assume that and it | |
304 | isn't very portable anyway; this is. */ | |
305 | ||
306 | memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion)); | |
307 | } | |
2151a093 | 308 | |
6f29feb1 | 309 | PUT_CODE (rt, code); |
6f29feb1 JW |
310 | return rt; |
311 | } | |
9b404774 | 312 | |
c5c76735 JL |
313 | /* Like the above, but allocate based only on the length. This is called |
314 | by the routines built into genrtl.c. */ | |
315 | ||
316 | rtx | |
317 | obstack_alloc_rtx (length) | |
318 | int length; | |
319 | { | |
320 | rtx rt; | |
321 | register struct obstack *ob = rtl_obstack; | |
322 | ||
323 | /* This function is called more than any other in GCC, | |
324 | so we manipulate the obstack directly. | |
325 | ||
326 | Even though rtx objects are word aligned, we may be sharing an obstack | |
327 | with tree nodes, which may have to be double-word aligned. So align | |
328 | our length to the alignment mask in the obstack. */ | |
329 | ||
330 | length = (length + ob->alignment_mask) & ~ ob->alignment_mask; | |
331 | ||
332 | if (ob->chunk_limit - ob->next_free < length) | |
333 | _obstack_newchunk (ob, length); | |
334 | ||
335 | rt = (rtx) ob->object_base; | |
336 | ob->next_free += length; | |
337 | ob->object_base = ob->next_free; | |
338 | ||
339 | /* We want to clear everything up to the FLD array. Normally, | |
340 | this is one int, but we don't want to assume that and it | |
341 | isn't very portable anyway; this is. */ | |
342 | ||
343 | memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion)); | |
344 | ||
345 | return rt; | |
346 | } | |
347 | ||
9b404774 RS |
348 | /* Free the rtx X and all RTL allocated since X. */ |
349 | ||
350 | void | |
351 | rtx_free (x) | |
352 | rtx x; | |
353 | { | |
a3770a81 RH |
354 | if (!ggc_p) |
355 | obstack_free (rtl_obstack, x); | |
9b404774 | 356 | } |
6f29feb1 JW |
357 | \f |
358 | /* Create a new copy of an rtx. | |
359 | Recursively copies the operands of the rtx, | |
360 | except for those few rtx codes that are sharable. */ | |
361 | ||
362 | rtx | |
363 | copy_rtx (orig) | |
364 | register rtx orig; | |
365 | { | |
366 | register rtx copy; | |
367 | register int i, j; | |
368 | register RTX_CODE code; | |
6f7d635c | 369 | register const char *format_ptr; |
6f29feb1 JW |
370 | |
371 | code = GET_CODE (orig); | |
372 | ||
373 | switch (code) | |
374 | { | |
375 | case REG: | |
376 | case QUEUED: | |
377 | case CONST_INT: | |
378 | case CONST_DOUBLE: | |
379 | case SYMBOL_REF: | |
380 | case CODE_LABEL: | |
381 | case PC: | |
382 | case CC0: | |
cf526dcc | 383 | case SCRATCH: |
0f41302f | 384 | /* SCRATCH must be shared because they represent distinct values. */ |
e9a25f70 | 385 | case ADDRESSOF: |
6f29feb1 | 386 | return orig; |
cf526dcc RK |
387 | |
388 | case CONST: | |
389 | /* CONST can be shared if it contains a SYMBOL_REF. If it contains | |
390 | a LABEL_REF, it isn't sharable. */ | |
391 | if (GET_CODE (XEXP (orig, 0)) == PLUS | |
392 | && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF | |
393 | && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT) | |
394 | return orig; | |
395 | break; | |
396 | ||
cc81e625 JW |
397 | /* A MEM with a constant address is not sharable. The problem is that |
398 | the constant address may need to be reloaded. If the mem is shared, | |
399 | then reloading one copy of this mem will cause all copies to appear | |
400 | to have been reloaded. */ | |
e9a25f70 JL |
401 | |
402 | default: | |
403 | break; | |
6f29feb1 JW |
404 | } |
405 | ||
406 | copy = rtx_alloc (code); | |
a4c6502a MM |
407 | |
408 | /* Copy the various flags, and other information. We assume that | |
409 | all fields need copying, and then clear the fields that should | |
410 | not be copied. That is the sensible default behavior, and forces | |
411 | us to explicitly document why we are *not* copying a flag. */ | |
8db99db2 | 412 | memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion)); |
a4c6502a MM |
413 | |
414 | /* We do not copy the USED flag, which is used as a mark bit during | |
415 | walks over the RTL. */ | |
416 | copy->used = 0; | |
417 | ||
418 | /* We do not copy JUMP, CALL, or FRAME_RELATED for INSNs. */ | |
419 | if (GET_RTX_CLASS (code) == 'i') | |
420 | { | |
421 | copy->jump = 0; | |
422 | copy->call = 0; | |
423 | copy->frame_related = 0; | |
424 | } | |
6f29feb1 JW |
425 | |
426 | format_ptr = GET_RTX_FORMAT (GET_CODE (copy)); | |
427 | ||
428 | for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) | |
429 | { | |
430 | switch (*format_ptr++) | |
431 | { | |
432 | case 'e': | |
433 | XEXP (copy, i) = XEXP (orig, i); | |
434 | if (XEXP (orig, i) != NULL) | |
435 | XEXP (copy, i) = copy_rtx (XEXP (orig, i)); | |
436 | break; | |
437 | ||
f1027406 RK |
438 | case 'u': |
439 | XEXP (copy, i) = XEXP (orig, i); | |
440 | break; | |
441 | ||
6f29feb1 JW |
442 | case 'E': |
443 | case 'V': | |
444 | XVEC (copy, i) = XVEC (orig, i); | |
445 | if (XVEC (orig, i) != NULL) | |
446 | { | |
447 | XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); | |
448 | for (j = 0; j < XVECLEN (copy, i); j++) | |
449 | XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j)); | |
450 | } | |
451 | break; | |
452 | ||
0dfa1860 MM |
453 | case 'b': |
454 | { | |
455 | bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack); | |
456 | bitmap_copy (new_bits, XBITMAP (orig, i)); | |
457 | XBITMAP (copy, i) = new_bits; | |
458 | break; | |
459 | } | |
460 | ||
461 | case 't': | |
462 | XTREE (copy, i) = XTREE (orig, i); | |
463 | break; | |
464 | ||
c166a311 CH |
465 | case 'w': |
466 | XWINT (copy, i) = XWINT (orig, i); | |
467 | break; | |
468 | ||
469 | case 'i': | |
6f29feb1 JW |
470 | XINT (copy, i) = XINT (orig, i); |
471 | break; | |
c166a311 CH |
472 | |
473 | case 's': | |
474 | case 'S': | |
475 | XSTR (copy, i) = XSTR (orig, i); | |
476 | break; | |
477 | ||
ef178af3 ZW |
478 | case '0': |
479 | /* Copy this through the wide int field; that's safest. */ | |
480 | X0WINT (copy, i) = X0WINT (orig, i); | |
481 | break; | |
482 | ||
c166a311 CH |
483 | default: |
484 | abort (); | |
6f29feb1 JW |
485 | } |
486 | } | |
487 | return copy; | |
488 | } | |
489 | ||
490 | /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is | |
491 | placed in the result directly, rather than being copied. */ | |
492 | ||
493 | rtx | |
494 | copy_most_rtx (orig, may_share) | |
495 | register rtx orig; | |
496 | register rtx may_share; | |
497 | { | |
498 | register rtx copy; | |
499 | register int i, j; | |
500 | register RTX_CODE code; | |
6f7d635c | 501 | register const char *format_ptr; |
6f29feb1 JW |
502 | |
503 | if (orig == may_share) | |
504 | return orig; | |
505 | ||
506 | code = GET_CODE (orig); | |
507 | ||
508 | switch (code) | |
509 | { | |
510 | case REG: | |
511 | case QUEUED: | |
512 | case CONST_INT: | |
513 | case CONST_DOUBLE: | |
514 | case SYMBOL_REF: | |
515 | case CODE_LABEL: | |
516 | case PC: | |
517 | case CC0: | |
518 | return orig; | |
e9a25f70 JL |
519 | default: |
520 | break; | |
6f29feb1 JW |
521 | } |
522 | ||
523 | copy = rtx_alloc (code); | |
524 | PUT_MODE (copy, GET_MODE (orig)); | |
525 | copy->in_struct = orig->in_struct; | |
526 | copy->volatil = orig->volatil; | |
527 | copy->unchanging = orig->unchanging; | |
528 | copy->integrated = orig->integrated; | |
529 | ||
530 | format_ptr = GET_RTX_FORMAT (GET_CODE (copy)); | |
531 | ||
532 | for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) | |
533 | { | |
534 | switch (*format_ptr++) | |
535 | { | |
536 | case 'e': | |
537 | XEXP (copy, i) = XEXP (orig, i); | |
538 | if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share) | |
539 | XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share); | |
540 | break; | |
f1027406 RK |
541 | |
542 | case 'u': | |
543 | XEXP (copy, i) = XEXP (orig, i); | |
544 | break; | |
6f29feb1 JW |
545 | |
546 | case 'E': | |
547 | case 'V': | |
548 | XVEC (copy, i) = XVEC (orig, i); | |
549 | if (XVEC (orig, i) != NULL) | |
550 | { | |
551 | XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); | |
552 | for (j = 0; j < XVECLEN (copy, i); j++) | |
553 | XVECEXP (copy, i, j) | |
554 | = copy_most_rtx (XVECEXP (orig, i, j), may_share); | |
555 | } | |
556 | break; | |
557 | ||
c166a311 CH |
558 | case 'w': |
559 | XWINT (copy, i) = XWINT (orig, i); | |
560 | break; | |
561 | ||
562 | case 'n': | |
563 | case 'i': | |
6f29feb1 JW |
564 | XINT (copy, i) = XINT (orig, i); |
565 | break; | |
c166a311 | 566 | |
8f985ec4 ZW |
567 | case 't': |
568 | XTREE (copy, i) = XTREE (orig, i); | |
569 | break; | |
570 | ||
c166a311 CH |
571 | case 's': |
572 | case 'S': | |
573 | XSTR (copy, i) = XSTR (orig, i); | |
574 | break; | |
575 | ||
ef178af3 ZW |
576 | case '0': |
577 | /* Copy this through the wide int field; that's safest. */ | |
578 | X0WINT (copy, i) = X0WINT (orig, i); | |
579 | break; | |
580 | ||
c166a311 CH |
581 | default: |
582 | abort (); | |
6f29feb1 JW |
583 | } |
584 | } | |
585 | return copy; | |
586 | } | |
ce9d4c6d R |
587 | |
588 | /* Create a new copy of an rtx. Only copy just one level. */ | |
589 | rtx | |
590 | shallow_copy_rtx (orig) | |
591 | rtx orig; | |
592 | { | |
593 | register int i; | |
ce9d4c6d R |
594 | register RTX_CODE code = GET_CODE (orig); |
595 | register rtx copy = rtx_alloc (code); | |
596 | ||
597 | PUT_MODE (copy, GET_MODE (orig)); | |
598 | copy->in_struct = orig->in_struct; | |
599 | copy->volatil = orig->volatil; | |
600 | copy->unchanging = orig->unchanging; | |
601 | copy->integrated = orig->integrated; | |
602 | ||
603 | for (i = 0; i < GET_RTX_LENGTH (code); i++) | |
604 | copy->fld[i] = orig->fld[i]; | |
605 | ||
606 | return copy; | |
607 | } | |
6f29feb1 | 608 | \f |
6f29feb1 JW |
609 | /* Subroutines of read_rtx. */ |
610 | ||
611 | /* Dump code after printing a message. Used when read_rtx finds | |
612 | invalid data. */ | |
613 | ||
614 | static void | |
615 | dump_and_abort (expected_c, actual_c, infile) | |
616 | int expected_c, actual_c; | |
617 | FILE *infile; | |
618 | { | |
619 | int c, i; | |
620 | ||
621 | if (expected_c >= 0) | |
622 | fprintf (stderr, | |
623 | "Expected character %c. Found character %c.", | |
624 | expected_c, actual_c); | |
625 | fprintf (stderr, " At file position: %ld\n", ftell (infile)); | |
626 | fprintf (stderr, "Following characters are:\n\t"); | |
627 | for (i = 0; i < 200; i++) | |
628 | { | |
629 | c = getc (infile); | |
630 | if (EOF == c) break; | |
631 | putc (c, stderr); | |
632 | } | |
633 | fprintf (stderr, "Aborting.\n"); | |
634 | abort (); | |
635 | } | |
636 | ||
637 | /* Read chars from INFILE until a non-whitespace char | |
638 | and return that. Comments, both Lisp style and C style, | |
639 | are treated as whitespace. | |
640 | Tools such as genflags use this function. */ | |
641 | ||
642 | int | |
643 | read_skip_spaces (infile) | |
644 | FILE *infile; | |
645 | { | |
646 | register int c; | |
1d300e19 | 647 | while ((c = getc (infile))) |
6f29feb1 JW |
648 | { |
649 | if (c == ' ' || c == '\n' || c == '\t' || c == '\f') | |
650 | ; | |
651 | else if (c == ';') | |
652 | { | |
29cb1e1f NC |
653 | while ((c = getc (infile)) && c != '\n' && c != EOF) |
654 | ; | |
6f29feb1 JW |
655 | } |
656 | else if (c == '/') | |
657 | { | |
658 | register int prevc; | |
659 | c = getc (infile); | |
660 | if (c != '*') | |
661 | dump_and_abort ('*', c, infile); | |
662 | ||
663 | prevc = 0; | |
29cb1e1f | 664 | while ((c = getc (infile)) && c != EOF) |
6f29feb1 JW |
665 | { |
666 | if (prevc == '*' && c == '/') | |
667 | break; | |
668 | prevc = c; | |
669 | } | |
670 | } | |
671 | else break; | |
672 | } | |
673 | return c; | |
674 | } | |
675 | ||
676 | /* Read an rtx code name into the buffer STR[]. | |
677 | It is terminated by any of the punctuation chars of rtx printed syntax. */ | |
678 | ||
679 | static void | |
680 | read_name (str, infile) | |
681 | char *str; | |
682 | FILE *infile; | |
683 | { | |
684 | register char *p; | |
685 | register int c; | |
686 | ||
687 | c = read_skip_spaces(infile); | |
688 | ||
689 | p = str; | |
690 | while (1) | |
691 | { | |
692 | if (c == ' ' || c == '\n' || c == '\t' || c == '\f') | |
693 | break; | |
694 | if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/' | |
695 | || c == '(' || c == '[') | |
696 | { | |
697 | ungetc (c, infile); | |
698 | break; | |
699 | } | |
700 | *p++ = c; | |
701 | c = getc (infile); | |
702 | } | |
703 | if (p == str) | |
704 | { | |
705 | fprintf (stderr, "missing name or number"); | |
706 | dump_and_abort (-1, -1, infile); | |
707 | } | |
708 | ||
709 | *p = 0; | |
710 | } | |
711 | \f | |
cbe36725 RH |
712 | /* Provide a version of a function to read a long long if the system does |
713 | not provide one. */ | |
714 | #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ) | |
715 | HOST_WIDE_INT | |
716 | atoll(p) | |
717 | const char *p; | |
718 | { | |
719 | int neg = 0; | |
720 | HOST_WIDE_INT tmp_wide; | |
721 | ||
e9a780ec | 722 | while (ISSPACE(*p)) |
cbe36725 RH |
723 | p++; |
724 | if (*p == '-') | |
725 | neg = 1, p++; | |
726 | else if (*p == '+') | |
727 | p++; | |
728 | ||
729 | tmp_wide = 0; | |
e9a780ec | 730 | while (ISDIGIT(*p)) |
cbe36725 RH |
731 | { |
732 | HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0'); | |
733 | if (new_wide < tmp_wide) | |
734 | { | |
735 | /* Return INT_MAX equiv on overflow. */ | |
736 | tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1; | |
737 | break; | |
738 | } | |
739 | tmp_wide = new_wide; | |
740 | p++; | |
741 | } | |
742 | ||
743 | if (neg) | |
744 | tmp_wide = -tmp_wide; | |
745 | return tmp_wide; | |
746 | } | |
747 | #endif | |
748 | ||
6f29feb1 JW |
749 | /* Read an rtx in printed representation from INFILE |
750 | and return an actual rtx in core constructed accordingly. | |
751 | read_rtx is not used in the compiler proper, but rather in | |
752 | the utilities gen*.c that construct C code from machine descriptions. */ | |
753 | ||
754 | rtx | |
755 | read_rtx (infile) | |
756 | FILE *infile; | |
757 | { | |
758 | register int i, j, list_counter; | |
759 | RTX_CODE tmp_code; | |
6f7d635c | 760 | register const char *format_ptr; |
6f29feb1 JW |
761 | /* tmp_char is a buffer used for reading decimal integers |
762 | and names of rtx types and machine modes. | |
763 | Therefore, 256 must be enough. */ | |
764 | char tmp_char[256]; | |
765 | rtx return_rtx; | |
766 | register int c; | |
767 | int tmp_int; | |
c166a311 | 768 | HOST_WIDE_INT tmp_wide; |
6f29feb1 JW |
769 | |
770 | /* Linked list structure for making RTXs: */ | |
771 | struct rtx_list | |
772 | { | |
773 | struct rtx_list *next; | |
774 | rtx value; /* Value of this node... */ | |
775 | }; | |
776 | ||
777 | c = read_skip_spaces (infile); /* Should be open paren. */ | |
778 | if (c != '(') | |
779 | dump_and_abort ('(', c, infile); | |
780 | ||
781 | read_name (tmp_char, infile); | |
782 | ||
783 | tmp_code = UNKNOWN; | |
784 | ||
785 | for (i=0; i < NUM_RTX_CODE; i++) /* @@ might speed this search up */ | |
786 | { | |
787 | if (!(strcmp (tmp_char, GET_RTX_NAME (i)))) | |
788 | { | |
789 | tmp_code = (RTX_CODE) i; /* get value for name */ | |
790 | break; | |
791 | } | |
792 | } | |
793 | if (tmp_code == UNKNOWN) | |
794 | { | |
795 | fprintf (stderr, | |
796 | "Unknown rtx read in rtl.read_rtx(). Code name was %s .", | |
797 | tmp_char); | |
798 | } | |
799 | /* (NIL) stands for an expression that isn't there. */ | |
800 | if (tmp_code == NIL) | |
801 | { | |
802 | /* Discard the closeparen. */ | |
803 | while ((c = getc (infile)) && c != ')'); | |
804 | return 0; | |
805 | } | |
806 | ||
807 | return_rtx = rtx_alloc (tmp_code); /* if we end up with an insn expression | |
808 | then we free this space below. */ | |
809 | format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx)); | |
810 | ||
811 | /* If what follows is `: mode ', read it and | |
812 | store the mode in the rtx. */ | |
813 | ||
814 | i = read_skip_spaces (infile); | |
815 | if (i == ':') | |
816 | { | |
817 | register int k; | |
818 | read_name (tmp_char, infile); | |
819 | for (k = 0; k < NUM_MACHINE_MODES; k++) | |
820 | if (!strcmp (GET_MODE_NAME (k), tmp_char)) | |
821 | break; | |
822 | ||
823 | PUT_MODE (return_rtx, (enum machine_mode) k ); | |
824 | } | |
825 | else | |
826 | ungetc (i, infile); | |
827 | ||
828 | for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++) | |
829 | switch (*format_ptr++) | |
830 | { | |
831 | /* 0 means a field for internal use only. | |
832 | Don't expect it to be present in the input. */ | |
833 | case '0': | |
834 | break; | |
835 | ||
836 | case 'e': | |
837 | case 'u': | |
838 | XEXP (return_rtx, i) = read_rtx (infile); | |
839 | break; | |
840 | ||
841 | case 'V': | |
842 | /* 'V' is an optional vector: if a closeparen follows, | |
843 | just store NULL for this element. */ | |
844 | c = read_skip_spaces (infile); | |
845 | ungetc (c, infile); | |
846 | if (c == ')') | |
847 | { | |
848 | XVEC (return_rtx, i) = 0; | |
849 | break; | |
850 | } | |
851 | /* Now process the vector. */ | |
852 | ||
853 | case 'E': | |
854 | { | |
855 | register struct rtx_list *next_rtx, *rtx_list_link; | |
4399e7a3 | 856 | struct rtx_list *list_rtx = NULL; |
6f29feb1 JW |
857 | |
858 | c = read_skip_spaces (infile); | |
859 | if (c != '[') | |
860 | dump_and_abort ('[', c, infile); | |
861 | ||
862 | /* add expressions to a list, while keeping a count */ | |
863 | next_rtx = NULL; | |
864 | list_counter = 0; | |
865 | while ((c = read_skip_spaces (infile)) && c != ']') | |
866 | { | |
867 | ungetc (c, infile); | |
868 | list_counter++; | |
869 | rtx_list_link = (struct rtx_list *) | |
870 | alloca (sizeof (struct rtx_list)); | |
871 | rtx_list_link->value = read_rtx (infile); | |
872 | if (next_rtx == 0) | |
873 | list_rtx = rtx_list_link; | |
874 | else | |
875 | next_rtx->next = rtx_list_link; | |
876 | next_rtx = rtx_list_link; | |
877 | rtx_list_link->next = 0; | |
878 | } | |
879 | /* get vector length and allocate it */ | |
880 | XVEC (return_rtx, i) = (list_counter | |
c166a311 | 881 | ? rtvec_alloc (list_counter) : NULL_RTVEC); |
6f29feb1 JW |
882 | if (list_counter > 0) |
883 | { | |
884 | next_rtx = list_rtx; | |
885 | for (j = 0; j < list_counter; j++, | |
886 | next_rtx = next_rtx->next) | |
887 | XVECEXP (return_rtx, i, j) = next_rtx->value; | |
888 | } | |
889 | /* close bracket gotten */ | |
890 | } | |
891 | break; | |
892 | ||
893 | case 'S': | |
894 | /* 'S' is an optional string: if a closeparen follows, | |
895 | just store NULL for this element. */ | |
896 | c = read_skip_spaces (infile); | |
897 | ungetc (c, infile); | |
898 | if (c == ')') | |
899 | { | |
900 | XSTR (return_rtx, i) = 0; | |
901 | break; | |
902 | } | |
903 | ||
904 | case 's': | |
905 | { | |
906 | int saw_paren = 0; | |
907 | register char *stringbuf; | |
6f29feb1 JW |
908 | |
909 | c = read_skip_spaces (infile); | |
910 | if (c == '(') | |
911 | { | |
912 | saw_paren = 1; | |
913 | c = read_skip_spaces (infile); | |
914 | } | |
915 | if (c != '"') | |
916 | dump_and_abort ('"', c, infile); | |
6f29feb1 JW |
917 | |
918 | while (1) | |
919 | { | |
2dcb563f RS |
920 | c = getc (infile); /* Read the string */ |
921 | if (c == '\\') | |
6f29feb1 | 922 | { |
2dcb563f | 923 | c = getc (infile); /* Read the string */ |
6f29feb1 JW |
924 | /* \; makes stuff for a C string constant containing |
925 | newline and tab. */ | |
2dcb563f | 926 | if (c == ';') |
81dd58a6 RS |
927 | { |
928 | obstack_grow (rtl_obstack, "\\n\\t", 4); | |
929 | continue; | |
930 | } | |
6f29feb1 | 931 | } |
2dcb563f | 932 | else if (c == '"') |
6f29feb1 | 933 | break; |
2dcb563f RS |
934 | |
935 | obstack_1grow (rtl_obstack, c); | |
6f29feb1 JW |
936 | } |
937 | ||
2dcb563f RS |
938 | obstack_1grow (rtl_obstack, 0); |
939 | stringbuf = (char *) obstack_finish (rtl_obstack); | |
6f29feb1 JW |
940 | |
941 | if (saw_paren) | |
942 | { | |
943 | c = read_skip_spaces (infile); | |
944 | if (c != ')') | |
945 | dump_and_abort (')', c, infile); | |
946 | } | |
947 | XSTR (return_rtx, i) = stringbuf; | |
948 | } | |
949 | break; | |
950 | ||
c166a311 CH |
951 | case 'w': |
952 | read_name (tmp_char, infile); | |
953 | #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT | |
954 | tmp_wide = atoi (tmp_char); | |
955 | #else | |
76d31c63 | 956 | #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG |
c166a311 | 957 | tmp_wide = atol (tmp_char); |
76d31c63 | 958 | #else |
cbe36725 RH |
959 | /* Prefer atoll over atoq, since the former is in the ISO C9X draft. |
960 | But prefer not to use our hand-rolled function above either. */ | |
961 | #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ) | |
c5afbb49 JL |
962 | tmp_wide = atoll (tmp_char); |
963 | #else | |
76d31c63 JL |
964 | tmp_wide = atoq (tmp_char); |
965 | #endif | |
c5afbb49 | 966 | #endif |
c166a311 CH |
967 | #endif |
968 | XWINT (return_rtx, i) = tmp_wide; | |
969 | break; | |
970 | ||
6f29feb1 JW |
971 | case 'i': |
972 | case 'n': | |
973 | read_name (tmp_char, infile); | |
974 | tmp_int = atoi (tmp_char); | |
975 | XINT (return_rtx, i) = tmp_int; | |
976 | break; | |
977 | ||
978 | default: | |
979 | fprintf (stderr, | |
980 | "switch format wrong in rtl.read_rtx(). format was: %c.\n", | |
981 | format_ptr[-1]); | |
982 | fprintf (stderr, "\tfile position: %ld\n", ftell (infile)); | |
983 | abort (); | |
984 | } | |
985 | ||
986 | c = read_skip_spaces (infile); | |
987 | if (c != ')') | |
988 | dump_and_abort (')', c, infile); | |
989 | ||
990 | return return_rtx; | |
991 | } | |
987009bf | 992 | |
ef178af3 ZW |
993 | #if defined ENABLE_CHECKING && (__GNUC__ > 2 || __GNUC_MINOR__ > 6) |
994 | void | |
995 | rtl_check_failed_bounds (r, n, file, line, func) | |
996 | rtx r; | |
997 | int n; | |
998 | const char *file; | |
999 | int line; | |
1000 | const char *func; | |
1001 | { | |
1002 | error ("RTL check: access of elt %d of `%s' with last elt %d", | |
1003 | n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r))-1); | |
1004 | fancy_abort (file, line, func); | |
1005 | } | |
1006 | ||
1007 | void | |
1008 | rtl_check_failed_type1 (r, n, c1, file, line, func) | |
1009 | rtx r; | |
1010 | int n; | |
1011 | int c1; | |
1012 | const char *file; | |
1013 | int line; | |
1014 | const char *func; | |
1015 | { | |
1016 | error ("RTL check: expected elt %d type '%c', have '%c' (rtx %s)", | |
1017 | n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r))); | |
1018 | fancy_abort (file, line, func); | |
1019 | } | |
1020 | ||
1021 | void | |
1022 | rtl_check_failed_type2 (r, n, c1, c2, file, line, func) | |
1023 | rtx r; | |
1024 | int n; | |
1025 | int c1; | |
1026 | int c2; | |
1027 | const char *file; | |
1028 | int line; | |
1029 | const char *func; | |
1030 | { | |
1031 | error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s)", | |
1032 | n, c1, c2, | |
1033 | GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE(r))); | |
1034 | fancy_abort (file, line, func); | |
1035 | } | |
1036 | ||
83ab3839 RH |
1037 | void |
1038 | rtl_check_failed_code1 (r, code, file, line, func) | |
1039 | rtx r; | |
1040 | enum rtx_code code; | |
1041 | const char *file; | |
1042 | int line; | |
1043 | const char *func; | |
1044 | { | |
1045 | error ("RTL check: expected code `%s', have `%s'", | |
1046 | GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r))); | |
1047 | fancy_abort (file, line, func); | |
1048 | } | |
1049 | ||
1050 | void | |
1051 | rtl_check_failed_code2 (r, code1, code2, file, line, func) | |
1052 | rtx r; | |
1053 | enum rtx_code code1, code2; | |
1054 | const char *file; | |
1055 | int line; | |
1056 | const char *func; | |
1057 | { | |
1058 | error ("RTL check: expected code `%s' or `%s', have `%s'", | |
1059 | GET_RTX_NAME (code1), GET_RTX_NAME (code2), | |
1060 | GET_RTX_NAME (GET_CODE (r))); | |
1061 | fancy_abort (file, line, func); | |
1062 | } | |
1063 | ||
ef178af3 ZW |
1064 | /* XXX Maybe print the vector? */ |
1065 | void | |
1066 | rtvec_check_failed_bounds (r, n, file, line, func) | |
1067 | rtvec r; | |
1068 | int n; | |
1069 | const char *file; | |
1070 | int line; | |
1071 | const char *func; | |
1072 | { | |
1073 | error ("RTL check: access of elt %d of vector with last elt %d", | |
1074 | n, GET_NUM_ELEM (r)-1); | |
1075 | fancy_abort (file, line, func); | |
1076 | } | |
1077 | #endif /* ENABLE_CHECKING */ | |
1078 | ||
987009bf ZW |
1079 | /* These are utility functions used by fatal-error functions all over the |
1080 | code. rtl.c happens to be linked by all the programs that need them, | |
1081 | so these are here. In the future we want to break out all error handling | |
1082 | to its own module. */ | |
1083 | ||
1084 | /* Given a partial pathname as input, return another pathname that | |
1085 | shares no directory elements with the pathname of __FILE__. This | |
1086 | is used by fancy_abort() to print `Internal compiler error in expr.c' | |
1087 | instead of `Internal compiler error in ../../egcs/gcc/expr.c'. */ | |
1088 | static const char * | |
1089 | trim_filename (name) | |
1090 | const char *name; | |
1091 | { | |
aa0b4465 | 1092 | static const char this_file[] = __FILE__; |
987009bf ZW |
1093 | const char *p = name, *q = this_file; |
1094 | ||
1095 | while (*p == *q && *p != 0 && *q != 0) p++, q++; | |
1096 | while (p > name && p[-1] != DIR_SEPARATOR | |
1097 | #ifdef DIR_SEPARATOR_2 | |
1098 | && p[-1] != DIR_SEPARATOR_2 | |
1099 | #endif | |
1100 | ) | |
1101 | p--; | |
1102 | ||
1103 | return p; | |
1104 | } | |
1105 | ||
1106 | /* Report an internal compiler error in a friendly manner and without | |
ef178af3 | 1107 | dumping core. */ |
987009bf ZW |
1108 | |
1109 | extern void fatal PVPROTO ((const char *, ...)) | |
ef178af3 | 1110 | ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; |
987009bf ZW |
1111 | |
1112 | void | |
1113 | fancy_abort (file, line, function) | |
1114 | const char *file; | |
1115 | int line; | |
1116 | const char *function; | |
1117 | { | |
1118 | if (function == NULL) | |
1119 | function = "?"; | |
1120 | fatal ( | |
1121 | "Internal compiler error in `%s', at %s:%d\n\ | |
1122 | Please submit a full bug report.\n\ | |
1123 | See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> \ | |
1124 | for instructions.", | |
1125 | function, trim_filename (file), line); | |
1126 | } |