print-rtl.c (print_rtx): For hard register...
[gcc.git] / gcc / print-rtl.c
1 /* Print RTL for GCC.
2 Copyright (C) 1987, 1988, 1992, 1997, 1998, 1999, 2000, 2002, 2003
3 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "tm.h"
27 #include "rtl.h"
28
29 /* We don't want the tree code checking code for the access to the
30 DECL_NAME to be included in the gen* programs. */
31 #undef ENABLE_TREE_CHECKING
32 #include "tree.h"
33 #include "real.h"
34 #include "flags.h"
35 #include "hard-reg-set.h"
36 #include "basic-block.h"
37 #include "tm_p.h"
38
39 static FILE *outfile;
40
41 static int sawclose = 0;
42
43 static int indent;
44
45 static void print_rtx (rtx);
46
47 /* String printed at beginning of each RTL when it is dumped.
48 This string is set to ASM_COMMENT_START when the RTL is dumped in
49 the assembly output file. */
50 const char *print_rtx_head = "";
51
52 /* Nonzero means suppress output of instruction numbers and line number
53 notes in debugging dumps.
54 This must be defined here so that programs like gencodes can be linked. */
55 int flag_dump_unnumbered = 0;
56
57 /* Nonzero means use simplified format without flags, modes, etc. */
58 int flag_simple = 0;
59
60 /* Nonzero if we are dumping graphical description. */
61 int dump_for_graph;
62
63 /* Nonzero to dump all call_placeholder alternatives. */
64 static int debug_call_placeholder_verbose;
65
66 void
67 print_mem_expr (FILE *outfile, tree expr)
68 {
69 if (TREE_CODE (expr) == COMPONENT_REF)
70 {
71 if (TREE_OPERAND (expr, 0))
72 print_mem_expr (outfile, TREE_OPERAND (expr, 0));
73 else
74 fputs (" <variable>", outfile);
75 if (DECL_NAME (TREE_OPERAND (expr, 1)))
76 fprintf (outfile, ".%s",
77 IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (expr, 1))));
78 }
79 else if (TREE_CODE (expr) == INDIRECT_REF)
80 {
81 fputs (" (*", outfile);
82 print_mem_expr (outfile, TREE_OPERAND (expr, 0));
83 fputs (")", outfile);
84 }
85 else if (DECL_NAME (expr))
86 fprintf (outfile, " %s", IDENTIFIER_POINTER (DECL_NAME (expr)));
87 else if (TREE_CODE (expr) == RESULT_DECL)
88 fputs (" <result>", outfile);
89 else
90 fputs (" <anonymous>", outfile);
91 }
92
93 /* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
94
95 static void
96 print_rtx (rtx in_rtx)
97 {
98 int i = 0;
99 int j;
100 const char *format_ptr;
101 int is_insn;
102 rtx tem;
103
104 if (sawclose)
105 {
106 if (flag_simple)
107 fputc (' ', outfile);
108 else
109 fprintf (outfile, "\n%s%*s", print_rtx_head, indent * 2, "");
110 sawclose = 0;
111 }
112
113 if (in_rtx == 0)
114 {
115 fputs ("(nil)", outfile);
116 sawclose = 1;
117 return;
118 }
119 else if (GET_CODE (in_rtx) > NUM_RTX_CODE)
120 {
121 fprintf (outfile, "(??? bad code %d\n)", GET_CODE (in_rtx));
122 sawclose = 1;
123 return;
124 }
125
126 is_insn = INSN_P (in_rtx);
127
128 /* When printing in VCG format we write INSNs, NOTE, LABEL, and BARRIER
129 in separate nodes and therefore have to handle them special here. */
130 if (dump_for_graph
131 && (is_insn || GET_CODE (in_rtx) == NOTE
132 || GET_CODE (in_rtx) == CODE_LABEL || GET_CODE (in_rtx) == BARRIER))
133 {
134 i = 3;
135 indent = 0;
136 }
137 else
138 {
139 /* Print name of expression code. */
140 if (flag_simple && GET_CODE (in_rtx) == CONST_INT)
141 fputc ('(', outfile);
142 else
143 fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx)));
144
145 if (! flag_simple)
146 {
147 if (RTX_FLAG (in_rtx, in_struct))
148 fputs ("/s", outfile);
149
150 if (RTX_FLAG (in_rtx, volatil))
151 fputs ("/v", outfile);
152
153 if (RTX_FLAG (in_rtx, unchanging))
154 fputs ("/u", outfile);
155
156 if (RTX_FLAG (in_rtx, integrated))
157 fputs ("/i", outfile);
158
159 if (RTX_FLAG (in_rtx, frame_related))
160 fputs ("/f", outfile);
161
162 if (RTX_FLAG (in_rtx, jump))
163 fputs ("/j", outfile);
164
165 if (RTX_FLAG (in_rtx, call))
166 fputs ("/c", outfile);
167
168 if (GET_MODE (in_rtx) != VOIDmode)
169 {
170 /* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
171 if (GET_CODE (in_rtx) == EXPR_LIST
172 || GET_CODE (in_rtx) == INSN_LIST)
173 fprintf (outfile, ":%s",
174 GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
175 else
176 fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
177 }
178 }
179 }
180
181 #ifndef GENERATOR_FILE
182 if (GET_CODE (in_rtx) == CONST_DOUBLE && FLOAT_MODE_P (GET_MODE (in_rtx)))
183 i = 5;
184 #endif
185
186 /* Get the format string and skip the first elements if we have handled
187 them already. */
188 format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)) + i;
189 for (; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
190 switch (*format_ptr++)
191 {
192 const char *str;
193
194 case 'T':
195 str = XTMPL (in_rtx, i);
196 goto string;
197
198 case 'S':
199 case 's':
200 str = XSTR (in_rtx, i);
201 string:
202
203 if (str == 0)
204 fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile);
205 else
206 {
207 if (dump_for_graph)
208 fprintf (outfile, " (\\\"%s\\\")", str);
209 else
210 fprintf (outfile, " (\"%s\")", str);
211 }
212 sawclose = 1;
213 break;
214
215 /* 0 indicates a field for internal use that should not be printed.
216 An exception is the third field of a NOTE, where it indicates
217 that the field has several different valid contents. */
218 case '0':
219 if (i == 1 && GET_CODE (in_rtx) == REG)
220 {
221 if (REGNO (in_rtx) != ORIGINAL_REGNO (in_rtx))
222 fprintf (outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
223 }
224 #ifndef GENERATOR_FILE
225 else if (i == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
226 {
227 int flags = SYMBOL_REF_FLAGS (in_rtx);
228 if (flags)
229 fprintf (outfile, " [flags 0x%x]", flags);
230 }
231 else if (i == 2 && GET_CODE (in_rtx) == SYMBOL_REF)
232 {
233 tree decl = SYMBOL_REF_DECL (in_rtx);
234 if (decl)
235 print_node_brief (outfile, "", decl, 0);
236 }
237 #endif
238 else if (i == 4 && GET_CODE (in_rtx) == NOTE)
239 {
240 switch (NOTE_LINE_NUMBER (in_rtx))
241 {
242 case NOTE_INSN_EH_REGION_BEG:
243 case NOTE_INSN_EH_REGION_END:
244 if (flag_dump_unnumbered)
245 fprintf (outfile, " #");
246 else
247 fprintf (outfile, " %d", NOTE_EH_HANDLER (in_rtx));
248 sawclose = 1;
249 break;
250
251 case NOTE_INSN_BLOCK_BEG:
252 case NOTE_INSN_BLOCK_END:
253 fprintf (outfile, " ");
254 if (flag_dump_unnumbered)
255 fprintf (outfile, "#");
256 else
257 fprintf (outfile, HOST_PTR_PRINTF,
258 (char *) NOTE_BLOCK (in_rtx));
259 sawclose = 1;
260 break;
261
262 case NOTE_INSN_BASIC_BLOCK:
263 {
264 basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
265 if (bb != 0)
266 fprintf (outfile, " [bb %d]", bb->index);
267 break;
268 }
269
270 case NOTE_INSN_EXPECTED_VALUE:
271 indent += 2;
272 if (!sawclose)
273 fprintf (outfile, " ");
274 print_rtx (NOTE_EXPECTED_VALUE (in_rtx));
275 indent -= 2;
276 break;
277
278 case NOTE_INSN_DELETED_LABEL:
279 if (NOTE_SOURCE_FILE (in_rtx))
280 fprintf (outfile, " (\"%s\")", NOTE_SOURCE_FILE (in_rtx));
281 else
282 fprintf (outfile, " \"\"");
283 break;
284
285 case NOTE_INSN_PREDICTION:
286 if (NOTE_PREDICTION (in_rtx))
287 fprintf (outfile, " [ %d %d ] ",
288 (int)NOTE_PREDICTION_ALG (in_rtx),
289 (int) NOTE_PREDICTION_FLAGS (in_rtx));
290 else
291 fprintf (outfile, " [ ERROR ]");
292 break;
293
294 default:
295 {
296 const char * const str = X0STR (in_rtx, i);
297
298 if (NOTE_LINE_NUMBER (in_rtx) < 0)
299 ;
300 else if (str == 0)
301 fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile);
302 else
303 {
304 if (dump_for_graph)
305 fprintf (outfile, " (\\\"%s\\\")", str);
306 else
307 fprintf (outfile, " (\"%s\")", str);
308 }
309 break;
310 }
311 }
312 }
313 break;
314
315 case 'e':
316 do_e:
317 indent += 2;
318 if (!sawclose)
319 fprintf (outfile, " ");
320 print_rtx (XEXP (in_rtx, i));
321 indent -= 2;
322 break;
323
324 case 'E':
325 case 'V':
326 indent += 2;
327 if (sawclose)
328 {
329 fprintf (outfile, "\n%s%*s",
330 print_rtx_head, indent * 2, "");
331 sawclose = 0;
332 }
333 fputs (" [", outfile);
334 if (NULL != XVEC (in_rtx, i))
335 {
336 indent += 2;
337 if (XVECLEN (in_rtx, i))
338 sawclose = 1;
339
340 for (j = 0; j < XVECLEN (in_rtx, i); j++)
341 print_rtx (XVECEXP (in_rtx, i, j));
342
343 indent -= 2;
344 }
345 if (sawclose)
346 fprintf (outfile, "\n%s%*s", print_rtx_head, indent * 2, "");
347
348 fputs ("]", outfile);
349 sawclose = 1;
350 indent -= 2;
351 break;
352
353 case 'w':
354 if (! flag_simple)
355 fprintf (outfile, " ");
356 fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i));
357 if (! flag_simple)
358 fprintf (outfile, " [" HOST_WIDE_INT_PRINT_HEX "]",
359 XWINT (in_rtx, i));
360 break;
361
362 case 'i':
363 if (i == 4 && INSN_P (in_rtx))
364 {
365 #ifndef GENERATOR_FILE
366 /* Pretty-print insn locators. Ignore scoping as it is mostly
367 redundant with line number information and do not print anything
368 when there is no location information available. */
369 if (INSN_LOCATOR (in_rtx) && insn_file (in_rtx))
370 fprintf(outfile, " %s:%i", insn_file (in_rtx), insn_line (in_rtx));
371 #endif
372 }
373 else if (i == 6 && GET_CODE (in_rtx) == NOTE)
374 {
375 /* This field is only used for NOTE_INSN_DELETED_LABEL, and
376 other times often contains garbage from INSN->NOTE death. */
377 if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_DELETED_LABEL)
378 fprintf (outfile, " %d", XINT (in_rtx, i));
379 }
380 else
381 {
382 int value = XINT (in_rtx, i);
383 const char *name;
384
385 #ifndef GENERATOR_FILE
386 if (GET_CODE (in_rtx) == REG && value < FIRST_PSEUDO_REGISTER)
387 fprintf (outfile, " %d %s", REGNO (in_rtx),
388 reg_names[REGNO (in_rtx)]);
389 else if (GET_CODE (in_rtx) == REG
390 && value <= LAST_VIRTUAL_REGISTER)
391 {
392 if (value == VIRTUAL_INCOMING_ARGS_REGNUM)
393 fprintf (outfile, " %d virtual-incoming-args", value);
394 else if (value == VIRTUAL_STACK_VARS_REGNUM)
395 fprintf (outfile, " %d virtual-stack-vars", value);
396 else if (value == VIRTUAL_STACK_DYNAMIC_REGNUM)
397 fprintf (outfile, " %d virtual-stack-dynamic", value);
398 else if (value == VIRTUAL_OUTGOING_ARGS_REGNUM)
399 fprintf (outfile, " %d virtual-outgoing-args", value);
400 else if (value == VIRTUAL_CFA_REGNUM)
401 fprintf (outfile, " %d virtual-cfa", value);
402 else
403 fprintf (outfile, " %d virtual-reg-%d", value,
404 value-FIRST_VIRTUAL_REGISTER);
405 }
406 else
407 #endif
408 if (flag_dump_unnumbered
409 && (is_insn || GET_CODE (in_rtx) == NOTE))
410 fputc ('#', outfile);
411 else
412 fprintf (outfile, " %d", value);
413
414 if (GET_CODE (in_rtx) == REG && REG_ATTRS (in_rtx))
415 {
416 fputs (" [", outfile);
417 if (ORIGINAL_REGNO (in_rtx) != REGNO (in_rtx))
418 fprintf (outfile, "orig:%i", ORIGINAL_REGNO (in_rtx));
419 if (REG_EXPR (in_rtx))
420 print_mem_expr (outfile, REG_EXPR (in_rtx));
421
422 if (REG_OFFSET (in_rtx))
423 fprintf (outfile, "+" HOST_WIDE_INT_PRINT_DEC,
424 REG_OFFSET (in_rtx));
425 fputs (" ]", outfile);
426 }
427
428 if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i)
429 && XINT (in_rtx, i) >= 0
430 && (name = get_insn_name (XINT (in_rtx, i))) != NULL)
431 fprintf (outfile, " {%s}", name);
432 sawclose = 0;
433 }
434 break;
435
436 /* Print NOTE_INSN names rather than integer codes. */
437
438 case 'n':
439 if (XINT (in_rtx, i) >= (int) NOTE_INSN_BIAS
440 && XINT (in_rtx, i) < (int) NOTE_INSN_MAX)
441 fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i)));
442 else
443 fprintf (outfile, " %d", XINT (in_rtx, i));
444 sawclose = 0;
445 break;
446
447 case 'u':
448 if (XEXP (in_rtx, i) != NULL)
449 {
450 rtx sub = XEXP (in_rtx, i);
451 enum rtx_code subc = GET_CODE (sub);
452
453 if (GET_CODE (in_rtx) == LABEL_REF)
454 {
455 if (subc == NOTE
456 && NOTE_LINE_NUMBER (sub) == NOTE_INSN_DELETED_LABEL)
457 {
458 if (flag_dump_unnumbered)
459 fprintf (outfile, " [# deleted]");
460 else
461 fprintf (outfile, " [%d deleted]", INSN_UID (sub));
462 sawclose = 0;
463 break;
464 }
465
466 if (subc != CODE_LABEL)
467 goto do_e;
468 }
469
470 if (flag_dump_unnumbered)
471 fputs (" #", outfile);
472 else
473 fprintf (outfile, " %d", INSN_UID (sub));
474 }
475 else
476 fputs (" 0", outfile);
477 sawclose = 0;
478 break;
479
480 case 'b':
481 if (XBITMAP (in_rtx, i) == NULL)
482 fputs (" {null}", outfile);
483 else
484 bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}");
485 sawclose = 0;
486 break;
487
488 case 't':
489 fprintf (outfile, " " HOST_PTR_PRINTF, (void *) XTREE (in_rtx, i));
490 break;
491
492 case '*':
493 fputs (" Unknown", outfile);
494 sawclose = 0;
495 break;
496
497 case 'B':
498 if (XBBDEF (in_rtx, i))
499 fprintf (outfile, " %i", XBBDEF (in_rtx, i)->index);
500 break;
501
502 default:
503 fprintf (stderr,
504 "switch format wrong in rtl.print_rtx(). format was: %c.\n",
505 format_ptr[-1]);
506 abort ();
507 }
508
509 switch (GET_CODE (in_rtx))
510 {
511 #ifndef GENERATOR_FILE
512 case MEM:
513 fprintf (outfile, " [" HOST_WIDE_INT_PRINT_DEC, MEM_ALIAS_SET (in_rtx));
514
515 if (MEM_EXPR (in_rtx))
516 print_mem_expr (outfile, MEM_EXPR (in_rtx));
517
518 if (MEM_OFFSET (in_rtx))
519 fprintf (outfile, "+" HOST_WIDE_INT_PRINT_DEC,
520 INTVAL (MEM_OFFSET (in_rtx)));
521
522 if (MEM_SIZE (in_rtx))
523 fprintf (outfile, " S" HOST_WIDE_INT_PRINT_DEC,
524 INTVAL (MEM_SIZE (in_rtx)));
525
526 if (MEM_ALIGN (in_rtx) != 1)
527 fprintf (outfile, " A%u", MEM_ALIGN (in_rtx));
528
529 fputc (']', outfile);
530 break;
531
532 case CONST_DOUBLE:
533 if (FLOAT_MODE_P (GET_MODE (in_rtx)))
534 {
535 char s[60];
536
537 real_to_decimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
538 sizeof (s), 0, 1);
539 fprintf (outfile, " %s", s);
540
541 real_to_hexadecimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
542 sizeof (s), 0, 1);
543 fprintf (outfile, " [%s]", s);
544 }
545 break;
546 #endif
547
548 case CODE_LABEL:
549 fprintf (outfile, " [%d uses]", LABEL_NUSES (in_rtx));
550 switch (LABEL_KIND (in_rtx))
551 {
552 case LABEL_NORMAL: break;
553 case LABEL_STATIC_ENTRY: fputs (" [entry]", outfile); break;
554 case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", outfile); break;
555 case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
556 default: abort();
557 }
558 break;
559
560 case CALL_PLACEHOLDER:
561 if (debug_call_placeholder_verbose)
562 {
563 fputs (" (cond [\n (const_string \"normal\") (sequence [", outfile);
564 for (tem = XEXP (in_rtx, 0); tem != 0; tem = NEXT_INSN (tem))
565 {
566 fputs ("\n ", outfile);
567 print_inline_rtx (outfile, tem, 4);
568 }
569
570 tem = XEXP (in_rtx, 1);
571 if (tem)
572 fputs ("\n ])\n (const_string \"tail_call\") (sequence [",
573 outfile);
574 for (; tem != 0; tem = NEXT_INSN (tem))
575 {
576 fputs ("\n ", outfile);
577 print_inline_rtx (outfile, tem, 4);
578 }
579
580 tem = XEXP (in_rtx, 2);
581 if (tem)
582 fputs ("\n ])\n (const_string \"tail_recursion\") (sequence [",
583 outfile);
584 for (; tem != 0; tem = NEXT_INSN (tem))
585 {
586 fputs ("\n ", outfile);
587 print_inline_rtx (outfile, tem, 4);
588 }
589
590 fputs ("\n ])\n ])", outfile);
591 break;
592 }
593
594 for (tem = XEXP (in_rtx, 0); tem != 0; tem = NEXT_INSN (tem))
595 if (GET_CODE (tem) == CALL_INSN)
596 {
597 fprintf (outfile, " ");
598 print_rtx (tem);
599 break;
600 }
601 break;
602
603 default:
604 break;
605 }
606
607 if (dump_for_graph
608 && (is_insn || GET_CODE (in_rtx) == NOTE
609 || GET_CODE (in_rtx) == CODE_LABEL || GET_CODE (in_rtx) == BARRIER))
610 sawclose = 0;
611 else
612 {
613 fputc (')', outfile);
614 sawclose = 1;
615 }
616 }
617
618 /* Print an rtx on the current line of FILE. Initially indent IND
619 characters. */
620
621 void
622 print_inline_rtx (FILE *outf, rtx x, int ind)
623 {
624 int oldsaw = sawclose;
625 int oldindent = indent;
626
627 sawclose = 0;
628 indent = ind;
629 outfile = outf;
630 print_rtx (x);
631 sawclose = oldsaw;
632 indent = oldindent;
633 }
634
635 /* Call this function from the debugger to see what X looks like. */
636
637 void
638 debug_rtx (rtx x)
639 {
640 outfile = stderr;
641 sawclose = 0;
642 print_rtx (x);
643 fprintf (stderr, "\n");
644 }
645
646 /* Count of rtx's to print with debug_rtx_list.
647 This global exists because gdb user defined commands have no arguments. */
648
649 int debug_rtx_count = 0; /* 0 is treated as equivalent to 1 */
650
651 /* Call this function to print list from X on.
652
653 N is a count of the rtx's to print. Positive values print from the specified
654 rtx on. Negative values print a window around the rtx.
655 EG: -5 prints 2 rtx's on either side (in addition to the specified rtx). */
656
657 void
658 debug_rtx_list (rtx x, int n)
659 {
660 int i,count;
661 rtx insn;
662
663 count = n == 0 ? 1 : n < 0 ? -n : n;
664
665 /* If we are printing a window, back up to the start. */
666
667 if (n < 0)
668 for (i = count / 2; i > 0; i--)
669 {
670 if (PREV_INSN (x) == 0)
671 break;
672 x = PREV_INSN (x);
673 }
674
675 for (i = count, insn = x; i > 0 && insn != 0; i--, insn = NEXT_INSN (insn))
676 {
677 debug_rtx (insn);
678 fprintf (stderr, "\n");
679 }
680 }
681
682 /* Call this function to print an rtx list from START to END inclusive. */
683
684 void
685 debug_rtx_range (rtx start, rtx end)
686 {
687 while (1)
688 {
689 debug_rtx (start);
690 fprintf (stderr, "\n");
691 if (!start || start == end)
692 break;
693 start = NEXT_INSN (start);
694 }
695 }
696
697 /* Call this function to search an rtx list to find one with insn uid UID,
698 and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
699 The found insn is returned to enable further debugging analysis. */
700
701 rtx
702 debug_rtx_find (rtx x, int uid)
703 {
704 while (x != 0 && INSN_UID (x) != uid)
705 x = NEXT_INSN (x);
706 if (x != 0)
707 {
708 debug_rtx_list (x, debug_rtx_count);
709 return x;
710 }
711 else
712 {
713 fprintf (stderr, "insn uid %d not found\n", uid);
714 return 0;
715 }
716 }
717
718 /* External entry point for printing a chain of insns
719 starting with RTX_FIRST onto file OUTF.
720 A blank line separates insns.
721
722 If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
723
724 void
725 print_rtl (FILE *outf, rtx rtx_first)
726 {
727 rtx tmp_rtx;
728
729 outfile = outf;
730 sawclose = 0;
731
732 if (rtx_first == 0)
733 {
734 fputs (print_rtx_head, outf);
735 fputs ("(nil)\n", outf);
736 }
737 else
738 switch (GET_CODE (rtx_first))
739 {
740 case INSN:
741 case JUMP_INSN:
742 case CALL_INSN:
743 case NOTE:
744 case CODE_LABEL:
745 case BARRIER:
746 for (tmp_rtx = rtx_first; tmp_rtx != 0; tmp_rtx = NEXT_INSN (tmp_rtx))
747 if (! flag_dump_unnumbered
748 || GET_CODE (tmp_rtx) != NOTE || NOTE_LINE_NUMBER (tmp_rtx) < 0)
749 {
750 fputs (print_rtx_head, outfile);
751 print_rtx (tmp_rtx);
752 fprintf (outfile, "\n");
753 }
754 break;
755
756 default:
757 fputs (print_rtx_head, outfile);
758 print_rtx (rtx_first);
759 }
760 }
761
762 /* Like print_rtx, except specify a file. */
763 /* Return nonzero if we actually printed anything. */
764
765 int
766 print_rtl_single (FILE *outf, rtx x)
767 {
768 outfile = outf;
769 sawclose = 0;
770 if (! flag_dump_unnumbered
771 || GET_CODE (x) != NOTE || NOTE_LINE_NUMBER (x) < 0)
772 {
773 fputs (print_rtx_head, outfile);
774 print_rtx (x);
775 putc ('\n', outf);
776 return 1;
777 }
778 return 0;
779 }
780
781
782 /* Like print_rtl except without all the detail; for example,
783 if RTX is a CONST_INT then print in decimal format. */
784
785 void
786 print_simple_rtl (FILE *outf, rtx x)
787 {
788 flag_simple = 1;
789 print_rtl (outf, x);
790 flag_simple = 0;
791 }