2 Copyright (C) 1987-2016 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 /* This file is compiled twice: once for the generator programs,
21 once for the compiler. */
29 #include "coretypes.h"
33 /* These headers all define things which are not available in
34 generator programs. */
35 #ifndef GENERATOR_FILE
39 #include "print-tree.h"
43 #include "basic-block.h"
44 #include "diagnostic.h"
45 #include "tree-pretty-print.h"
46 #include "alloc-pool.h"
48 #include "dumpfile.h" /* for dump_flags */
49 #include "dwarf2out.h"
50 #include "pretty-print.h"
53 #include "print-rtl.h"
57 static int sawclose
= 0;
61 static bool in_call_function_usage
;
63 /* If true, use compact dump format:
64 - INSN_UIDs are omitted, except for jumps and CODE_LABELs,
65 - INSN_CODEs are omitted,
66 - register numbers are omitted for hard and virtual regs
67 - insn names are prefixed with "c" (e.g. "cinsn", "cnote", etc). */
70 static void print_rtx (const_rtx
);
72 /* String printed at beginning of each RTL when it is dumped.
73 This string is set to ASM_COMMENT_START when the RTL is dumped in
74 the assembly output file. */
75 const char *print_rtx_head
= "";
78 /* These are defined from the .opt file when not used in generator
81 /* Nonzero means suppress output of instruction numbers
83 This must be defined here so that programs like gencodes can be linked. */
84 int flag_dump_unnumbered
= 0;
86 /* Nonzero means suppress output of instruction numbers for previous
87 and next insns in debugging dumps.
88 This must be defined here so that programs like gencodes can be linked. */
89 int flag_dump_unnumbered_links
= 0;
92 /* Nonzero means use simplified format without flags, modes, etc. */
95 #ifndef GENERATOR_FILE
97 print_mem_expr (FILE *outfile
, const_tree expr
)
100 print_generic_expr (outfile
, CONST_CAST_TREE (expr
), dump_flags
);
104 /* Subroutine of print_rtx_operand for handling code '0'.
105 0 indicates a field for internal use that should not be printed.
106 However there are various special cases, such as the third field
107 of a NOTE, where it indicates that the field has several different
111 print_rtx_operand_code_0 (const_rtx in_rtx ATTRIBUTE_UNUSED
,
112 int idx ATTRIBUTE_UNUSED
)
114 #ifndef GENERATOR_FILE
115 if (idx
== 1 && GET_CODE (in_rtx
) == SYMBOL_REF
)
117 int flags
= SYMBOL_REF_FLAGS (in_rtx
);
119 fprintf (outfile
, " [flags %#x]", flags
);
120 tree decl
= SYMBOL_REF_DECL (in_rtx
);
122 print_node_brief (outfile
, "", decl
, dump_flags
);
124 else if (idx
== 3 && NOTE_P (in_rtx
))
126 switch (NOTE_KIND (in_rtx
))
128 case NOTE_INSN_EH_REGION_BEG
:
129 case NOTE_INSN_EH_REGION_END
:
130 if (flag_dump_unnumbered
)
131 fprintf (outfile
, " #");
133 fprintf (outfile
, " %d", NOTE_EH_HANDLER (in_rtx
));
137 case NOTE_INSN_BLOCK_BEG
:
138 case NOTE_INSN_BLOCK_END
:
139 dump_addr (outfile
, " ", NOTE_BLOCK (in_rtx
));
143 case NOTE_INSN_BASIC_BLOCK
:
145 basic_block bb
= NOTE_BASIC_BLOCK (in_rtx
);
147 fprintf (outfile
, " [bb %d]", bb
->index
);
151 case NOTE_INSN_DELETED_LABEL
:
152 case NOTE_INSN_DELETED_DEBUG_LABEL
:
154 const char *label
= NOTE_DELETED_LABEL_NAME (in_rtx
);
156 fprintf (outfile
, " (\"%s\")", label
);
158 fprintf (outfile
, " \"\"");
162 case NOTE_INSN_SWITCH_TEXT_SECTIONS
:
164 basic_block bb
= NOTE_BASIC_BLOCK (in_rtx
);
166 fprintf (outfile
, " [bb %d]", bb
->index
);
170 case NOTE_INSN_VAR_LOCATION
:
171 case NOTE_INSN_CALL_ARG_LOCATION
:
172 fputc (' ', outfile
);
173 print_rtx (NOTE_VAR_LOCATION (in_rtx
));
177 fputc ('\n', outfile
);
178 output_cfi_directive (outfile
, NOTE_CFI (in_rtx
));
179 fputc ('\t', outfile
);
186 else if (idx
== 7 && JUMP_P (in_rtx
) && JUMP_LABEL (in_rtx
) != NULL
189 /* Output the JUMP_LABEL reference. */
190 fprintf (outfile
, "\n%s%*s -> ", print_rtx_head
, indent
* 2, "");
191 if (GET_CODE (JUMP_LABEL (in_rtx
)) == RETURN
)
192 fprintf (outfile
, "return");
193 else if (GET_CODE (JUMP_LABEL (in_rtx
)) == SIMPLE_RETURN
)
194 fprintf (outfile
, "simple_return");
196 fprintf (outfile
, "%d", INSN_UID (JUMP_LABEL (in_rtx
)));
198 else if (idx
== 0 && GET_CODE (in_rtx
) == VALUE
)
200 cselib_val
*val
= CSELIB_VAL_PTR (in_rtx
);
202 fprintf (outfile
, " %u:%u", val
->uid
, val
->hash
);
203 dump_addr (outfile
, " @", in_rtx
);
204 dump_addr (outfile
, "/", (void*)val
);
206 else if (idx
== 0 && GET_CODE (in_rtx
) == DEBUG_EXPR
)
208 fprintf (outfile
, " D#%i",
209 DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (in_rtx
)));
211 else if (idx
== 0 && GET_CODE (in_rtx
) == ENTRY_VALUE
)
215 fprintf (outfile
, " ");
216 print_rtx (ENTRY_VALUE_EXP (in_rtx
));
222 /* Subroutine of print_rtx_operand for handling code 'e'.
223 Also called by print_rtx_operand_code_u for handling code 'u'
224 for LABEL_REFs when they don't reference a CODE_LABEL. */
227 print_rtx_operand_code_e (const_rtx in_rtx
, int idx
)
230 if (idx
== 6 && INSN_P (in_rtx
))
231 /* Put REG_NOTES on their own line. */
232 fprintf (outfile
, "\n%s%*s",
233 print_rtx_head
, indent
* 2, "");
235 fprintf (outfile
, " ");
236 if (idx
== 7 && CALL_P (in_rtx
))
238 in_call_function_usage
= true;
239 print_rtx (XEXP (in_rtx
, idx
));
240 in_call_function_usage
= false;
243 print_rtx (XEXP (in_rtx
, idx
));
247 /* Subroutine of print_rtx_operand for handling codes 'E' and 'V'. */
250 print_rtx_operand_codes_E_and_V (const_rtx in_rtx
, int idx
)
255 fprintf (outfile
, "\n%s%*s",
256 print_rtx_head
, indent
* 2, "");
259 fputs (" [", outfile
);
260 if (NULL
!= XVEC (in_rtx
, idx
))
263 if (XVECLEN (in_rtx
, idx
))
266 for (int j
= 0; j
< XVECLEN (in_rtx
, idx
); j
++)
267 print_rtx (XVECEXP (in_rtx
, idx
, j
));
272 fprintf (outfile
, "\n%s%*s", print_rtx_head
, indent
* 2, "");
274 fputs ("]", outfile
);
279 /* Subroutine of print_rtx_operand for handling code 'i'. */
282 print_rtx_operand_code_i (const_rtx in_rtx
, int idx
)
284 if (idx
== 4 && INSN_P (in_rtx
))
286 #ifndef GENERATOR_FILE
287 const rtx_insn
*in_insn
= as_a
<const rtx_insn
*> (in_rtx
);
289 /* Pretty-print insn locations. Ignore scoping as it is mostly
290 redundant with line number information and do not print anything
291 when there is no location information available. */
292 if (INSN_HAS_LOCATION (in_insn
))
294 expanded_location xloc
= insn_location (in_insn
);
295 fprintf (outfile
, " \"%s\":%i", xloc
.file
, xloc
.line
);
299 else if (idx
== 6 && GET_CODE (in_rtx
) == ASM_OPERANDS
)
301 #ifndef GENERATOR_FILE
302 if (ASM_OPERANDS_SOURCE_LOCATION (in_rtx
) != UNKNOWN_LOCATION
)
303 fprintf (outfile
, " %s:%i",
304 LOCATION_FILE (ASM_OPERANDS_SOURCE_LOCATION (in_rtx
)),
305 LOCATION_LINE (ASM_OPERANDS_SOURCE_LOCATION (in_rtx
)));
308 else if (idx
== 1 && GET_CODE (in_rtx
) == ASM_INPUT
)
310 #ifndef GENERATOR_FILE
311 if (ASM_INPUT_SOURCE_LOCATION (in_rtx
) != UNKNOWN_LOCATION
)
312 fprintf (outfile
, " %s:%i",
313 LOCATION_FILE (ASM_INPUT_SOURCE_LOCATION (in_rtx
)),
314 LOCATION_LINE (ASM_INPUT_SOURCE_LOCATION (in_rtx
)));
317 else if (idx
== 5 && NOTE_P (in_rtx
))
319 /* This field is only used for NOTE_INSN_DELETED_LABEL, and
320 other times often contains garbage from INSN->NOTE death. */
321 if (NOTE_KIND (in_rtx
) == NOTE_INSN_DELETED_LABEL
322 || NOTE_KIND (in_rtx
) == NOTE_INSN_DELETED_DEBUG_LABEL
)
323 fprintf (outfile
, " %d", XINT (in_rtx
, idx
));
325 #if !defined(GENERATOR_FILE) && NUM_UNSPECV_VALUES > 0
327 && GET_CODE (in_rtx
) == UNSPEC_VOLATILE
328 && XINT (in_rtx
, 1) >= 0
329 && XINT (in_rtx
, 1) < NUM_UNSPECV_VALUES
)
330 fprintf (outfile
, " %s", unspecv_strings
[XINT (in_rtx
, 1)]);
332 #if !defined(GENERATOR_FILE) && NUM_UNSPEC_VALUES > 0
334 && (GET_CODE (in_rtx
) == UNSPEC
335 || GET_CODE (in_rtx
) == UNSPEC_VOLATILE
)
336 && XINT (in_rtx
, 1) >= 0
337 && XINT (in_rtx
, 1) < NUM_UNSPEC_VALUES
)
338 fprintf (outfile
, " %s", unspec_strings
[XINT (in_rtx
, 1)]);
342 int value
= XINT (in_rtx
, idx
);
344 int is_insn
= INSN_P (in_rtx
);
346 /* Don't print INSN_CODEs in compact mode. */
347 if (flag_compact
&& is_insn
&& &INSN_CODE (in_rtx
) == &XINT (in_rtx
, idx
))
353 if (flag_dump_unnumbered
354 && (is_insn
|| NOTE_P (in_rtx
)))
355 fputc ('#', outfile
);
357 fprintf (outfile
, " %d", value
);
359 if (is_insn
&& &INSN_CODE (in_rtx
) == &XINT (in_rtx
, idx
)
360 && XINT (in_rtx
, idx
) >= 0
361 && (name
= get_insn_name (XINT (in_rtx
, idx
))) != NULL
)
362 fprintf (outfile
, " {%s}", name
);
367 /* Subroutine of print_rtx_operand for handling code 'r'. */
370 print_rtx_operand_code_r (const_rtx in_rtx
)
372 int is_insn
= INSN_P (in_rtx
);
373 unsigned int regno
= REGNO (in_rtx
);
375 #ifndef GENERATOR_FILE
376 /* For hard registers and virtuals, always print the
377 regno, except in compact mode. */
378 if (regno
<= LAST_VIRTUAL_REGISTER
&& !flag_compact
)
379 fprintf (outfile
, " %d", regno
);
380 if (regno
< FIRST_PSEUDO_REGISTER
)
381 fprintf (outfile
, " %s", reg_names
[regno
]);
382 else if (regno
<= LAST_VIRTUAL_REGISTER
)
384 if (regno
== VIRTUAL_INCOMING_ARGS_REGNUM
)
385 fprintf (outfile
, " virtual-incoming-args");
386 else if (regno
== VIRTUAL_STACK_VARS_REGNUM
)
387 fprintf (outfile
, " virtual-stack-vars");
388 else if (regno
== VIRTUAL_STACK_DYNAMIC_REGNUM
)
389 fprintf (outfile
, " virtual-stack-dynamic");
390 else if (regno
== VIRTUAL_OUTGOING_ARGS_REGNUM
)
391 fprintf (outfile
, " virtual-outgoing-args");
392 else if (regno
== VIRTUAL_CFA_REGNUM
)
393 fprintf (outfile
, " virtual-cfa");
394 else if (regno
== VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM
)
395 fprintf (outfile
, " virtual-preferred-stack-boundary");
397 fprintf (outfile
, " virtual-reg-%d", regno
-FIRST_VIRTUAL_REGISTER
);
401 if (flag_dump_unnumbered
&& is_insn
)
402 fputc ('#', outfile
);
403 else if (flag_compact
)
405 /* In compact mode, print pseudos with a '%' sigil following
406 by the regno, offset by (LAST_VIRTUAL_REGISTER + 1), so that the
407 first non-virtual pseudo is dumped as "%0". */
408 gcc_assert (regno
> LAST_VIRTUAL_REGISTER
);
409 fprintf (outfile
, " %%%d", regno
- (LAST_VIRTUAL_REGISTER
+ 1));
412 fprintf (outfile
, " %d", regno
);
414 #ifndef GENERATOR_FILE
415 if (REG_ATTRS (in_rtx
))
417 fputs (" [", outfile
);
418 if (regno
!= ORIGINAL_REGNO (in_rtx
))
419 fprintf (outfile
, "orig:%i", ORIGINAL_REGNO (in_rtx
));
420 if (REG_EXPR (in_rtx
))
421 print_mem_expr (outfile
, REG_EXPR (in_rtx
));
423 if (REG_OFFSET (in_rtx
))
424 fprintf (outfile
, "+" HOST_WIDE_INT_PRINT_DEC
,
425 REG_OFFSET (in_rtx
));
426 fputs (" ]", outfile
);
428 if (regno
!= ORIGINAL_REGNO (in_rtx
))
429 fprintf (outfile
, " [%d]", ORIGINAL_REGNO (in_rtx
));
433 /* Subroutine of print_rtx_operand for handling code 'u'. */
436 print_rtx_operand_code_u (const_rtx in_rtx
, int idx
)
438 /* Don't print insn UIDs in compact mode, apart from in LABEL_REFs. */
439 if (flag_compact
&& GET_CODE (in_rtx
) != LABEL_REF
)
442 if (XEXP (in_rtx
, idx
) != NULL
)
444 rtx sub
= XEXP (in_rtx
, idx
);
445 enum rtx_code subc
= GET_CODE (sub
);
447 if (GET_CODE (in_rtx
) == LABEL_REF
)
450 && NOTE_KIND (sub
) == NOTE_INSN_DELETED_LABEL
)
452 if (flag_dump_unnumbered
)
453 fprintf (outfile
, " [# deleted]");
455 fprintf (outfile
, " [%d deleted]", INSN_UID (sub
));
460 if (subc
!= CODE_LABEL
)
462 print_rtx_operand_code_e (in_rtx
, idx
);
467 if (flag_dump_unnumbered
468 || (flag_dump_unnumbered_links
&& idx
<= 1
469 && (INSN_P (in_rtx
) || NOTE_P (in_rtx
)
470 || LABEL_P (in_rtx
) || BARRIER_P (in_rtx
))))
471 fputs (" #", outfile
);
473 fprintf (outfile
, " %d", INSN_UID (sub
));
476 fputs (" 0", outfile
);
480 /* Subroutine of print_rtx. Print operand IDX of IN_RTX. */
483 print_rtx_operand (const_rtx in_rtx
, int idx
)
485 const char *format_ptr
= GET_RTX_FORMAT (GET_CODE (in_rtx
));
487 switch (format_ptr
[idx
])
492 str
= XTMPL (in_rtx
, idx
);
497 str
= XSTR (in_rtx
, idx
);
501 fputs (" \"\"", outfile
);
503 fprintf (outfile
, " (\"%s\")", str
);
508 print_rtx_operand_code_0 (in_rtx
, idx
);
512 print_rtx_operand_code_e (in_rtx
, idx
);
517 print_rtx_operand_codes_E_and_V (in_rtx
, idx
);
522 fprintf (outfile
, " ");
523 fprintf (outfile
, HOST_WIDE_INT_PRINT_DEC
, XWINT (in_rtx
, idx
));
524 if (! flag_simple
&& !flag_compact
)
525 fprintf (outfile
, " [" HOST_WIDE_INT_PRINT_HEX
"]",
526 (unsigned HOST_WIDE_INT
) XWINT (in_rtx
, idx
));
530 print_rtx_operand_code_i (in_rtx
, idx
);
534 print_rtx_operand_code_r (in_rtx
);
537 /* Print NOTE_INSN names rather than integer codes. */
540 fprintf (outfile
, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx
, idx
)));
545 print_rtx_operand_code_u (in_rtx
, idx
);
549 #ifndef GENERATOR_FILE
550 if (idx
== 0 && GET_CODE (in_rtx
) == DEBUG_IMPLICIT_PTR
)
551 print_mem_expr (outfile
, DEBUG_IMPLICIT_PTR_DECL (in_rtx
));
552 else if (idx
== 0 && GET_CODE (in_rtx
) == DEBUG_PARAMETER_REF
)
553 print_mem_expr (outfile
, DEBUG_PARAMETER_REF_DECL (in_rtx
));
555 dump_addr (outfile
, " ", XTREE (in_rtx
, idx
));
560 fputs (" Unknown", outfile
);
565 /* Don't print basic block ids in compact mode. */
568 #ifndef GENERATOR_FILE
569 if (XBBDEF (in_rtx
, idx
))
570 fprintf (outfile
, " %i", XBBDEF (in_rtx
, idx
)->index
);
579 /* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
582 print_rtx (const_rtx in_rtx
)
589 fputc (' ', outfile
);
591 fprintf (outfile
, "\n%s%*s", print_rtx_head
, indent
* 2, "");
597 fputs ("(nil)", outfile
);
601 else if (GET_CODE (in_rtx
) > NUM_RTX_CODE
)
603 fprintf (outfile
, "(??? bad code %d\n%s%*s)", GET_CODE (in_rtx
),
604 print_rtx_head
, indent
* 2, "");
609 /* Print name of expression code. */
611 /* In compact mode, prefix the code of insns with "c",
612 giving "cinsn", "cnote" etc. */
613 if (flag_compact
&& is_a
<const rtx_insn
*, const struct rtx_def
> (in_rtx
))
615 /* "ccode_label" is slightly awkward, so special-case it as
617 rtx_code code
= GET_CODE (in_rtx
);
618 if (code
== CODE_LABEL
)
619 fprintf (outfile
, "(clabel");
621 fprintf (outfile
, "(c%s", GET_RTX_NAME (code
));
623 else if (flag_simple
&& CONST_INT_P (in_rtx
))
624 fputc ('(', outfile
);
626 fprintf (outfile
, "(%s", GET_RTX_NAME (GET_CODE (in_rtx
)));
630 if (RTX_FLAG (in_rtx
, in_struct
))
631 fputs ("/s", outfile
);
633 if (RTX_FLAG (in_rtx
, volatil
))
634 fputs ("/v", outfile
);
636 if (RTX_FLAG (in_rtx
, unchanging
))
637 fputs ("/u", outfile
);
639 if (RTX_FLAG (in_rtx
, frame_related
))
640 fputs ("/f", outfile
);
642 if (RTX_FLAG (in_rtx
, jump
))
643 fputs ("/j", outfile
);
645 if (RTX_FLAG (in_rtx
, call
))
646 fputs ("/c", outfile
);
648 if (RTX_FLAG (in_rtx
, return_val
))
649 fputs ("/i", outfile
);
651 /* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
652 if ((GET_CODE (in_rtx
) == EXPR_LIST
653 || GET_CODE (in_rtx
) == INSN_LIST
654 || GET_CODE (in_rtx
) == INT_LIST
)
655 && (int)GET_MODE (in_rtx
) < REG_NOTE_MAX
656 && !in_call_function_usage
)
657 fprintf (outfile
, ":%s",
658 GET_REG_NOTE_NAME (GET_MODE (in_rtx
)));
660 /* For other rtl, print the mode if it's not VOID. */
661 else if (GET_MODE (in_rtx
) != VOIDmode
)
662 fprintf (outfile
, ":%s", GET_MODE_NAME (GET_MODE (in_rtx
)));
664 #ifndef GENERATOR_FILE
665 if (GET_CODE (in_rtx
) == VAR_LOCATION
)
667 if (TREE_CODE (PAT_VAR_LOCATION_DECL (in_rtx
)) == STRING_CST
)
668 fputs (" <debug string placeholder>", outfile
);
670 print_mem_expr (outfile
, PAT_VAR_LOCATION_DECL (in_rtx
));
671 fputc (' ', outfile
);
672 print_rtx (PAT_VAR_LOCATION_LOC (in_rtx
));
673 if (PAT_VAR_LOCATION_STATUS (in_rtx
)
674 == VAR_INIT_STATUS_UNINITIALIZED
)
675 fprintf (outfile
, " [uninit]");
677 idx
= GET_RTX_LENGTH (VAR_LOCATION
);
682 #ifndef GENERATOR_FILE
683 if (CONST_DOUBLE_AS_FLOAT_P (in_rtx
))
687 /* For insns, print the INSN_UID.
688 In compact mode, we only print the INSN_UID of CODE_LABELs. */
689 if (INSN_CHAIN_CODE_P (GET_CODE (in_rtx
))
690 && (!flag_compact
|| GET_CODE (in_rtx
) == CODE_LABEL
))
692 if (flag_dump_unnumbered
)
693 fprintf (outfile
, " #");
695 fprintf (outfile
, " %d", INSN_UID (in_rtx
));
698 /* Get the format string and skip the first elements if we have handled
700 for (; idx
< GET_RTX_LENGTH (GET_CODE (in_rtx
)); idx
++)
701 print_rtx_operand (in_rtx
, idx
);
703 switch (GET_CODE (in_rtx
))
705 #ifndef GENERATOR_FILE
707 if (__builtin_expect (final_insns_dump_p
, false))
708 fprintf (outfile
, " [");
710 fprintf (outfile
, " [" HOST_WIDE_INT_PRINT_DEC
,
711 (HOST_WIDE_INT
) MEM_ALIAS_SET (in_rtx
));
713 if (MEM_EXPR (in_rtx
))
714 print_mem_expr (outfile
, MEM_EXPR (in_rtx
));
716 fputc (' ', outfile
);
718 if (MEM_OFFSET_KNOWN_P (in_rtx
))
719 fprintf (outfile
, "+" HOST_WIDE_INT_PRINT_DEC
, MEM_OFFSET (in_rtx
));
721 if (MEM_SIZE_KNOWN_P (in_rtx
))
722 fprintf (outfile
, " S" HOST_WIDE_INT_PRINT_DEC
, MEM_SIZE (in_rtx
));
724 if (MEM_ALIGN (in_rtx
) != 1)
725 fprintf (outfile
, " A%u", MEM_ALIGN (in_rtx
));
727 if (!ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (in_rtx
)))
728 fprintf (outfile
, " AS%u", MEM_ADDR_SPACE (in_rtx
));
730 fputc (']', outfile
);
734 if (FLOAT_MODE_P (GET_MODE (in_rtx
)))
738 real_to_decimal (s
, CONST_DOUBLE_REAL_VALUE (in_rtx
),
740 fprintf (outfile
, " %s", s
);
742 real_to_hexadecimal (s
, CONST_DOUBLE_REAL_VALUE (in_rtx
),
744 fprintf (outfile
, " [%s]", s
);
749 fprintf (outfile
, " ");
750 cwi_output_hex (outfile
, in_rtx
);
756 fprintf (outfile
, " [%d uses]", LABEL_NUSES (in_rtx
));
757 switch (LABEL_KIND (in_rtx
))
759 case LABEL_NORMAL
: break;
760 case LABEL_STATIC_ENTRY
: fputs (" [entry]", outfile
); break;
761 case LABEL_GLOBAL_ENTRY
: fputs (" [global entry]", outfile
); break;
762 case LABEL_WEAK_ENTRY
: fputs (" [weak entry]", outfile
); break;
763 default: gcc_unreachable ();
771 fputc (')', outfile
);
775 /* Print an rtx on the current line of FILE. Initially indent IND
779 print_inline_rtx (FILE *outf
, const_rtx x
, int ind
)
781 int oldsaw
= sawclose
;
782 int oldindent
= indent
;
792 /* Call this function from the debugger to see what X looks like. */
795 debug_rtx (const_rtx x
)
800 fprintf (stderr
, "\n");
806 debug (const rtx_def
&ref
)
812 debug (const rtx_def
*ptr
)
817 fprintf (stderr
, "<nil>\n");
820 /* Count of rtx's to print with debug_rtx_list.
821 This global exists because gdb user defined commands have no arguments. */
823 DEBUG_VARIABLE
int debug_rtx_count
= 0; /* 0 is treated as equivalent to 1 */
825 /* Call this function to print list from X on.
827 N is a count of the rtx's to print. Positive values print from the specified
828 rtx_insn on. Negative values print a window around the rtx_insn.
829 EG: -5 prints 2 rtx_insn's on either side (in addition to the specified
833 debug_rtx_list (const rtx_insn
*x
, int n
)
836 const rtx_insn
*insn
;
838 count
= n
== 0 ? 1 : n
< 0 ? -n
: n
;
840 /* If we are printing a window, back up to the start. */
843 for (i
= count
/ 2; i
> 0; i
--)
845 if (PREV_INSN (x
) == 0)
850 for (i
= count
, insn
= x
; i
> 0 && insn
!= 0; i
--, insn
= NEXT_INSN (insn
))
853 fprintf (stderr
, "\n");
857 /* Call this function to print an rtx_insn list from START to END
861 debug_rtx_range (const rtx_insn
*start
, const rtx_insn
*end
)
866 fprintf (stderr
, "\n");
867 if (!start
|| start
== end
)
869 start
= NEXT_INSN (start
);
873 /* Call this function to search an rtx_insn list to find one with insn uid UID,
874 and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
875 The found insn is returned to enable further debugging analysis. */
877 DEBUG_FUNCTION
const rtx_insn
*
878 debug_rtx_find (const rtx_insn
*x
, int uid
)
880 while (x
!= 0 && INSN_UID (x
) != uid
)
884 debug_rtx_list (x
, debug_rtx_count
);
889 fprintf (stderr
, "insn uid %d not found\n", uid
);
894 /* External entry point for printing a chain of insns
895 starting with RTX_FIRST onto file OUTF.
896 A blank line separates insns.
898 If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
901 print_rtl (FILE *outf
, const_rtx rtx_first
)
903 const rtx_insn
*tmp_rtx
;
910 fputs (print_rtx_head
, outf
);
911 fputs ("(nil)\n", outf
);
914 switch (GET_CODE (rtx_first
))
921 case JUMP_TABLE_DATA
:
923 for (tmp_rtx
= as_a
<const rtx_insn
*> (rtx_first
);
925 tmp_rtx
= NEXT_INSN (tmp_rtx
))
927 fputs (print_rtx_head
, outfile
);
929 fprintf (outfile
, "\n");
934 fputs (print_rtx_head
, outfile
);
935 print_rtx (rtx_first
);
939 /* Like print_rtx, except specify a file. */
940 /* Return nonzero if we actually printed anything. */
943 print_rtl_single (FILE *outf
, const_rtx x
)
945 return print_rtl_single_with_indent (outf
, x
, 0);
948 /* Like print_rtl_single, except specify a file and indentation. */
951 print_rtl_single_with_indent (FILE *outf
, const_rtx x
, int ind
)
953 int old_indent
= indent
;
954 char *s_indent
= (char *) alloca ((size_t) ind
+ 1);
955 memset ((void *) s_indent
, ' ', (size_t) ind
);
956 s_indent
[ind
] = '\0';
961 fputs (s_indent
, outfile
);
962 fputs (print_rtx_head
, outfile
);
970 /* Like print_rtl except without all the detail; for example,
971 if RTX is a CONST_INT then print in decimal format. */
974 print_simple_rtl (FILE *outf
, const_rtx x
)
981 /* Print the elements of VEC to FILE. */
984 print_rtx_insn_vec (FILE *file
, const vec
<rtx_insn
*> &vec
)
988 unsigned int len
= vec
.length ();
989 for (unsigned int i
= 0; i
< len
; i
++)
991 print_rtl (file
, vec
[i
]);
999 #ifndef GENERATOR_FILE
1000 /* The functions below try to print RTL in a form resembling assembler
1001 mnemonics. Because this form is more concise than the "traditional" form
1002 of RTL printing in Lisp-style, the form printed by this file is called
1003 "slim". RTL dumps in slim format can be obtained by appending the "-slim"
1004 option to -fdump-rtl-<pass>. Control flow graph output as a DOT file is
1005 always printed in slim form.
1007 The normal interface to the functionality provided in this pretty-printer
1008 is through the dump_*_slim functions to print to a stream, or via the
1009 print_*_slim functions to print into a user's pretty-printer.
1011 It is also possible to obtain a string for a single pattern as a string
1012 pointer, via str_pattern_slim, but this usage is discouraged. */
1014 /* For insns we print patterns, and for some patterns we print insns... */
1015 static void print_insn_with_notes (pretty_printer
*, const rtx_insn
*);
1017 /* This recognizes rtx'en classified as expressions. These are always
1018 represent some action on values or results of other expression, that
1019 may be stored in objects representing values. */
1022 print_exp (pretty_printer
*pp
, const_rtx x
, int verbose
)
1030 for (i
= 0; i
< 4; i
++)
1036 switch (GET_CODE (x
))
1039 op
[0] = XEXP (x
, 0);
1040 if (CONST_INT_P (XEXP (x
, 1))
1041 && INTVAL (XEXP (x
, 1)) < 0)
1044 op
[1] = GEN_INT (-INTVAL (XEXP (x
, 1)));
1049 op
[1] = XEXP (x
, 1);
1053 op
[0] = XEXP (x
, 0);
1055 op
[1] = XEXP (x
, 1);
1059 op
[0] = XEXP (x
, 0);
1061 op
[1] = XEXP (x
, 1);
1065 op
[0] = XEXP (x
, 0);
1066 op
[1] = XEXP (x
, 1);
1070 op
[0] = XEXP (x
, 0);
1074 op
[0] = XEXP (x
, 0);
1076 op
[1] = XEXP (x
, 1);
1078 op
[2] = XEXP (x
, 2);
1082 op
[0] = XEXP (x
, 0);
1084 op
[1] = XEXP (x
, 1);
1087 op
[0] = XEXP (x
, 0);
1089 op
[1] = XEXP (x
, 1);
1093 op
[0] = XEXP (x
, 0);
1094 op
[1] = XEXP (x
, 1);
1097 op
[0] = XEXP (x
, 0);
1099 op
[1] = XEXP (x
, 1);
1103 op
[0] = XEXP (x
, 0);
1104 op
[1] = XEXP (x
, 1);
1108 op
[0] = XEXP (x
, 0);
1109 op
[1] = XEXP (x
, 1);
1113 op
[0] = XEXP (x
, 0);
1114 op
[1] = XEXP (x
, 1);
1118 op
[0] = XEXP (x
, 0);
1119 op
[1] = XEXP (x
, 1);
1123 op
[0] = XEXP (x
, 0);
1124 op
[1] = XEXP (x
, 1);
1128 op
[0] = XEXP (x
, 0);
1131 op
[0] = XEXP (x
, 0);
1133 op
[1] = XEXP (x
, 1);
1136 op
[0] = XEXP (x
, 0);
1138 op
[1] = XEXP (x
, 1);
1141 op
[0] = XEXP (x
, 0);
1143 op
[1] = XEXP (x
, 1);
1146 op
[0] = XEXP (x
, 0);
1148 op
[1] = XEXP (x
, 1);
1151 op
[0] = XEXP (x
, 0);
1153 op
[1] = XEXP (x
, 1);
1156 op
[0] = XEXP (x
, 0);
1158 op
[1] = XEXP (x
, 1);
1161 op
[0] = XEXP (x
, 0);
1163 op
[1] = XEXP (x
, 1);
1166 op
[0] = XEXP (x
, 0);
1168 op
[1] = XEXP (x
, 1);
1171 op
[0] = XEXP (x
, 0);
1173 op
[1] = XEXP (x
, 1);
1176 op
[0] = XEXP (x
, 0);
1178 op
[1] = XEXP (x
, 1);
1181 op
[0] = XEXP (x
, 0);
1183 op
[1] = XEXP (x
, 1);
1186 op
[0] = XEXP (x
, 0);
1188 op
[1] = XEXP (x
, 1);
1191 op
[0] = XEXP (x
, 0);
1193 op
[1] = XEXP (x
, 1);
1196 op
[0] = XEXP (x
, 0);
1198 op
[1] = XEXP (x
, 1);
1201 fun
= (verbose
) ? "sign_extract" : "sxt";
1202 op
[0] = XEXP (x
, 0);
1203 op
[1] = XEXP (x
, 1);
1204 op
[2] = XEXP (x
, 2);
1207 fun
= (verbose
) ? "zero_extract" : "zxt";
1208 op
[0] = XEXP (x
, 0);
1209 op
[1] = XEXP (x
, 1);
1210 op
[2] = XEXP (x
, 2);
1213 fun
= (verbose
) ? "sign_extend" : "sxn";
1214 op
[0] = XEXP (x
, 0);
1217 fun
= (verbose
) ? "zero_extend" : "zxn";
1218 op
[0] = XEXP (x
, 0);
1221 fun
= (verbose
) ? "float_extend" : "fxn";
1222 op
[0] = XEXP (x
, 0);
1225 fun
= (verbose
) ? "trunc" : "trn";
1226 op
[0] = XEXP (x
, 0);
1228 case FLOAT_TRUNCATE
:
1229 fun
= (verbose
) ? "float_trunc" : "ftr";
1230 op
[0] = XEXP (x
, 0);
1233 fun
= (verbose
) ? "float" : "flt";
1234 op
[0] = XEXP (x
, 0);
1236 case UNSIGNED_FLOAT
:
1237 fun
= (verbose
) ? "uns_float" : "ufl";
1238 op
[0] = XEXP (x
, 0);
1242 op
[0] = XEXP (x
, 0);
1245 fun
= (verbose
) ? "uns_fix" : "ufx";
1246 op
[0] = XEXP (x
, 0);
1250 op
[0] = XEXP (x
, 0);
1254 op
[0] = XEXP (x
, 0);
1257 op
[0] = XEXP (x
, 0);
1261 op
[0] = XEXP (x
, 0);
1266 op
[0] = XEXP (XEXP (x
, 1), 0);
1268 op
[1] = XEXP (XEXP (x
, 1), 1);
1272 op
[0] = XEXP (XEXP (x
, 1), 0);
1274 op
[1] = XEXP (XEXP (x
, 1), 1);
1278 op
[0] = XEXP (x
, 0);
1282 op
[1] = XEXP (x
, 1);
1287 op
[0] = XEXP (x
, 0);
1289 op
[1] = XEXP (x
, 1);
1291 op
[2] = XEXP (x
, 2);
1296 op
[0] = TRAP_CONDITION (x
);
1300 op
[0] = XEXP (x
, 0);
1301 op
[1] = XEXP (x
, 1);
1302 op
[2] = XEXP (x
, 2);
1305 case UNSPEC_VOLATILE
:
1307 pp_string (pp
, "unspec");
1308 if (GET_CODE (x
) == UNSPEC_VOLATILE
)
1309 pp_string (pp
, "/v");
1310 pp_left_bracket (pp
);
1311 for (i
= 0; i
< XVECLEN (x
, 0); i
++)
1315 print_pattern (pp
, XVECEXP (x
, 0, i
), verbose
);
1317 pp_string (pp
, "] ");
1318 pp_decimal_int (pp
, XINT (x
, 1));
1323 /* Most unhandled codes can be printed as pseudo-functions. */
1324 if (GET_RTX_CLASS (GET_CODE (x
)) == RTX_UNARY
)
1326 fun
= GET_RTX_NAME (GET_CODE (x
));
1327 op
[0] = XEXP (x
, 0);
1329 else if (GET_RTX_CLASS (GET_CODE (x
)) == RTX_COMPARE
1330 || GET_RTX_CLASS (GET_CODE (x
)) == RTX_COMM_COMPARE
1331 || GET_RTX_CLASS (GET_CODE (x
)) == RTX_BIN_ARITH
1332 || GET_RTX_CLASS (GET_CODE (x
)) == RTX_COMM_ARITH
)
1334 fun
= GET_RTX_NAME (GET_CODE (x
));
1335 op
[0] = XEXP (x
, 0);
1336 op
[1] = XEXP (x
, 1);
1338 else if (GET_RTX_CLASS (GET_CODE (x
)) == RTX_TERNARY
)
1340 fun
= GET_RTX_NAME (GET_CODE (x
));
1341 op
[0] = XEXP (x
, 0);
1342 op
[1] = XEXP (x
, 1);
1343 op
[2] = XEXP (x
, 2);
1346 /* Give up, just print the RTX name. */
1347 st
[0] = GET_RTX_NAME (GET_CODE (x
));
1352 /* Print this as a function? */
1355 pp_string (pp
, fun
);
1359 for (i
= 0; i
< 4; i
++)
1362 pp_string (pp
, st
[i
]);
1368 print_value (pp
, op
[i
], verbose
);
1373 pp_right_paren (pp
);
1376 /* Prints rtxes, I customarily classified as values. They're constants,
1377 registers, labels, symbols and memory accesses. */
1380 print_value (pretty_printer
*pp
, const_rtx x
, int verbose
)
1386 pp_string (pp
, "(nil)");
1389 switch (GET_CODE (x
))
1392 pp_scalar (pp
, HOST_WIDE_INT_PRINT_HEX
,
1393 (unsigned HOST_WIDE_INT
) INTVAL (x
));
1396 case CONST_WIDE_INT
:
1398 const char *sep
= "<";
1400 for (i
= CONST_WIDE_INT_NUNITS (x
) - 1; i
>= 0; i
--)
1402 pp_string (pp
, sep
);
1404 sprintf (tmp
, HOST_WIDE_INT_PRINT_HEX
,
1405 (unsigned HOST_WIDE_INT
) CONST_WIDE_INT_ELT (x
, i
));
1406 pp_string (pp
, tmp
);
1413 if (FLOAT_MODE_P (GET_MODE (x
)))
1415 real_to_decimal (tmp
, CONST_DOUBLE_REAL_VALUE (x
),
1416 sizeof (tmp
), 0, 1);
1417 pp_string (pp
, tmp
);
1420 pp_printf (pp
, "<%wx,%wx>",
1421 (unsigned HOST_WIDE_INT
) CONST_DOUBLE_LOW (x
),
1422 (unsigned HOST_WIDE_INT
) CONST_DOUBLE_HIGH (x
));
1425 fixed_to_decimal (tmp
, CONST_FIXED_VALUE (x
), sizeof (tmp
));
1426 pp_string (pp
, tmp
);
1429 pp_printf (pp
, "\"%s\"", XSTR (x
, 0));
1432 pp_printf (pp
, "`%s'", XSTR (x
, 0));
1435 pp_printf (pp
, "L%d", INSN_UID (label_ref_label (x
)));
1439 case STRICT_LOW_PART
:
1440 pp_printf (pp
, "%s(", GET_RTX_NAME (GET_CODE (x
)));
1441 print_value (pp
, XEXP (x
, 0), verbose
);
1442 pp_right_paren (pp
);
1445 if (REGNO (x
) < FIRST_PSEUDO_REGISTER
)
1447 if (ISDIGIT (reg_names
[REGNO (x
)][0]))
1449 pp_string (pp
, reg_names
[REGNO (x
)]);
1452 pp_printf (pp
, "r%d", REGNO (x
));
1454 pp_printf (pp
, ":%s", GET_MODE_NAME (GET_MODE (x
)));
1457 print_value (pp
, SUBREG_REG (x
), verbose
);
1458 pp_printf (pp
, "#%d", SUBREG_BYTE (x
));
1463 pp_string (pp
, GET_RTX_NAME (GET_CODE (x
)));
1466 pp_left_bracket (pp
);
1467 print_value (pp
, XEXP (x
, 0), verbose
);
1468 pp_right_bracket (pp
);
1471 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x
)));
1474 print_exp (pp
, x
, verbose
);
1479 /* The next step in insn detalization, its pattern recognition. */
1482 print_pattern (pretty_printer
*pp
, const_rtx x
, int verbose
)
1486 pp_string (pp
, "(nil)");
1490 switch (GET_CODE (x
))
1493 print_value (pp
, SET_DEST (x
), verbose
);
1495 print_value (pp
, SET_SRC (x
), verbose
);
1500 pp_string (pp
, GET_RTX_NAME (GET_CODE (x
)));
1503 print_exp (pp
, x
, verbose
);
1507 pp_printf (pp
, "%s ", GET_RTX_NAME (GET_CODE (x
)));
1508 print_value (pp
, XEXP (x
, 0), verbose
);
1511 pp_string (pp
, "loc ");
1512 print_value (pp
, PAT_VAR_LOCATION_LOC (x
), verbose
);
1516 if (GET_CODE (COND_EXEC_TEST (x
)) == NE
1517 && XEXP (COND_EXEC_TEST (x
), 1) == const0_rtx
)
1518 print_value (pp
, XEXP (COND_EXEC_TEST (x
), 0), verbose
);
1519 else if (GET_CODE (COND_EXEC_TEST (x
)) == EQ
1520 && XEXP (COND_EXEC_TEST (x
), 1) == const0_rtx
)
1522 pp_exclamation (pp
);
1523 print_value (pp
, XEXP (COND_EXEC_TEST (x
), 0), verbose
);
1526 print_value (pp
, COND_EXEC_TEST (x
), verbose
);
1527 pp_string (pp
, ") ");
1528 print_pattern (pp
, COND_EXEC_CODE (x
), verbose
);
1535 for (i
= 0; i
< XVECLEN (x
, 0); i
++)
1537 print_pattern (pp
, XVECEXP (x
, 0, i
), verbose
);
1540 pp_right_brace (pp
);
1545 const rtx_sequence
*seq
= as_a
<const rtx_sequence
*> (x
);
1546 pp_string (pp
, "sequence{");
1547 if (INSN_P (seq
->element (0)))
1549 /* Print the sequence insns indented. */
1550 const char * save_print_rtx_head
= print_rtx_head
;
1551 char indented_print_rtx_head
[32];
1554 gcc_assert (strlen (print_rtx_head
) < sizeof (indented_print_rtx_head
) - 4);
1555 snprintf (indented_print_rtx_head
,
1556 sizeof (indented_print_rtx_head
),
1557 "%s ", print_rtx_head
);
1558 print_rtx_head
= indented_print_rtx_head
;
1559 for (int i
= 0; i
< seq
->len (); i
++)
1560 print_insn_with_notes (pp
, seq
->insn (i
));
1561 pp_printf (pp
, "%s ", save_print_rtx_head
);
1562 print_rtx_head
= save_print_rtx_head
;
1566 for (int i
= 0; i
< seq
->len (); i
++)
1568 print_pattern (pp
, seq
->element (i
), verbose
);
1572 pp_right_brace (pp
);
1576 pp_printf (pp
, "asm {%s}", XSTR (x
, 0));
1579 for (int i
= 0; i
< XVECLEN (x
, 0); i
++)
1581 print_value (pp
, XVECEXP (x
, 0, i
), verbose
);
1586 for (int i
= 0; i
< XVECLEN (x
, 1); i
++)
1588 print_value (pp
, XVECEXP (x
, 1, i
), verbose
);
1593 pp_string (pp
, "trap_if ");
1594 print_value (pp
, TRAP_CONDITION (x
), verbose
);
1597 case UNSPEC_VOLATILE
:
1598 /* Fallthru -- leave UNSPECs to print_exp. */
1600 print_value (pp
, x
, verbose
);
1602 } /* print_pattern */
1604 /* This is the main function in slim rtl visualization mechanism.
1606 X is an insn, to be printed into PP.
1608 This function tries to print it properly in human-readable form,
1609 resembling assembler mnemonics (instead of the older Lisp-style
1612 If VERBOSE is TRUE, insns are printed with more complete (but
1613 longer) pattern names and with extra information, and prefixed
1614 with their INSN_UIDs. */
1617 print_insn (pretty_printer
*pp
, const rtx_insn
*x
, int verbose
)
1621 /* Blech, pretty-print can't print integers with a specified width. */
1622 char uid_prefix
[32];
1623 snprintf (uid_prefix
, sizeof uid_prefix
, " %4d: ", INSN_UID (x
));
1624 pp_string (pp
, uid_prefix
);
1627 switch (GET_CODE (x
))
1630 print_pattern (pp
, PATTERN (x
), verbose
);
1635 const char *name
= "?";
1637 if (DECL_P (INSN_VAR_LOCATION_DECL (x
)))
1639 tree id
= DECL_NAME (INSN_VAR_LOCATION_DECL (x
));
1642 name
= IDENTIFIER_POINTER (id
);
1643 else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x
))
1646 sprintf (idbuf
, "D#%i",
1647 DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (x
)));
1652 sprintf (idbuf
, "D.%i",
1653 DECL_UID (INSN_VAR_LOCATION_DECL (x
)));
1657 pp_printf (pp
, "debug %s => ", name
);
1658 if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (x
)))
1659 pp_string (pp
, "optimized away");
1661 print_pattern (pp
, INSN_VAR_LOCATION_LOC (x
), verbose
);
1666 print_pattern (pp
, PATTERN (x
), verbose
);
1669 if (GET_CODE (PATTERN (x
)) == PARALLEL
)
1670 print_pattern (pp
, XVECEXP (PATTERN (x
), 0, 0), verbose
);
1672 print_pattern (pp
, PATTERN (x
), verbose
);
1675 pp_printf (pp
, "L%d:", INSN_UID (x
));
1677 case JUMP_TABLE_DATA
:
1678 pp_string (pp
, "jump_table_data{\n");
1679 print_pattern (pp
, PATTERN (x
), verbose
);
1680 pp_right_brace (pp
);
1683 pp_string (pp
, "barrier");
1687 pp_string (pp
, GET_NOTE_INSN_NAME (NOTE_KIND (x
)));
1688 switch (NOTE_KIND (x
))
1690 case NOTE_INSN_EH_REGION_BEG
:
1691 case NOTE_INSN_EH_REGION_END
:
1692 pp_printf (pp
, " %d", NOTE_EH_HANDLER (x
));
1695 case NOTE_INSN_BLOCK_BEG
:
1696 case NOTE_INSN_BLOCK_END
:
1697 pp_printf (pp
, " %d", BLOCK_NUMBER (NOTE_BLOCK (x
)));
1700 case NOTE_INSN_BASIC_BLOCK
:
1701 pp_printf (pp
, " %d", NOTE_BASIC_BLOCK (x
)->index
);
1704 case NOTE_INSN_DELETED_LABEL
:
1705 case NOTE_INSN_DELETED_DEBUG_LABEL
:
1707 const char *label
= NOTE_DELETED_LABEL_NAME (x
);
1710 pp_printf (pp
, " (\"%s\")", label
);
1714 case NOTE_INSN_VAR_LOCATION
:
1715 case NOTE_INSN_CALL_ARG_LOCATION
:
1717 print_pattern (pp
, NOTE_VAR_LOCATION (x
), verbose
);
1718 pp_right_brace (pp
);
1731 /* Pretty-print a slim dump of X (an insn) to PP, including any register
1732 note attached to the instruction. */
1735 print_insn_with_notes (pretty_printer
*pp
, const rtx_insn
*x
)
1737 pp_string (pp
, print_rtx_head
);
1738 print_insn (pp
, x
, 1);
1740 if (INSN_P (x
) && REG_NOTES (x
))
1741 for (rtx note
= REG_NOTES (x
); note
; note
= XEXP (note
, 1))
1743 pp_printf (pp
, "%s %s ", print_rtx_head
,
1744 GET_REG_NOTE_NAME (REG_NOTE_KIND (note
)));
1745 if (GET_CODE (note
) == INT_LIST
)
1746 pp_printf (pp
, "%d", XINT (note
, 0));
1748 print_pattern (pp
, XEXP (note
, 0), 1);
1753 /* Print X, an RTL value node, to file F in slim format. Include
1754 additional information if VERBOSE is nonzero.
1756 Value nodes are constants, registers, labels, symbols and
1760 dump_value_slim (FILE *f
, const_rtx x
, int verbose
)
1762 pretty_printer rtl_slim_pp
;
1763 rtl_slim_pp
.buffer
->stream
= f
;
1764 print_value (&rtl_slim_pp
, x
, verbose
);
1765 pp_flush (&rtl_slim_pp
);
1768 /* Emit a slim dump of X (an insn) to the file F, including any register
1769 note attached to the instruction. */
1771 dump_insn_slim (FILE *f
, const rtx_insn
*x
)
1773 pretty_printer rtl_slim_pp
;
1774 rtl_slim_pp
.buffer
->stream
= f
;
1775 print_insn_with_notes (&rtl_slim_pp
, x
);
1776 pp_flush (&rtl_slim_pp
);
1779 /* Same as above, but stop at LAST or when COUNT == 0.
1780 If COUNT < 0 it will stop only at LAST or NULL rtx. */
1783 dump_rtl_slim (FILE *f
, const rtx_insn
*first
, const rtx_insn
*last
,
1784 int count
, int flags ATTRIBUTE_UNUSED
)
1786 const rtx_insn
*insn
, *tail
;
1787 pretty_printer rtl_slim_pp
;
1788 rtl_slim_pp
.buffer
->stream
= f
;
1790 tail
= last
? NEXT_INSN (last
) : NULL
;
1792 (insn
!= NULL
) && (insn
!= tail
) && (count
!= 0);
1793 insn
= NEXT_INSN (insn
))
1795 print_insn_with_notes (&rtl_slim_pp
, insn
);
1800 pp_flush (&rtl_slim_pp
);
1803 /* Dumps basic block BB to pretty-printer PP in slim form and without and
1804 no indentation, for use as a label of a DOT graph record-node. */
1807 rtl_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
1812 /* TODO: inter-bb stuff. */
1813 FOR_BB_INSNS (bb
, insn
)
1818 pp_write_text_to_stream (pp
);
1821 print_insn_with_notes (pp
, insn
);
1822 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
1826 /* Pretty-print pattern X of some insn in non-verbose mode.
1827 Return a string pointer to the pretty-printer buffer.
1829 This function is only exported exists only to accommodate some older users
1830 of the slim RTL pretty printers. Please do not use it for new code. */
1833 str_pattern_slim (const_rtx x
)
1835 pretty_printer rtl_slim_pp
;
1836 print_pattern (&rtl_slim_pp
, x
, 0);
1837 return ggc_strdup (pp_formatted_text (&rtl_slim_pp
));
1840 /* Emit a slim dump of X (an insn) to stderr. */
1841 extern void debug_insn_slim (const rtx_insn
*);
1843 debug_insn_slim (const rtx_insn
*x
)
1845 dump_insn_slim (stderr
, x
);
1848 /* Same as above, but using dump_rtl_slim. */
1849 extern void debug_rtl_slim (FILE *, const rtx_insn
*, const rtx_insn
*,
1852 debug_rtl_slim (const rtx_insn
*first
, const rtx_insn
*last
, int count
,
1855 dump_rtl_slim (stderr
, first
, last
, count
, flags
);
1858 extern void debug_bb_slim (basic_block
);
1860 debug_bb_slim (basic_block bb
)
1862 dump_bb (stderr
, bb
, 0, TDF_SLIM
| TDF_BLOCKS
);
1865 extern void debug_bb_n_slim (int);
1867 debug_bb_n_slim (int n
)
1869 basic_block bb
= BASIC_BLOCK_FOR_FN (cfun
, n
);