]>
Commit | Line | Data |
---|---|---|
e1a79915 | 1 | /* Print RTL for GNU C Compiler. |
9311a396 | 2 | Copyright (C) 1987, 1988, 1992, 1997, 1998, 1999, 2000 |
c5c76735 | 3 | Free Software Foundation, Inc. |
e1a79915 RS |
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. */ | |
e1a79915 RS |
21 | |
22 | ||
23 | #include "config.h" | |
670ee920 | 24 | #include "system.h" |
e1a79915 | 25 | #include "rtl.h" |
800d5c9e | 26 | #include "real.h" |
b707b450 | 27 | #include "flags.h" |
efc9bd41 | 28 | #include "hard-reg-set.h" |
e881bb1b | 29 | #include "basic-block.h" |
e1a79915 | 30 | |
cf99a734 RS |
31 | /* How to print out a register name. |
32 | We don't use PRINT_REG because some definitions of PRINT_REG | |
33 | don't work here. */ | |
34 | #ifndef DEBUG_PRINT_REG | |
35 | #define DEBUG_PRINT_REG(RTX, CODE, FILE) \ | |
36 | fprintf ((FILE), "%d %s", REGNO (RTX), reg_names[REGNO (RTX)]) | |
37 | #endif | |
38 | ||
39 | /* Array containing all of the register names */ | |
40 | ||
41 | #ifdef DEBUG_REGISTER_NAMES | |
fbd40359 ZW |
42 | static const char * const debug_reg_names[] = DEBUG_REGISTER_NAMES; |
43 | #define reg_names debug_reg_names | |
cf99a734 | 44 | #else |
e087aeb2 | 45 | const char * reg_names[] = REGISTER_NAMES; |
cf99a734 RS |
46 | #endif |
47 | ||
e1a79915 RS |
48 | static FILE *outfile; |
49 | ||
2778b98d | 50 | static const char xspaces[] = " "; |
e1a79915 RS |
51 | |
52 | static int sawclose = 0; | |
53 | ||
1d79197a RK |
54 | static int indent; |
55 | ||
957e4763 | 56 | static void print_rtx PARAMS ((rtx)); |
5edc9230 | 57 | |
b707b450 R |
58 | /* Nonzero means suppress output of instruction numbers and line number |
59 | notes in debugging dumps. | |
60 | This must be defined here so that programs like gencodes can be linked. */ | |
9ec36da5 | 61 | int flag_dump_unnumbered = 0; |
b707b450 | 62 | |
735a0e33 UD |
63 | /* Nonzero if we are dumping graphical description. */ |
64 | int dump_for_graph; | |
65 | ||
e1a79915 RS |
66 | /* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */ |
67 | ||
68 | static void | |
69 | print_rtx (in_rtx) | |
70 | register rtx in_rtx; | |
71 | { | |
735a0e33 UD |
72 | register int i = 0; |
73 | register int j; | |
6f7d635c | 74 | register const char *format_ptr; |
e1a79915 | 75 | register int is_insn; |
c3c63936 | 76 | rtx tem; |
e1a79915 RS |
77 | |
78 | if (sawclose) | |
79 | { | |
80 | fprintf (outfile, "\n%s", | |
2778b98d | 81 | (xspaces + (sizeof xspaces - 1 - indent * 2))); |
e1a79915 RS |
82 | sawclose = 0; |
83 | } | |
84 | ||
85 | if (in_rtx == 0) | |
86 | { | |
735a0e33 | 87 | fputs ("(nil)", outfile); |
e1a79915 RS |
88 | sawclose = 1; |
89 | return; | |
90 | } | |
91 | ||
2c3c49de | 92 | is_insn = (INSN_P (in_rtx)); |
735a0e33 UD |
93 | |
94 | /* When printing in VCG format we write INSNs, NOTE, LABEL, and BARRIER | |
95 | in separate nodes and therefore have to handle them special here. */ | |
96 | if (dump_for_graph && | |
97 | (is_insn || GET_CODE (in_rtx) == NOTE || GET_CODE (in_rtx) == CODE_LABEL | |
98 | || GET_CODE (in_rtx) == BARRIER)) | |
99 | { | |
100 | i = 3; | |
101 | indent = 0; | |
102 | } | |
103 | else | |
104 | { | |
105 | /* print name of expression code */ | |
106 | fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx))); | |
e1a79915 | 107 | |
735a0e33 UD |
108 | if (in_rtx->in_struct) |
109 | fputs ("/s", outfile); | |
e1a79915 | 110 | |
735a0e33 UD |
111 | if (in_rtx->volatil) |
112 | fputs ("/v", outfile); | |
e1a79915 | 113 | |
735a0e33 UD |
114 | if (in_rtx->unchanging) |
115 | fputs ("/u", outfile); | |
e1a79915 | 116 | |
735a0e33 UD |
117 | if (in_rtx->integrated) |
118 | fputs ("/i", outfile); | |
e1a79915 | 119 | |
c6df88cb MM |
120 | if (in_rtx->frame_related) |
121 | fputs ("/f", outfile); | |
122 | ||
5a25c64c JL |
123 | if (in_rtx->jump) |
124 | fputs ("/j", outfile); | |
125 | ||
126 | if (in_rtx->call) | |
127 | fputs ("/c", outfile); | |
128 | ||
735a0e33 UD |
129 | if (GET_MODE (in_rtx) != VOIDmode) |
130 | { | |
131 | /* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */ | |
132 | if (GET_CODE (in_rtx) == EXPR_LIST || GET_CODE (in_rtx) == INSN_LIST) | |
133 | fprintf (outfile, ":%s", GET_REG_NOTE_NAME (GET_MODE (in_rtx))); | |
134 | else | |
135 | fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx))); | |
136 | } | |
e1a79915 RS |
137 | } |
138 | ||
735a0e33 UD |
139 | /* Get the format string and skip the first elements if we have handled |
140 | them already. */ | |
141 | format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)) + i; | |
e1a79915 | 142 | |
735a0e33 | 143 | for (; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++) |
e1a79915 RS |
144 | switch (*format_ptr++) |
145 | { | |
146 | case 'S': | |
147 | case 's': | |
148 | if (XSTR (in_rtx, i) == 0) | |
735a0e33 | 149 | fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile); |
e1a79915 | 150 | else |
913d0833 KG |
151 | { |
152 | if (dump_for_graph) | |
153 | fprintf (outfile, " (\\\"%s\\\")", XSTR (in_rtx, i)); | |
154 | else | |
155 | fprintf (outfile, " (\"%s\")", XSTR (in_rtx, i)); | |
156 | } | |
e1a79915 RS |
157 | sawclose = 1; |
158 | break; | |
159 | ||
8f985ec4 ZW |
160 | /* 0 indicates a field for internal use that should not be printed. |
161 | An exception is the third field of a NOTE, where it indicates | |
162 | that the field has several different valid contents. */ | |
e1a79915 | 163 | case '0': |
8f985ec4 ZW |
164 | if (i == 3 && GET_CODE (in_rtx) == NOTE) |
165 | { | |
994a57cd | 166 | switch (NOTE_LINE_NUMBER (in_rtx)) |
bf43101e | 167 | { |
994a57cd RH |
168 | case NOTE_INSN_EH_REGION_BEG: |
169 | case NOTE_INSN_EH_REGION_END: | |
f76ca83c GK |
170 | if (flag_dump_unnumbered) |
171 | fprintf (outfile, " #"); | |
172 | else | |
173 | fprintf (outfile, " %d", NOTE_EH_HANDLER (in_rtx)); | |
bf43101e | 174 | sawclose = 1; |
994a57cd RH |
175 | break; |
176 | ||
177 | case NOTE_INSN_BLOCK_BEG: | |
178 | case NOTE_INSN_BLOCK_END: | |
1a4450c7 | 179 | fprintf (outfile, " "); |
f76ca83c GK |
180 | if (flag_dump_unnumbered) |
181 | fprintf (outfile, "#"); | |
182 | else | |
183 | fprintf (outfile, HOST_PTR_PRINTF, | |
184 | (char *) NOTE_BLOCK (in_rtx)); | |
8f985ec4 | 185 | sawclose = 1; |
994a57cd RH |
186 | break; |
187 | ||
b3b42a4d | 188 | case NOTE_INSN_RANGE_BEG: |
994a57cd RH |
189 | case NOTE_INSN_RANGE_END: |
190 | case NOTE_INSN_LIVE: | |
8f985ec4 ZW |
191 | indent += 2; |
192 | if (!sawclose) | |
193 | fprintf (outfile, " "); | |
194 | print_rtx (NOTE_RANGE_INFO (in_rtx)); | |
195 | indent -= 2; | |
994a57cd | 196 | break; |
4c1545e4 | 197 | |
994a57cd RH |
198 | case NOTE_INSN_BASIC_BLOCK: |
199 | { | |
200 | basic_block bb = NOTE_BASIC_BLOCK (in_rtx); | |
201 | if (bb != 0) | |
202 | fprintf (outfile, " [bb %d]", bb->index); | |
203 | break; | |
204 | } | |
205 | ||
206 | case NOTE_INSN_EXPECTED_VALUE: | |
207 | indent += 2; | |
208 | if (!sawclose) | |
209 | fprintf (outfile, " "); | |
210 | print_rtx (NOTE_EXPECTED_VALUE (in_rtx)); | |
211 | indent -= 2; | |
212 | break; | |
213 | ||
be1bb652 RH |
214 | case NOTE_INSN_DELETED_LABEL: |
215 | if (NOTE_SOURCE_FILE (in_rtx)) | |
216 | fprintf (outfile, " (\"%s\")", NOTE_SOURCE_FILE (in_rtx)); | |
217 | else | |
218 | fprintf (outfile, " \"\""); | |
219 | break; | |
220 | ||
994a57cd RH |
221 | default: |
222 | { | |
223 | const char * const str = X0STR (in_rtx, i); | |
224 | ||
225 | if (NOTE_LINE_NUMBER (in_rtx) < 0) | |
226 | ; | |
227 | else if (str == 0) | |
228 | fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile); | |
229 | else | |
230 | { | |
231 | if (dump_for_graph) | |
232 | fprintf (outfile, " (\\\"%s\\\")", str); | |
233 | else | |
234 | fprintf (outfile, " (\"%s\")", str); | |
235 | } | |
236 | break; | |
237 | } | |
8f985ec4 ZW |
238 | } |
239 | } | |
e1a79915 RS |
240 | break; |
241 | ||
242 | case 'e': | |
bcdaba58 | 243 | do_e: |
e1a79915 RS |
244 | indent += 2; |
245 | if (!sawclose) | |
246 | fprintf (outfile, " "); | |
247 | print_rtx (XEXP (in_rtx, i)); | |
248 | indent -= 2; | |
249 | break; | |
250 | ||
251 | case 'E': | |
252 | case 'V': | |
253 | indent += 2; | |
254 | if (sawclose) | |
255 | { | |
256 | fprintf (outfile, "\n%s", | |
2778b98d | 257 | (xspaces + (sizeof xspaces - 1 - indent * 2))); |
e1a79915 RS |
258 | sawclose = 0; |
259 | } | |
735a0e33 | 260 | fputs ("[ ", outfile); |
e1a79915 RS |
261 | if (NULL != XVEC (in_rtx, i)) |
262 | { | |
263 | indent += 2; | |
264 | if (XVECLEN (in_rtx, i)) | |
265 | sawclose = 1; | |
266 | ||
267 | for (j = 0; j < XVECLEN (in_rtx, i); j++) | |
268 | print_rtx (XVECEXP (in_rtx, i, j)); | |
269 | ||
270 | indent -= 2; | |
271 | } | |
272 | if (sawclose) | |
273 | fprintf (outfile, "\n%s", | |
2778b98d | 274 | (xspaces + (sizeof xspaces - 1 - indent * 2))); |
e1a79915 | 275 | |
735a0e33 | 276 | fputs ("] ", outfile); |
e1a79915 RS |
277 | sawclose = 1; |
278 | indent -= 2; | |
279 | break; | |
280 | ||
5bf665df | 281 | case 'w': |
734de8c8 RK |
282 | fprintf (outfile, " "); |
283 | fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i)); | |
7b028dba NC |
284 | fprintf (outfile, " ["); |
285 | fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, XWINT (in_rtx, i)); | |
286 | fprintf (outfile, "]"); | |
5bf665df RK |
287 | break; |
288 | ||
e1a79915 | 289 | case 'i': |
cf99a734 RS |
290 | { |
291 | register int value = XINT (in_rtx, i); | |
a995e389 | 292 | const char *name; |
cf99a734 RS |
293 | |
294 | if (GET_CODE (in_rtx) == REG && value < FIRST_PSEUDO_REGISTER) | |
295 | { | |
296 | fputc (' ', outfile); | |
297 | DEBUG_PRINT_REG (in_rtx, 0, outfile); | |
298 | } | |
a6c7a886 MM |
299 | else if (GET_CODE (in_rtx) == REG && value <= LAST_VIRTUAL_REGISTER) |
300 | { | |
301 | if (value == VIRTUAL_INCOMING_ARGS_REGNUM) | |
302 | fprintf (outfile, " %d virtual-incoming-args", value); | |
303 | else if (value == VIRTUAL_STACK_VARS_REGNUM) | |
304 | fprintf (outfile, " %d virtual-stack-vars", value); | |
305 | else if (value == VIRTUAL_STACK_DYNAMIC_REGNUM) | |
306 | fprintf (outfile, " %d virtual-stack-dynamic", value); | |
307 | else if (value == VIRTUAL_OUTGOING_ARGS_REGNUM) | |
308 | fprintf (outfile, " %d virtual-outgoing-args", value); | |
309 | else if (value == VIRTUAL_CFA_REGNUM) | |
310 | fprintf (outfile, " %d virtual-cfa", value); | |
311 | else | |
312 | fprintf (outfile, " %d virtual-reg-%d", value, | |
313 | value-FIRST_VIRTUAL_REGISTER); | |
314 | } | |
9ec36da5 JL |
315 | else if (flag_dump_unnumbered |
316 | && (is_insn || GET_CODE (in_rtx) == NOTE)) | |
735a0e33 | 317 | fputc ('#', outfile); |
cf99a734 RS |
318 | else |
319 | fprintf (outfile, " %d", value); | |
a995e389 RH |
320 | |
321 | if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i) | |
322 | && XINT (in_rtx, i) >= 0 | |
323 | && (name = get_insn_name (XINT (in_rtx, i))) != NULL) | |
324 | fprintf (outfile, " {%s}", name); | |
325 | sawclose = 0; | |
cf99a734 | 326 | } |
e1a79915 RS |
327 | break; |
328 | ||
329 | /* Print NOTE_INSN names rather than integer codes. */ | |
330 | ||
331 | case 'n': | |
21835d9b JJ |
332 | if (XINT (in_rtx, i) >= NOTE_INSN_BIAS |
333 | && XINT (in_rtx, i) < NOTE_INSN_MAX) | |
e1a79915 RS |
334 | fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i))); |
335 | else | |
336 | fprintf (outfile, " %d", XINT (in_rtx, i)); | |
337 | sawclose = 0; | |
338 | break; | |
339 | ||
340 | case 'u': | |
341 | if (XEXP (in_rtx, i) != NULL) | |
9ec36da5 | 342 | { |
556ffcc5 RH |
343 | rtx sub = XEXP (in_rtx, i); |
344 | enum rtx_code subc = GET_CODE (sub); | |
345 | ||
be1bb652 RH |
346 | if (GET_CODE (in_rtx) == LABEL_REF) |
347 | { | |
348 | if (subc == NOTE | |
349 | && NOTE_LINE_NUMBER (sub) == NOTE_INSN_DELETED_LABEL) | |
350 | { | |
351 | if (flag_dump_unnumbered) | |
352 | fprintf (outfile, " [# deleted]"); | |
353 | else | |
354 | fprintf (outfile, " [%d deleted]", INSN_UID (sub)); | |
355 | sawclose = 0; | |
356 | break; | |
357 | } | |
358 | ||
359 | if (subc != CODE_LABEL) | |
360 | goto do_e; | |
361 | } | |
bcdaba58 | 362 | |
9ec36da5 | 363 | if (flag_dump_unnumbered) |
be1bb652 | 364 | fputs (" #", outfile); |
9ec36da5 | 365 | else |
556ffcc5 | 366 | fprintf (outfile, " %d", INSN_UID (sub)); |
9ec36da5 | 367 | } |
e1a79915 | 368 | else |
d5e3e85b | 369 | fputs (" 0", outfile); |
d64be5ec CH |
370 | sawclose = 0; |
371 | break; | |
372 | ||
0dfa1860 MM |
373 | case 'b': |
374 | if (XBITMAP (in_rtx, i) == NULL) | |
735a0e33 | 375 | fputs (" {null}", outfile); |
0dfa1860 MM |
376 | else |
377 | bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}"); | |
378 | sawclose = 0; | |
379 | break; | |
380 | ||
381 | case 't': | |
382 | putc (' ', outfile); | |
c6b0465b | 383 | fprintf (outfile, HOST_PTR_PRINTF, (char *) XTREE (in_rtx, i)); |
0dfa1860 MM |
384 | break; |
385 | ||
d64be5ec | 386 | case '*': |
735a0e33 | 387 | fputs (" Unknown", outfile); |
e1a79915 RS |
388 | sawclose = 0; |
389 | break; | |
390 | ||
391 | default: | |
392 | fprintf (stderr, | |
393 | "switch format wrong in rtl.print_rtx(). format was: %c.\n", | |
394 | format_ptr[-1]); | |
395 | abort (); | |
396 | } | |
397 | ||
be1bb652 RH |
398 | switch (GET_CODE (in_rtx)) |
399 | { | |
400 | case MEM: | |
f6a0cc96 | 401 | fputc (' ', outfile); |
c5588504 | 402 | fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, MEM_ALIAS_SET (in_rtx)); |
be1bb652 | 403 | break; |
5a0a1a66 | 404 | |
4710d3eb | 405 | #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && MAX_LONG_DOUBLE_TYPE_SIZE == 64 |
be1bb652 RH |
406 | case CONST_DOUBLE: |
407 | if (FLOAT_MODE_P (GET_MODE (in_rtx))) | |
408 | { | |
409 | double val; | |
410 | REAL_VALUE_FROM_CONST_DOUBLE (val, in_rtx); | |
411 | fprintf (outfile, " [%.16g]", val); | |
412 | } | |
413 | break; | |
800d5c9e RH |
414 | #endif |
415 | ||
be1bb652 | 416 | case CODE_LABEL: |
c3c63936 | 417 | fprintf (outfile, " [%d uses]", LABEL_NUSES (in_rtx)); |
8cd0faaf | 418 | if (LABEL_ALTERNATE_NAME (in_rtx)) |
c3c63936 RK |
419 | fprintf (outfile, " [alternate name: %s]", |
420 | LABEL_ALTERNATE_NAME (in_rtx)); | |
be1bb652 RH |
421 | break; |
422 | ||
423 | case CALL_PLACEHOLDER: | |
424 | for (tem = XEXP (in_rtx, 0); tem != 0; tem = NEXT_INSN (tem)) | |
425 | if (GET_CODE (tem) == CALL_INSN) | |
426 | { | |
427 | fprintf (outfile, " "); | |
428 | print_rtx (tem); | |
429 | break; | |
430 | } | |
431 | break; | |
432 | ||
433 | default: | |
434 | break; | |
8cd0faaf | 435 | } |
c3c63936 | 436 | |
735a0e33 UD |
437 | if (dump_for_graph |
438 | && (is_insn || GET_CODE (in_rtx) == NOTE | |
439 | || GET_CODE (in_rtx) == CODE_LABEL || GET_CODE (in_rtx) == BARRIER)) | |
440 | sawclose = 0; | |
441 | else | |
442 | { | |
443 | fputc (')', outfile); | |
444 | sawclose = 1; | |
445 | } | |
e1a79915 RS |
446 | } |
447 | ||
1d79197a RK |
448 | /* Print an rtx on the current line of FILE. Initially indent IND |
449 | characters. */ | |
450 | ||
451 | void | |
452 | print_inline_rtx (outf, x, ind) | |
453 | FILE *outf; | |
454 | rtx x; | |
9870475c | 455 | int ind; |
1d79197a | 456 | { |
956d6950 JL |
457 | int oldsaw = sawclose; |
458 | int oldindent = indent; | |
459 | ||
1d79197a RK |
460 | sawclose = 0; |
461 | indent = ind; | |
462 | outfile = outf; | |
463 | print_rtx (x); | |
956d6950 JL |
464 | sawclose = oldsaw; |
465 | indent = oldindent; | |
1d79197a RK |
466 | } |
467 | ||
e1a79915 RS |
468 | /* Call this function from the debugger to see what X looks like. */ |
469 | ||
470 | void | |
471 | debug_rtx (x) | |
472 | rtx x; | |
473 | { | |
474 | outfile = stderr; | |
475 | print_rtx (x); | |
476 | fprintf (stderr, "\n"); | |
477 | } | |
478 | ||
716f003f DE |
479 | /* Count of rtx's to print with debug_rtx_list. |
480 | This global exists because gdb user defined commands have no arguments. */ | |
481 | ||
482 | int debug_rtx_count = 0; /* 0 is treated as equivalent to 1 */ | |
483 | ||
484 | /* Call this function to print list from X on. | |
485 | ||
486 | N is a count of the rtx's to print. Positive values print from the specified | |
487 | rtx on. Negative values print a window around the rtx. | |
488 | EG: -5 prints 2 rtx's on either side (in addition to the specified rtx). */ | |
489 | ||
490 | void | |
491 | debug_rtx_list (x, n) | |
492 | rtx x; | |
493 | int n; | |
494 | { | |
495 | int i,count; | |
496 | rtx insn; | |
497 | ||
498 | count = n == 0 ? 1 : n < 0 ? -n : n; | |
499 | ||
500 | /* If we are printing a window, back up to the start. */ | |
501 | ||
502 | if (n < 0) | |
503 | for (i = count / 2; i > 0; i--) | |
504 | { | |
505 | if (PREV_INSN (x) == 0) | |
506 | break; | |
507 | x = PREV_INSN (x); | |
508 | } | |
509 | ||
510 | for (i = count, insn = x; i > 0 && insn != 0; i--, insn = NEXT_INSN (insn)) | |
511 | debug_rtx (insn); | |
512 | } | |
513 | ||
4c85a96d RH |
514 | /* Call this function to print an rtx list from START to END inclusive. */ |
515 | ||
516 | void | |
517 | debug_rtx_range (start, end) | |
518 | rtx start, end; | |
519 | { | |
520 | while (1) | |
521 | { | |
522 | debug_rtx (start); | |
523 | if (!start || start == end) | |
524 | break; | |
525 | start = NEXT_INSN (start); | |
526 | } | |
527 | } | |
528 | ||
716f003f DE |
529 | /* Call this function to search an rtx list to find one with insn uid UID, |
530 | and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT. | |
531 | The found insn is returned to enable further debugging analysis. */ | |
532 | ||
533 | rtx | |
1d79197a | 534 | debug_rtx_find (x, uid) |
716f003f DE |
535 | rtx x; |
536 | int uid; | |
537 | { | |
538 | while (x != 0 && INSN_UID (x) != uid) | |
539 | x = NEXT_INSN (x); | |
540 | if (x != 0) | |
541 | { | |
542 | debug_rtx_list (x, debug_rtx_count); | |
543 | return x; | |
544 | } | |
545 | else | |
546 | { | |
547 | fprintf (stderr, "insn uid %d not found\n", uid); | |
548 | return 0; | |
549 | } | |
550 | } | |
551 | ||
e1a79915 RS |
552 | /* External entry point for printing a chain of insns |
553 | starting with RTX_FIRST onto file OUTF. | |
554 | A blank line separates insns. | |
555 | ||
556 | If RTX_FIRST is not an insn, then it alone is printed, with no newline. */ | |
557 | ||
558 | void | |
559 | print_rtl (outf, rtx_first) | |
560 | FILE *outf; | |
561 | rtx rtx_first; | |
562 | { | |
563 | register rtx tmp_rtx; | |
564 | ||
565 | outfile = outf; | |
566 | sawclose = 0; | |
567 | ||
568 | if (rtx_first == 0) | |
735a0e33 | 569 | fputs ("(nil)\n", outf); |
e1a79915 RS |
570 | else |
571 | switch (GET_CODE (rtx_first)) | |
572 | { | |
573 | case INSN: | |
574 | case JUMP_INSN: | |
575 | case CALL_INSN: | |
576 | case NOTE: | |
577 | case CODE_LABEL: | |
578 | case BARRIER: | |
c3c63936 RK |
579 | for (tmp_rtx = rtx_first; tmp_rtx != 0; tmp_rtx = NEXT_INSN (tmp_rtx)) |
580 | if (! flag_dump_unnumbered | |
581 | || GET_CODE (tmp_rtx) != NOTE || NOTE_LINE_NUMBER (tmp_rtx) < 0) | |
582 | { | |
583 | print_rtx (tmp_rtx); | |
584 | fprintf (outfile, "\n"); | |
585 | } | |
e1a79915 RS |
586 | break; |
587 | ||
588 | default: | |
589 | print_rtx (rtx_first); | |
590 | } | |
591 | } | |
3e28fe44 MM |
592 | |
593 | /* Like print_rtx, except specify a file. */ | |
b707b450 | 594 | /* Return nonzero if we actually printed anything. */ |
3e28fe44 | 595 | |
b707b450 | 596 | int |
3e28fe44 MM |
597 | print_rtl_single (outf, x) |
598 | FILE *outf; | |
599 | rtx x; | |
600 | { | |
601 | outfile = outf; | |
602 | sawclose = 0; | |
9ec36da5 JL |
603 | if (! flag_dump_unnumbered |
604 | || GET_CODE (x) != NOTE || NOTE_LINE_NUMBER (x) < 0) | |
605 | { | |
606 | print_rtx (x); | |
607 | putc ('\n', outf); | |
b707b450 | 608 | return 1; |
9ec36da5 | 609 | } |
b707b450 | 610 | return 0; |
3e28fe44 | 611 | } |