OSDN Git Service

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