OSDN Git Service

* lower-subreg.c (simple_move_operand): New static function,
[pf3gnuchains/gcc-fork.git] / gcc / print-rtl.c
1 /* Print RTL for GCC.
2    Copyright (C) 1987, 1988, 1992, 1997, 1998, 1999, 2000, 2002, 2003,
3    2004, 2005
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA.  */
22
23 /* This file is compiled twice: once for the generator programs,
24    once for the compiler.  */
25 #ifdef GENERATOR_FILE
26 #include "bconfig.h"
27 #else
28 #include "config.h"
29 #endif
30
31 #include "system.h"
32 #include "coretypes.h"
33 #include "tm.h"
34 #include "rtl.h"
35
36 /* These headers all define things which are not available in
37    generator programs.  */
38 #ifndef GENERATOR_FILE
39 #include "tree.h"
40 #include "real.h"
41 #include "flags.h"
42 #include "hard-reg-set.h"
43 #include "basic-block.h"
44 #endif
45
46 static FILE *outfile;
47
48 static int sawclose = 0;
49
50 static int indent;
51
52 static void print_rtx (rtx);
53
54 /* String printed at beginning of each RTL when it is dumped.
55    This string is set to ASM_COMMENT_START when the RTL is dumped in
56    the assembly output file.  */
57 const char *print_rtx_head = "";
58
59 /* Nonzero means suppress output of instruction numbers and line number
60    notes in debugging dumps.
61    This must be defined here so that programs like gencodes can be linked.  */
62 int flag_dump_unnumbered = 0;
63
64 /* Nonzero means use simplified format without flags, modes, etc.  */
65 int flag_simple = 0;
66
67 /* Nonzero if we are dumping graphical description.  */
68 int dump_for_graph;
69
70 #ifndef GENERATOR_FILE
71 static void
72 print_decl_name (FILE *outfile, tree node)
73 {
74   if (DECL_NAME (node))
75     fputs (IDENTIFIER_POINTER (DECL_NAME (node)), outfile);
76   else
77     {
78       if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
79         fprintf (outfile, "L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
80       else
81         {
82           char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
83           fprintf (outfile, "%c.%u", c, DECL_UID (node));
84         }
85     }
86 }
87
88 void
89 print_mem_expr (FILE *outfile, tree expr)
90 {
91   if (TREE_CODE (expr) == COMPONENT_REF)
92     {
93       if (TREE_OPERAND (expr, 0))
94         print_mem_expr (outfile, TREE_OPERAND (expr, 0));
95       else
96         fputs (" <variable>", outfile);
97       fputc ('.', outfile);
98       print_decl_name (outfile, TREE_OPERAND (expr, 1));
99     }
100   else if (TREE_CODE (expr) == INDIRECT_REF)
101     {
102       fputs (" (*", outfile);
103       print_mem_expr (outfile, TREE_OPERAND (expr, 0));
104       fputs (")", outfile);
105     }
106   else if (TREE_CODE (expr) == ALIGN_INDIRECT_REF)
107     {
108       fputs (" (A*", outfile);
109       print_mem_expr (outfile, TREE_OPERAND (expr, 0));
110       fputs (")", outfile);
111     }
112   else if (TREE_CODE (expr) == MISALIGNED_INDIRECT_REF)
113     {
114       fputs (" (M*", outfile);
115       print_mem_expr (outfile, TREE_OPERAND (expr, 0));
116       fputs (")", outfile);
117     }
118   else if (TREE_CODE (expr) == RESULT_DECL)
119     fputs (" <result>", outfile);
120   else
121     {
122       fputc (' ', outfile);
123       print_decl_name (outfile, expr);
124     }
125 }
126 #endif
127
128 /* Print IN_RTX onto OUTFILE.  This is the recursive part of printing.  */
129
130 static void
131 print_rtx (rtx in_rtx)
132 {
133   int i = 0;
134   int j;
135   const char *format_ptr;
136   int is_insn;
137
138   if (sawclose)
139     {
140       if (flag_simple)
141         fputc (' ', outfile);
142       else
143         fprintf (outfile, "\n%s%*s", print_rtx_head, indent * 2, "");
144       sawclose = 0;
145     }
146
147   if (in_rtx == 0)
148     {
149       fputs ("(nil)", outfile);
150       sawclose = 1;
151       return;
152     }
153   else if (GET_CODE (in_rtx) > NUM_RTX_CODE)
154     {
155        fprintf (outfile, "(??? bad code %d\n)", GET_CODE (in_rtx));
156        sawclose = 1;
157        return;
158     }
159
160   is_insn = INSN_P (in_rtx);
161
162   /* When printing in VCG format we write INSNs, NOTE, LABEL, and BARRIER
163      in separate nodes and therefore have to handle them special here.  */
164   if (dump_for_graph
165       && (is_insn || NOTE_P (in_rtx)
166           || LABEL_P (in_rtx) || BARRIER_P (in_rtx)))
167     {
168       i = 3;
169       indent = 0;
170     }
171   else
172     {
173       /* Print name of expression code.  */
174       if (flag_simple && GET_CODE (in_rtx) == CONST_INT)
175         fputc ('(', outfile);
176       else
177         fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx)));
178
179       if (! flag_simple)
180         {
181           if (RTX_FLAG (in_rtx, in_struct))
182             fputs ("/s", outfile);
183
184           if (RTX_FLAG (in_rtx, volatil))
185             fputs ("/v", outfile);
186
187           if (RTX_FLAG (in_rtx, unchanging))
188             fputs ("/u", outfile);
189
190           if (RTX_FLAG (in_rtx, frame_related))
191             fputs ("/f", outfile);
192
193           if (RTX_FLAG (in_rtx, jump))
194             fputs ("/j", outfile);
195
196           if (RTX_FLAG (in_rtx, call))
197             fputs ("/c", outfile);
198
199           if (RTX_FLAG (in_rtx, return_val))
200             fputs ("/i", outfile);
201
202           /* Print REG_NOTE names for EXPR_LIST and INSN_LIST.  */
203           if (GET_CODE (in_rtx) == EXPR_LIST
204               || GET_CODE (in_rtx) == INSN_LIST)
205             fprintf (outfile, ":%s",
206                      GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
207
208           /* For other rtl, print the mode if it's not VOID.  */
209           else if (GET_MODE (in_rtx) != VOIDmode)
210             fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
211         }
212     }
213
214 #ifndef GENERATOR_FILE
215   if (GET_CODE (in_rtx) == CONST_DOUBLE && FLOAT_MODE_P (GET_MODE (in_rtx)))
216     i = 5;
217 #endif
218
219   /* Get the format string and skip the first elements if we have handled
220      them already.  */
221   format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)) + i;
222   for (; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
223     switch (*format_ptr++)
224       {
225         const char *str;
226
227       case 'T':
228         str = XTMPL (in_rtx, i);
229         goto string;
230
231       case 'S':
232       case 's':
233         str = XSTR (in_rtx, i);
234       string:
235
236         if (str == 0)
237           fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile);
238         else
239           {
240             if (dump_for_graph)
241               fprintf (outfile, " (\\\"%s\\\")", str);
242             else
243               fprintf (outfile, " (\"%s\")", str);
244           }
245         sawclose = 1;
246         break;
247
248         /* 0 indicates a field for internal use that should not be printed.
249            An exception is the third field of a NOTE, where it indicates
250            that the field has several different valid contents.  */
251       case '0':
252         if (i == 1 && REG_P (in_rtx))
253           {
254             if (REGNO (in_rtx) != ORIGINAL_REGNO (in_rtx))
255               fprintf (outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
256           }
257 #ifndef GENERATOR_FILE
258         else if (i == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
259           {
260             int flags = SYMBOL_REF_FLAGS (in_rtx);
261             if (flags)
262               fprintf (outfile, " [flags 0x%x]", flags);
263           }
264         else if (i == 2 && GET_CODE (in_rtx) == SYMBOL_REF)
265           {
266             tree decl = SYMBOL_REF_DECL (in_rtx);
267             if (decl)
268               print_node_brief (outfile, "", decl, 0);
269           }
270 #endif
271         else if (i == 4 && NOTE_P (in_rtx))
272           {
273             switch (NOTE_LINE_NUMBER (in_rtx))
274               {
275               case NOTE_INSN_EH_REGION_BEG:
276               case NOTE_INSN_EH_REGION_END:
277                 if (flag_dump_unnumbered)
278                   fprintf (outfile, " #");
279                 else
280                   fprintf (outfile, " %d", NOTE_EH_HANDLER (in_rtx));
281                 sawclose = 1;
282                 break;
283
284               case NOTE_INSN_BLOCK_BEG:
285               case NOTE_INSN_BLOCK_END:
286 #ifndef GENERATOR_FILE
287                 dump_addr (outfile, " ", NOTE_BLOCK (in_rtx));
288 #endif
289                 sawclose = 1;
290                 break;
291
292               case NOTE_INSN_BASIC_BLOCK:
293                 {
294 #ifndef GENERATOR_FILE
295                   basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
296                   if (bb != 0)
297                     fprintf (outfile, " [bb %d]", bb->index);
298 #endif
299                   break;
300                 }
301
302               case NOTE_INSN_DELETED_LABEL:
303                 {
304                   const char *label = NOTE_DELETED_LABEL_NAME (in_rtx);
305                   if (label)
306                     fprintf (outfile, " (\"%s\")", label);
307                   else
308                     fprintf (outfile, " \"\"");
309                 }
310                 break;
311
312               case NOTE_INSN_SWITCH_TEXT_SECTIONS:
313                 {
314 #ifndef GENERATOR_FILE
315                   basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
316                   if (bb != 0)
317                     fprintf (outfile, " [bb %d]", bb->index);
318 #endif
319                   break;
320                 }
321                 
322               case NOTE_INSN_VAR_LOCATION:
323 #ifndef GENERATOR_FILE
324                 fprintf (outfile, " (");
325                 print_mem_expr (outfile, NOTE_VAR_LOCATION_DECL (in_rtx));
326                 fprintf (outfile, " ");
327                 print_rtx (NOTE_VAR_LOCATION_LOC (in_rtx));
328                 fprintf (outfile, ")");
329 #endif
330                 break;
331
332               default:
333                 {
334                   const char * const str = X0STR (in_rtx, i);
335
336                   if (NOTE_LINE_NUMBER (in_rtx) < 0)
337                     ;
338                   else if (str == 0)
339                     fputs (dump_for_graph ? " \\\"\\\"" : " \"\"", outfile);
340                   else
341                     {
342                       if (dump_for_graph)
343                         fprintf (outfile, " (\\\"%s\\\")", str);
344                       else
345                         fprintf (outfile, " (\"%s\")", str);
346                     }
347                   break;
348                 }
349               }
350           }
351         break;
352
353       case 'e':
354       do_e:
355         indent += 2;
356         if (!sawclose)
357           fprintf (outfile, " ");
358         print_rtx (XEXP (in_rtx, i));
359         indent -= 2;
360         break;
361
362       case 'E':
363       case 'V':
364         indent += 2;
365         if (sawclose)
366           {
367             fprintf (outfile, "\n%s%*s",
368                      print_rtx_head, indent * 2, "");
369             sawclose = 0;
370           }
371         fputs (" [", outfile);
372         if (NULL != XVEC (in_rtx, i))
373           {
374             indent += 2;
375             if (XVECLEN (in_rtx, i))
376               sawclose = 1;
377
378             for (j = 0; j < XVECLEN (in_rtx, i); j++)
379               print_rtx (XVECEXP (in_rtx, i, j));
380
381             indent -= 2;
382           }
383         if (sawclose)
384           fprintf (outfile, "\n%s%*s", print_rtx_head, indent * 2, "");
385
386         fputs ("]", outfile);
387         sawclose = 1;
388         indent -= 2;
389         break;
390
391       case 'w':
392         if (! flag_simple)
393           fprintf (outfile, " ");
394         fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i));
395         if (! flag_simple)
396           fprintf (outfile, " [" HOST_WIDE_INT_PRINT_HEX "]",
397                    XWINT (in_rtx, i));
398         break;
399
400       case 'i':
401         if (i == 4 && INSN_P (in_rtx))
402           {
403 #ifndef GENERATOR_FILE
404             /*  Pretty-print insn locators.  Ignore scoping as it is mostly
405                 redundant with line number information and do not print anything
406                 when there is no location information available.  */
407             if (INSN_LOCATOR (in_rtx) && insn_file (in_rtx))
408               fprintf(outfile, " %s:%i", insn_file (in_rtx), insn_line (in_rtx));
409 #endif
410           }
411         else if (i == 6 && NOTE_P (in_rtx))
412           {
413             /* This field is only used for NOTE_INSN_DELETED_LABEL, and
414                other times often contains garbage from INSN->NOTE death.  */
415             if (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_DELETED_LABEL)
416               fprintf (outfile, " %d",  XINT (in_rtx, i));
417           }
418         else
419           {
420             int value = XINT (in_rtx, i);
421             const char *name;
422
423 #ifndef GENERATOR_FILE
424             if (REG_P (in_rtx) && value < FIRST_PSEUDO_REGISTER)
425               fprintf (outfile, " %d %s", REGNO (in_rtx),
426                        reg_names[REGNO (in_rtx)]);
427             else if (REG_P (in_rtx)
428                      && value <= LAST_VIRTUAL_REGISTER)
429               {
430                 if (value == VIRTUAL_INCOMING_ARGS_REGNUM)
431                   fprintf (outfile, " %d virtual-incoming-args", value);
432                 else if (value == VIRTUAL_STACK_VARS_REGNUM)
433                   fprintf (outfile, " %d virtual-stack-vars", value);
434                 else if (value == VIRTUAL_STACK_DYNAMIC_REGNUM)
435                   fprintf (outfile, " %d virtual-stack-dynamic", value);
436                 else if (value == VIRTUAL_OUTGOING_ARGS_REGNUM)
437                   fprintf (outfile, " %d virtual-outgoing-args", value);
438                 else if (value == VIRTUAL_CFA_REGNUM)
439                   fprintf (outfile, " %d virtual-cfa", value);
440                 else
441                   fprintf (outfile, " %d virtual-reg-%d", value,
442                            value-FIRST_VIRTUAL_REGISTER);
443               }
444             else
445 #endif
446               if (flag_dump_unnumbered
447                      && (is_insn || NOTE_P (in_rtx)))
448               fputc ('#', outfile);
449             else
450               fprintf (outfile, " %d", value);
451
452 #ifndef GENERATOR_FILE
453             if (REG_P (in_rtx) && REG_ATTRS (in_rtx))
454               {
455                 fputs (" [", outfile);
456                 if (ORIGINAL_REGNO (in_rtx) != REGNO (in_rtx))
457                   fprintf (outfile, "orig:%i", ORIGINAL_REGNO (in_rtx));
458                 if (REG_EXPR (in_rtx))
459                   print_mem_expr (outfile, REG_EXPR (in_rtx));
460
461                 if (REG_OFFSET (in_rtx))
462                   fprintf (outfile, "+" HOST_WIDE_INT_PRINT_DEC,
463                            REG_OFFSET (in_rtx));
464                 fputs (" ]", outfile);
465               }
466 #endif
467
468             if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i)
469                 && XINT (in_rtx, i) >= 0
470                 && (name = get_insn_name (XINT (in_rtx, i))) != NULL)
471               fprintf (outfile, " {%s}", name);
472             sawclose = 0;
473           }
474         break;
475
476       /* Print NOTE_INSN names rather than integer codes.  */
477
478       case 'n':
479         if (XINT (in_rtx, i) >= (int) NOTE_INSN_BIAS
480             && XINT (in_rtx, i) < (int) NOTE_INSN_MAX)
481           fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i)));
482         else
483           fprintf (outfile, " %d", XINT (in_rtx, i));
484         sawclose = 0;
485         break;
486
487       case 'u':
488         if (XEXP (in_rtx, i) != NULL)
489           {
490             rtx sub = XEXP (in_rtx, i);
491             enum rtx_code subc = GET_CODE (sub);
492
493             if (GET_CODE (in_rtx) == LABEL_REF)
494               {
495                 if (subc == NOTE
496                     && NOTE_LINE_NUMBER (sub) == NOTE_INSN_DELETED_LABEL)
497                   {
498                     if (flag_dump_unnumbered)
499                       fprintf (outfile, " [# deleted]");
500                     else
501                       fprintf (outfile, " [%d deleted]", INSN_UID (sub));
502                     sawclose = 0;
503                     break;
504                   }
505
506                 if (subc != CODE_LABEL)
507                   goto do_e;
508               }
509
510             if (flag_dump_unnumbered)
511               fputs (" #", outfile);
512             else
513               fprintf (outfile, " %d", INSN_UID (sub));
514           }
515         else
516           fputs (" 0", outfile);
517         sawclose = 0;
518         break;
519
520       case 'b':
521 #ifndef GENERATOR_FILE
522         if (XBITMAP (in_rtx, i) == NULL)
523           fputs (" {null}", outfile);
524         else
525           bitmap_print (outfile, XBITMAP (in_rtx, i), " {", "}");
526 #endif
527         sawclose = 0;
528         break;
529
530       case 't':
531 #ifndef GENERATOR_FILE
532         dump_addr (outfile, " ", XTREE (in_rtx, i));
533 #endif
534         break;
535
536       case '*':
537         fputs (" Unknown", outfile);
538         sawclose = 0;
539         break;
540
541       case 'B':
542 #ifndef GENERATOR_FILE
543         if (XBBDEF (in_rtx, i))
544           fprintf (outfile, " %i", XBBDEF (in_rtx, i)->index);
545 #endif
546         break;
547
548       default:
549         gcc_unreachable ();
550       }
551
552   switch (GET_CODE (in_rtx))
553     {
554 #ifndef GENERATOR_FILE
555     case MEM:
556       fprintf (outfile, " [" HOST_WIDE_INT_PRINT_DEC, MEM_ALIAS_SET (in_rtx));
557
558       if (MEM_EXPR (in_rtx))
559         print_mem_expr (outfile, MEM_EXPR (in_rtx));
560
561       if (MEM_OFFSET (in_rtx))
562         fprintf (outfile, "+" HOST_WIDE_INT_PRINT_DEC,
563                  INTVAL (MEM_OFFSET (in_rtx)));
564
565       if (MEM_SIZE (in_rtx))
566         fprintf (outfile, " S" HOST_WIDE_INT_PRINT_DEC,
567                  INTVAL (MEM_SIZE (in_rtx)));
568
569       if (MEM_ALIGN (in_rtx) != 1)
570         fprintf (outfile, " A%u", MEM_ALIGN (in_rtx));
571
572       fputc (']', outfile);
573       break;
574
575     case CONST_DOUBLE:
576       if (FLOAT_MODE_P (GET_MODE (in_rtx)))
577         {
578           char s[60];
579
580           real_to_decimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
581                            sizeof (s), 0, 1);
582           fprintf (outfile, " %s", s);
583
584           real_to_hexadecimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
585                                sizeof (s), 0, 1);
586           fprintf (outfile, " [%s]", s);
587         }
588       break;
589 #endif
590
591     case CODE_LABEL:
592       fprintf (outfile, " [%d uses]", LABEL_NUSES (in_rtx));
593       switch (LABEL_KIND (in_rtx))
594         {
595           case LABEL_NORMAL: break;
596           case LABEL_STATIC_ENTRY: fputs (" [entry]", outfile); break;
597           case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", outfile); break;
598           case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
599           default: gcc_unreachable ();
600         }
601       break;
602
603     default:
604       break;
605     }
606
607   if (dump_for_graph
608       && (is_insn || NOTE_P (in_rtx)
609           || LABEL_P (in_rtx) || BARRIER_P (in_rtx)))
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               || !NOTE_P (tmp_rtx) || 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       || !NOTE_P (x) || 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 }