annotate gcc/print-rtl.c @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Print RTL for GCC.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 1987-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 /* This file is compiled twice: once for the generator programs,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 once for the compiler. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #ifdef GENERATOR_FILE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "bconfig.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "config.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #include "coretypes.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #include "tm.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #include "rtl.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 /* These headers all define things which are not available in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 generator programs. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 #ifndef GENERATOR_FILE
111
kono
parents: 67
diff changeset
36 #include "alias.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 #include "tree.h"
111
kono
parents: 67
diff changeset
38 #include "basic-block.h"
kono
parents: 67
diff changeset
39 #include "print-tree.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 #include "flags.h"
111
kono
parents: 67
diff changeset
41 #include "predict.h"
kono
parents: 67
diff changeset
42 #include "function.h"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 #include "cfg.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 #include "basic-block.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
45 #include "diagnostic.h"
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
46 #include "tree-pretty-print.h"
111
kono
parents: 67
diff changeset
47 #include "alloc-pool.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 #include "cselib.h"
111
kono
parents: 67
diff changeset
49 #include "dumpfile.h" /* for dump_flags */
kono
parents: 67
diff changeset
50 #include "dwarf2out.h"
kono
parents: 67
diff changeset
51 #include "pretty-print.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
111
kono
parents: 67
diff changeset
54 #include "print-rtl.h"
kono
parents: 67
diff changeset
55 #include "rtl-iter.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 /* String printed at beginning of each RTL when it is dumped.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 This string is set to ASM_COMMENT_START when the RTL is dumped in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 the assembly output file. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 const char *print_rtx_head = "";
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
62 #ifdef GENERATOR_FILE
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
63 /* These are defined from the .opt file when not used in generator
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
64 programs. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
65
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 /* Nonzero means suppress output of instruction numbers
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 in debugging dumps.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 This must be defined here so that programs like gencodes can be linked. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 int flag_dump_unnumbered = 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
71 /* Nonzero means suppress output of instruction numbers for previous
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
72 and next insns in debugging dumps.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
73 This must be defined here so that programs like gencodes can be linked. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
74 int flag_dump_unnumbered_links = 0;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
75 #endif
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
76
111
kono
parents: 67
diff changeset
77 /* Constructor for rtx_writer. */
kono
parents: 67
diff changeset
78
kono
parents: 67
diff changeset
79 rtx_writer::rtx_writer (FILE *outf, int ind, bool simple, bool compact,
kono
parents: 67
diff changeset
80 rtx_reuse_manager *reuse_manager)
kono
parents: 67
diff changeset
81 : m_outfile (outf), m_sawclose (0), m_indent (ind),
kono
parents: 67
diff changeset
82 m_in_call_function_usage (false), m_simple (simple), m_compact (compact),
kono
parents: 67
diff changeset
83 m_rtx_reuse_manager (reuse_manager)
kono
parents: 67
diff changeset
84 {
kono
parents: 67
diff changeset
85 }
kono
parents: 67
diff changeset
86
kono
parents: 67
diff changeset
87 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
88
kono
parents: 67
diff changeset
89 /* rtx_reuse_manager's ctor. */
kono
parents: 67
diff changeset
90
kono
parents: 67
diff changeset
91 rtx_reuse_manager::rtx_reuse_manager ()
kono
parents: 67
diff changeset
92 : m_next_id (0)
kono
parents: 67
diff changeset
93 {
kono
parents: 67
diff changeset
94 }
kono
parents: 67
diff changeset
95
kono
parents: 67
diff changeset
96 /* Determine if X is of a kind suitable for dumping via reuse_rtx. */
kono
parents: 67
diff changeset
97
kono
parents: 67
diff changeset
98 static bool
kono
parents: 67
diff changeset
99 uses_rtx_reuse_p (const_rtx x)
kono
parents: 67
diff changeset
100 {
kono
parents: 67
diff changeset
101 if (x == NULL)
kono
parents: 67
diff changeset
102 return false;
kono
parents: 67
diff changeset
103
kono
parents: 67
diff changeset
104 switch (GET_CODE (x))
kono
parents: 67
diff changeset
105 {
kono
parents: 67
diff changeset
106 case DEBUG_EXPR:
kono
parents: 67
diff changeset
107 case VALUE:
kono
parents: 67
diff changeset
108 case SCRATCH:
kono
parents: 67
diff changeset
109 return true;
kono
parents: 67
diff changeset
110
kono
parents: 67
diff changeset
111 /* We don't use reuse_rtx for consts. */
kono
parents: 67
diff changeset
112 CASE_CONST_UNIQUE:
kono
parents: 67
diff changeset
113 default:
kono
parents: 67
diff changeset
114 return false;
kono
parents: 67
diff changeset
115 }
kono
parents: 67
diff changeset
116 }
kono
parents: 67
diff changeset
117
kono
parents: 67
diff changeset
118 /* Traverse X and its descendents, determining if we see any rtx more than
kono
parents: 67
diff changeset
119 once. Any rtx suitable for "reuse_rtx" that is seen more than once is
kono
parents: 67
diff changeset
120 assigned an ID. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121
111
kono
parents: 67
diff changeset
122 void
kono
parents: 67
diff changeset
123 rtx_reuse_manager::preprocess (const_rtx x)
kono
parents: 67
diff changeset
124 {
kono
parents: 67
diff changeset
125 subrtx_iterator::array_type array;
kono
parents: 67
diff changeset
126 FOR_EACH_SUBRTX (iter, array, x, NONCONST)
kono
parents: 67
diff changeset
127 if (uses_rtx_reuse_p (*iter))
kono
parents: 67
diff changeset
128 {
kono
parents: 67
diff changeset
129 if (int *count = m_rtx_occurrence_count.get (*iter))
kono
parents: 67
diff changeset
130 {
kono
parents: 67
diff changeset
131 if (*(count++) == 1)
kono
parents: 67
diff changeset
132 m_rtx_reuse_ids.put (*iter, m_next_id++);
kono
parents: 67
diff changeset
133 }
kono
parents: 67
diff changeset
134 else
kono
parents: 67
diff changeset
135 m_rtx_occurrence_count.put (*iter, 1);
kono
parents: 67
diff changeset
136 }
kono
parents: 67
diff changeset
137 }
kono
parents: 67
diff changeset
138
kono
parents: 67
diff changeset
139 /* Return true iff X has been assigned a reuse ID. If it has,
kono
parents: 67
diff changeset
140 and OUT is non-NULL, then write the reuse ID to *OUT. */
kono
parents: 67
diff changeset
141
kono
parents: 67
diff changeset
142 bool
kono
parents: 67
diff changeset
143 rtx_reuse_manager::has_reuse_id (const_rtx x, int *out)
kono
parents: 67
diff changeset
144 {
kono
parents: 67
diff changeset
145 int *id = m_rtx_reuse_ids.get (x);
kono
parents: 67
diff changeset
146 if (id)
kono
parents: 67
diff changeset
147 {
kono
parents: 67
diff changeset
148 if (out)
kono
parents: 67
diff changeset
149 *out = *id;
kono
parents: 67
diff changeset
150 return true;
kono
parents: 67
diff changeset
151 }
kono
parents: 67
diff changeset
152 else
kono
parents: 67
diff changeset
153 return false;
kono
parents: 67
diff changeset
154 }
kono
parents: 67
diff changeset
155
kono
parents: 67
diff changeset
156 /* Determine if set_seen_def has been called for the given reuse ID. */
kono
parents: 67
diff changeset
157
kono
parents: 67
diff changeset
158 bool
kono
parents: 67
diff changeset
159 rtx_reuse_manager::seen_def_p (int reuse_id)
kono
parents: 67
diff changeset
160 {
kono
parents: 67
diff changeset
161 return bitmap_bit_p (m_defs_seen, reuse_id);
kono
parents: 67
diff changeset
162 }
kono
parents: 67
diff changeset
163
kono
parents: 67
diff changeset
164 /* Record that the definition of the given reuse ID has been seen. */
kono
parents: 67
diff changeset
165
kono
parents: 67
diff changeset
166 void
kono
parents: 67
diff changeset
167 rtx_reuse_manager::set_seen_def (int reuse_id)
kono
parents: 67
diff changeset
168 {
kono
parents: 67
diff changeset
169 bitmap_set_bit (m_defs_seen, reuse_id);
kono
parents: 67
diff changeset
170 }
kono
parents: 67
diff changeset
171
kono
parents: 67
diff changeset
172 #endif /* #ifndef GENERATOR_FILE */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 #ifndef GENERATOR_FILE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 print_mem_expr (FILE *outfile, const_tree expr)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
178 fputc (' ', outfile);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
179 print_generic_expr (outfile, CONST_CAST_TREE (expr), dump_flags);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
183 /* Print X to FILE. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
184
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
185 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
186 print_poly_int (FILE *file, poly_int64 x)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
187 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
188 HOST_WIDE_INT const_x;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
189 if (x.is_constant (&const_x))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
190 fprintf (file, HOST_WIDE_INT_PRINT_DEC, const_x);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
191 else
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
192 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
193 fprintf (file, "[" HOST_WIDE_INT_PRINT_DEC, x.coeffs[0]);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
194 for (int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
195 fprintf (file, ", " HOST_WIDE_INT_PRINT_DEC, x.coeffs[i]);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
196 fprintf (file, "]");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
197 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
198 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
199
111
kono
parents: 67
diff changeset
200 /* Subroutine of print_rtx_operand for handling code '0'.
kono
parents: 67
diff changeset
201 0 indicates a field for internal use that should not be printed.
kono
parents: 67
diff changeset
202 However there are various special cases, such as the third field
kono
parents: 67
diff changeset
203 of a NOTE, where it indicates that the field has several different
kono
parents: 67
diff changeset
204 valid contents. */
kono
parents: 67
diff changeset
205
kono
parents: 67
diff changeset
206 void
kono
parents: 67
diff changeset
207 rtx_writer::print_rtx_operand_code_0 (const_rtx in_rtx ATTRIBUTE_UNUSED,
kono
parents: 67
diff changeset
208 int idx ATTRIBUTE_UNUSED)
kono
parents: 67
diff changeset
209 {
kono
parents: 67
diff changeset
210 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
211 if (idx == 1 && GET_CODE (in_rtx) == SYMBOL_REF)
kono
parents: 67
diff changeset
212 {
kono
parents: 67
diff changeset
213 int flags = SYMBOL_REF_FLAGS (in_rtx);
kono
parents: 67
diff changeset
214 if (flags)
kono
parents: 67
diff changeset
215 fprintf (m_outfile, " [flags %#x]", flags);
kono
parents: 67
diff changeset
216 tree decl = SYMBOL_REF_DECL (in_rtx);
kono
parents: 67
diff changeset
217 if (decl)
kono
parents: 67
diff changeset
218 print_node_brief (m_outfile, "", decl, dump_flags);
kono
parents: 67
diff changeset
219 }
kono
parents: 67
diff changeset
220 else if (idx == 3 && NOTE_P (in_rtx))
kono
parents: 67
diff changeset
221 {
kono
parents: 67
diff changeset
222 switch (NOTE_KIND (in_rtx))
kono
parents: 67
diff changeset
223 {
kono
parents: 67
diff changeset
224 case NOTE_INSN_EH_REGION_BEG:
kono
parents: 67
diff changeset
225 case NOTE_INSN_EH_REGION_END:
kono
parents: 67
diff changeset
226 if (flag_dump_unnumbered)
kono
parents: 67
diff changeset
227 fprintf (m_outfile, " #");
kono
parents: 67
diff changeset
228 else
kono
parents: 67
diff changeset
229 fprintf (m_outfile, " %d", NOTE_EH_HANDLER (in_rtx));
kono
parents: 67
diff changeset
230 m_sawclose = 1;
kono
parents: 67
diff changeset
231 break;
kono
parents: 67
diff changeset
232
kono
parents: 67
diff changeset
233 case NOTE_INSN_BLOCK_BEG:
kono
parents: 67
diff changeset
234 case NOTE_INSN_BLOCK_END:
kono
parents: 67
diff changeset
235 dump_addr (m_outfile, " ", NOTE_BLOCK (in_rtx));
kono
parents: 67
diff changeset
236 m_sawclose = 1;
kono
parents: 67
diff changeset
237 break;
kono
parents: 67
diff changeset
238
kono
parents: 67
diff changeset
239 case NOTE_INSN_BASIC_BLOCK:
kono
parents: 67
diff changeset
240 {
kono
parents: 67
diff changeset
241 basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
kono
parents: 67
diff changeset
242 if (bb != 0)
kono
parents: 67
diff changeset
243 fprintf (m_outfile, " [bb %d]", bb->index);
kono
parents: 67
diff changeset
244 break;
kono
parents: 67
diff changeset
245 }
kono
parents: 67
diff changeset
246
kono
parents: 67
diff changeset
247 case NOTE_INSN_DELETED_LABEL:
kono
parents: 67
diff changeset
248 case NOTE_INSN_DELETED_DEBUG_LABEL:
kono
parents: 67
diff changeset
249 {
kono
parents: 67
diff changeset
250 const char *label = NOTE_DELETED_LABEL_NAME (in_rtx);
kono
parents: 67
diff changeset
251 if (label)
kono
parents: 67
diff changeset
252 fprintf (m_outfile, " (\"%s\")", label);
kono
parents: 67
diff changeset
253 else
kono
parents: 67
diff changeset
254 fprintf (m_outfile, " \"\"");
kono
parents: 67
diff changeset
255 }
kono
parents: 67
diff changeset
256 break;
kono
parents: 67
diff changeset
257
kono
parents: 67
diff changeset
258 case NOTE_INSN_SWITCH_TEXT_SECTIONS:
kono
parents: 67
diff changeset
259 {
kono
parents: 67
diff changeset
260 basic_block bb = NOTE_BASIC_BLOCK (in_rtx);
kono
parents: 67
diff changeset
261 if (bb != 0)
kono
parents: 67
diff changeset
262 fprintf (m_outfile, " [bb %d]", bb->index);
kono
parents: 67
diff changeset
263 break;
kono
parents: 67
diff changeset
264 }
kono
parents: 67
diff changeset
265
kono
parents: 67
diff changeset
266 case NOTE_INSN_VAR_LOCATION:
kono
parents: 67
diff changeset
267 fputc (' ', m_outfile);
kono
parents: 67
diff changeset
268 print_rtx (NOTE_VAR_LOCATION (in_rtx));
kono
parents: 67
diff changeset
269 break;
kono
parents: 67
diff changeset
270
kono
parents: 67
diff changeset
271 case NOTE_INSN_CFI:
kono
parents: 67
diff changeset
272 fputc ('\n', m_outfile);
kono
parents: 67
diff changeset
273 output_cfi_directive (m_outfile, NOTE_CFI (in_rtx));
kono
parents: 67
diff changeset
274 fputc ('\t', m_outfile);
kono
parents: 67
diff changeset
275 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
277 case NOTE_INSN_BEGIN_STMT:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
278 case NOTE_INSN_INLINE_ENTRY:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
279 #ifndef GENERATOR_FILE
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
280 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
281 expanded_location xloc
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
282 = expand_location (NOTE_MARKER_LOCATION (in_rtx));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
283 fprintf (m_outfile, " %s:%i", xloc.file, xloc.line);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
284 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
285 #endif
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
286 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
287
111
kono
parents: 67
diff changeset
288 default:
kono
parents: 67
diff changeset
289 break;
kono
parents: 67
diff changeset
290 }
kono
parents: 67
diff changeset
291 }
kono
parents: 67
diff changeset
292 else if (idx == 7 && JUMP_P (in_rtx) && JUMP_LABEL (in_rtx) != NULL
kono
parents: 67
diff changeset
293 && !m_compact)
kono
parents: 67
diff changeset
294 {
kono
parents: 67
diff changeset
295 /* Output the JUMP_LABEL reference. */
kono
parents: 67
diff changeset
296 fprintf (m_outfile, "\n%s%*s -> ", print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
297 if (GET_CODE (JUMP_LABEL (in_rtx)) == RETURN)
kono
parents: 67
diff changeset
298 fprintf (m_outfile, "return");
kono
parents: 67
diff changeset
299 else if (GET_CODE (JUMP_LABEL (in_rtx)) == SIMPLE_RETURN)
kono
parents: 67
diff changeset
300 fprintf (m_outfile, "simple_return");
kono
parents: 67
diff changeset
301 else
kono
parents: 67
diff changeset
302 fprintf (m_outfile, "%d", INSN_UID (JUMP_LABEL (in_rtx)));
kono
parents: 67
diff changeset
303 }
kono
parents: 67
diff changeset
304 else if (idx == 0 && GET_CODE (in_rtx) == VALUE)
kono
parents: 67
diff changeset
305 {
kono
parents: 67
diff changeset
306 cselib_val *val = CSELIB_VAL_PTR (in_rtx);
kono
parents: 67
diff changeset
307
kono
parents: 67
diff changeset
308 fprintf (m_outfile, " %u:%u", val->uid, val->hash);
kono
parents: 67
diff changeset
309 dump_addr (m_outfile, " @", in_rtx);
kono
parents: 67
diff changeset
310 dump_addr (m_outfile, "/", (void*)val);
kono
parents: 67
diff changeset
311 }
kono
parents: 67
diff changeset
312 else if (idx == 0 && GET_CODE (in_rtx) == DEBUG_EXPR)
kono
parents: 67
diff changeset
313 {
kono
parents: 67
diff changeset
314 fprintf (m_outfile, " D#%i",
kono
parents: 67
diff changeset
315 DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (in_rtx)));
kono
parents: 67
diff changeset
316 }
kono
parents: 67
diff changeset
317 else if (idx == 0 && GET_CODE (in_rtx) == ENTRY_VALUE)
kono
parents: 67
diff changeset
318 {
kono
parents: 67
diff changeset
319 m_indent += 2;
kono
parents: 67
diff changeset
320 if (!m_sawclose)
kono
parents: 67
diff changeset
321 fprintf (m_outfile, " ");
kono
parents: 67
diff changeset
322 print_rtx (ENTRY_VALUE_EXP (in_rtx));
kono
parents: 67
diff changeset
323 m_indent -= 2;
kono
parents: 67
diff changeset
324 }
kono
parents: 67
diff changeset
325 #endif
kono
parents: 67
diff changeset
326 }
kono
parents: 67
diff changeset
327
kono
parents: 67
diff changeset
328 /* Subroutine of print_rtx_operand for handling code 'e'.
kono
parents: 67
diff changeset
329 Also called by print_rtx_operand_code_u for handling code 'u'
kono
parents: 67
diff changeset
330 for LABEL_REFs when they don't reference a CODE_LABEL. */
kono
parents: 67
diff changeset
331
kono
parents: 67
diff changeset
332 void
kono
parents: 67
diff changeset
333 rtx_writer::print_rtx_operand_code_e (const_rtx in_rtx, int idx)
kono
parents: 67
diff changeset
334 {
kono
parents: 67
diff changeset
335 m_indent += 2;
kono
parents: 67
diff changeset
336 if (idx == 6 && INSN_P (in_rtx))
kono
parents: 67
diff changeset
337 /* Put REG_NOTES on their own line. */
kono
parents: 67
diff changeset
338 fprintf (m_outfile, "\n%s%*s",
kono
parents: 67
diff changeset
339 print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
340 if (!m_sawclose)
kono
parents: 67
diff changeset
341 fprintf (m_outfile, " ");
kono
parents: 67
diff changeset
342 if (idx == 7 && CALL_P (in_rtx))
kono
parents: 67
diff changeset
343 {
kono
parents: 67
diff changeset
344 m_in_call_function_usage = true;
kono
parents: 67
diff changeset
345 print_rtx (XEXP (in_rtx, idx));
kono
parents: 67
diff changeset
346 m_in_call_function_usage = false;
kono
parents: 67
diff changeset
347 }
kono
parents: 67
diff changeset
348 else
kono
parents: 67
diff changeset
349 print_rtx (XEXP (in_rtx, idx));
kono
parents: 67
diff changeset
350 m_indent -= 2;
kono
parents: 67
diff changeset
351 }
kono
parents: 67
diff changeset
352
kono
parents: 67
diff changeset
353 /* Subroutine of print_rtx_operand for handling codes 'E' and 'V'. */
kono
parents: 67
diff changeset
354
kono
parents: 67
diff changeset
355 void
kono
parents: 67
diff changeset
356 rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx)
kono
parents: 67
diff changeset
357 {
kono
parents: 67
diff changeset
358 m_indent += 2;
kono
parents: 67
diff changeset
359 if (m_sawclose)
kono
parents: 67
diff changeset
360 {
kono
parents: 67
diff changeset
361 fprintf (m_outfile, "\n%s%*s",
kono
parents: 67
diff changeset
362 print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
363 m_sawclose = 0;
kono
parents: 67
diff changeset
364 }
kono
parents: 67
diff changeset
365 fputs (" [", m_outfile);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
366 if (XVEC (in_rtx, idx) != NULL)
111
kono
parents: 67
diff changeset
367 {
kono
parents: 67
diff changeset
368 m_indent += 2;
kono
parents: 67
diff changeset
369 if (XVECLEN (in_rtx, idx))
kono
parents: 67
diff changeset
370 m_sawclose = 1;
kono
parents: 67
diff changeset
371
kono
parents: 67
diff changeset
372 for (int j = 0; j < XVECLEN (in_rtx, idx); j++)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
373 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
374 int j1;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
375
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
376 print_rtx (XVECEXP (in_rtx, idx, j));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
377 for (j1 = j + 1; j1 < XVECLEN (in_rtx, idx); j1++)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
378 if (XVECEXP (in_rtx, idx, j) != XVECEXP (in_rtx, idx, j1))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
379 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
380
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
381 if (j1 != j + 1)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
382 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
383 fprintf (m_outfile, " repeated x%i", j1 - j);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
384 j = j1 - 1;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
385 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
386 }
111
kono
parents: 67
diff changeset
387
kono
parents: 67
diff changeset
388 m_indent -= 2;
kono
parents: 67
diff changeset
389 }
kono
parents: 67
diff changeset
390 if (m_sawclose)
kono
parents: 67
diff changeset
391 fprintf (m_outfile, "\n%s%*s", print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
392
kono
parents: 67
diff changeset
393 fputs ("]", m_outfile);
kono
parents: 67
diff changeset
394 m_sawclose = 1;
kono
parents: 67
diff changeset
395 m_indent -= 2;
kono
parents: 67
diff changeset
396 }
kono
parents: 67
diff changeset
397
kono
parents: 67
diff changeset
398 /* Subroutine of print_rtx_operand for handling code 'i'. */
kono
parents: 67
diff changeset
399
kono
parents: 67
diff changeset
400 void
kono
parents: 67
diff changeset
401 rtx_writer::print_rtx_operand_code_i (const_rtx in_rtx, int idx)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 {
111
kono
parents: 67
diff changeset
403 if (idx == 4 && INSN_P (in_rtx))
kono
parents: 67
diff changeset
404 {
kono
parents: 67
diff changeset
405 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
406 const rtx_insn *in_insn = as_a <const rtx_insn *> (in_rtx);
kono
parents: 67
diff changeset
407
kono
parents: 67
diff changeset
408 /* Pretty-print insn locations. Ignore scoping as it is mostly
kono
parents: 67
diff changeset
409 redundant with line number information and do not print anything
kono
parents: 67
diff changeset
410 when there is no location information available. */
kono
parents: 67
diff changeset
411 if (INSN_HAS_LOCATION (in_insn))
kono
parents: 67
diff changeset
412 {
kono
parents: 67
diff changeset
413 expanded_location xloc = insn_location (in_insn);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
414 fprintf (m_outfile, " \"%s\":%i:%i", xloc.file, xloc.line,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
415 xloc.column);
111
kono
parents: 67
diff changeset
416 }
kono
parents: 67
diff changeset
417 #endif
kono
parents: 67
diff changeset
418 }
kono
parents: 67
diff changeset
419 else if (idx == 6 && GET_CODE (in_rtx) == ASM_OPERANDS)
kono
parents: 67
diff changeset
420 {
kono
parents: 67
diff changeset
421 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
422 if (ASM_OPERANDS_SOURCE_LOCATION (in_rtx) != UNKNOWN_LOCATION)
kono
parents: 67
diff changeset
423 fprintf (m_outfile, " %s:%i",
kono
parents: 67
diff changeset
424 LOCATION_FILE (ASM_OPERANDS_SOURCE_LOCATION (in_rtx)),
kono
parents: 67
diff changeset
425 LOCATION_LINE (ASM_OPERANDS_SOURCE_LOCATION (in_rtx)));
kono
parents: 67
diff changeset
426 #endif
kono
parents: 67
diff changeset
427 }
kono
parents: 67
diff changeset
428 else if (idx == 1 && GET_CODE (in_rtx) == ASM_INPUT)
kono
parents: 67
diff changeset
429 {
kono
parents: 67
diff changeset
430 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
431 if (ASM_INPUT_SOURCE_LOCATION (in_rtx) != UNKNOWN_LOCATION)
kono
parents: 67
diff changeset
432 fprintf (m_outfile, " %s:%i",
kono
parents: 67
diff changeset
433 LOCATION_FILE (ASM_INPUT_SOURCE_LOCATION (in_rtx)),
kono
parents: 67
diff changeset
434 LOCATION_LINE (ASM_INPUT_SOURCE_LOCATION (in_rtx)));
kono
parents: 67
diff changeset
435 #endif
kono
parents: 67
diff changeset
436 }
kono
parents: 67
diff changeset
437 else if (idx == 5 && NOTE_P (in_rtx))
kono
parents: 67
diff changeset
438 {
kono
parents: 67
diff changeset
439 /* This field is only used for NOTE_INSN_DELETED_LABEL, and
kono
parents: 67
diff changeset
440 other times often contains garbage from INSN->NOTE death. */
kono
parents: 67
diff changeset
441 if (NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_LABEL
kono
parents: 67
diff changeset
442 || NOTE_KIND (in_rtx) == NOTE_INSN_DELETED_DEBUG_LABEL)
kono
parents: 67
diff changeset
443 fprintf (m_outfile, " %d", XINT (in_rtx, idx));
kono
parents: 67
diff changeset
444 }
kono
parents: 67
diff changeset
445 #if !defined(GENERATOR_FILE) && NUM_UNSPECV_VALUES > 0
kono
parents: 67
diff changeset
446 else if (idx == 1
kono
parents: 67
diff changeset
447 && GET_CODE (in_rtx) == UNSPEC_VOLATILE
kono
parents: 67
diff changeset
448 && XINT (in_rtx, 1) >= 0
kono
parents: 67
diff changeset
449 && XINT (in_rtx, 1) < NUM_UNSPECV_VALUES)
kono
parents: 67
diff changeset
450 fprintf (m_outfile, " %s", unspecv_strings[XINT (in_rtx, 1)]);
kono
parents: 67
diff changeset
451 #endif
kono
parents: 67
diff changeset
452 #if !defined(GENERATOR_FILE) && NUM_UNSPEC_VALUES > 0
kono
parents: 67
diff changeset
453 else if (idx == 1
kono
parents: 67
diff changeset
454 && (GET_CODE (in_rtx) == UNSPEC
kono
parents: 67
diff changeset
455 || GET_CODE (in_rtx) == UNSPEC_VOLATILE)
kono
parents: 67
diff changeset
456 && XINT (in_rtx, 1) >= 0
kono
parents: 67
diff changeset
457 && XINT (in_rtx, 1) < NUM_UNSPEC_VALUES)
kono
parents: 67
diff changeset
458 fprintf (m_outfile, " %s", unspec_strings[XINT (in_rtx, 1)]);
kono
parents: 67
diff changeset
459 #endif
kono
parents: 67
diff changeset
460 else
kono
parents: 67
diff changeset
461 {
kono
parents: 67
diff changeset
462 int value = XINT (in_rtx, idx);
kono
parents: 67
diff changeset
463 const char *name;
kono
parents: 67
diff changeset
464 int is_insn = INSN_P (in_rtx);
kono
parents: 67
diff changeset
465
kono
parents: 67
diff changeset
466 /* Don't print INSN_CODEs in compact mode. */
kono
parents: 67
diff changeset
467 if (m_compact && is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, idx))
kono
parents: 67
diff changeset
468 {
kono
parents: 67
diff changeset
469 m_sawclose = 0;
kono
parents: 67
diff changeset
470 return;
kono
parents: 67
diff changeset
471 }
kono
parents: 67
diff changeset
472
kono
parents: 67
diff changeset
473 if (flag_dump_unnumbered
kono
parents: 67
diff changeset
474 && (is_insn || NOTE_P (in_rtx)))
kono
parents: 67
diff changeset
475 fputc ('#', m_outfile);
kono
parents: 67
diff changeset
476 else
kono
parents: 67
diff changeset
477 fprintf (m_outfile, " %d", value);
kono
parents: 67
diff changeset
478
kono
parents: 67
diff changeset
479 if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, idx)
kono
parents: 67
diff changeset
480 && XINT (in_rtx, idx) >= 0
kono
parents: 67
diff changeset
481 && (name = get_insn_name (XINT (in_rtx, idx))) != NULL)
kono
parents: 67
diff changeset
482 fprintf (m_outfile, " {%s}", name);
kono
parents: 67
diff changeset
483 m_sawclose = 0;
kono
parents: 67
diff changeset
484 }
kono
parents: 67
diff changeset
485 }
kono
parents: 67
diff changeset
486
kono
parents: 67
diff changeset
487 /* Subroutine of print_rtx_operand for handling code 'r'. */
kono
parents: 67
diff changeset
488
kono
parents: 67
diff changeset
489 void
kono
parents: 67
diff changeset
490 rtx_writer::print_rtx_operand_code_r (const_rtx in_rtx)
kono
parents: 67
diff changeset
491 {
kono
parents: 67
diff changeset
492 int is_insn = INSN_P (in_rtx);
kono
parents: 67
diff changeset
493 unsigned int regno = REGNO (in_rtx);
kono
parents: 67
diff changeset
494
kono
parents: 67
diff changeset
495 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
496 /* For hard registers and virtuals, always print the
kono
parents: 67
diff changeset
497 regno, except in compact mode. */
kono
parents: 67
diff changeset
498 if (regno <= LAST_VIRTUAL_REGISTER && !m_compact)
kono
parents: 67
diff changeset
499 fprintf (m_outfile, " %d", regno);
kono
parents: 67
diff changeset
500 if (regno < FIRST_PSEUDO_REGISTER)
kono
parents: 67
diff changeset
501 fprintf (m_outfile, " %s", reg_names[regno]);
kono
parents: 67
diff changeset
502 else if (regno <= LAST_VIRTUAL_REGISTER)
kono
parents: 67
diff changeset
503 {
kono
parents: 67
diff changeset
504 if (regno == VIRTUAL_INCOMING_ARGS_REGNUM)
kono
parents: 67
diff changeset
505 fprintf (m_outfile, " virtual-incoming-args");
kono
parents: 67
diff changeset
506 else if (regno == VIRTUAL_STACK_VARS_REGNUM)
kono
parents: 67
diff changeset
507 fprintf (m_outfile, " virtual-stack-vars");
kono
parents: 67
diff changeset
508 else if (regno == VIRTUAL_STACK_DYNAMIC_REGNUM)
kono
parents: 67
diff changeset
509 fprintf (m_outfile, " virtual-stack-dynamic");
kono
parents: 67
diff changeset
510 else if (regno == VIRTUAL_OUTGOING_ARGS_REGNUM)
kono
parents: 67
diff changeset
511 fprintf (m_outfile, " virtual-outgoing-args");
kono
parents: 67
diff changeset
512 else if (regno == VIRTUAL_CFA_REGNUM)
kono
parents: 67
diff changeset
513 fprintf (m_outfile, " virtual-cfa");
kono
parents: 67
diff changeset
514 else if (regno == VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM)
kono
parents: 67
diff changeset
515 fprintf (m_outfile, " virtual-preferred-stack-boundary");
kono
parents: 67
diff changeset
516 else
kono
parents: 67
diff changeset
517 fprintf (m_outfile, " virtual-reg-%d", regno-FIRST_VIRTUAL_REGISTER);
kono
parents: 67
diff changeset
518 }
kono
parents: 67
diff changeset
519 else
kono
parents: 67
diff changeset
520 #endif
kono
parents: 67
diff changeset
521 if (flag_dump_unnumbered && is_insn)
kono
parents: 67
diff changeset
522 fputc ('#', m_outfile);
kono
parents: 67
diff changeset
523 else if (m_compact)
kono
parents: 67
diff changeset
524 {
kono
parents: 67
diff changeset
525 /* In compact mode, print pseudos with '< and '>' wrapping the regno,
kono
parents: 67
diff changeset
526 offseting it by (LAST_VIRTUAL_REGISTER + 1), so that the
kono
parents: 67
diff changeset
527 first non-virtual pseudo is dumped as "<0>". */
kono
parents: 67
diff changeset
528 gcc_assert (regno > LAST_VIRTUAL_REGISTER);
kono
parents: 67
diff changeset
529 fprintf (m_outfile, " <%d>", regno - (LAST_VIRTUAL_REGISTER + 1));
kono
parents: 67
diff changeset
530 }
kono
parents: 67
diff changeset
531 else
kono
parents: 67
diff changeset
532 fprintf (m_outfile, " %d", regno);
kono
parents: 67
diff changeset
533
kono
parents: 67
diff changeset
534 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
535 if (REG_ATTRS (in_rtx))
kono
parents: 67
diff changeset
536 {
kono
parents: 67
diff changeset
537 fputs (" [", m_outfile);
kono
parents: 67
diff changeset
538 if (regno != ORIGINAL_REGNO (in_rtx))
kono
parents: 67
diff changeset
539 fprintf (m_outfile, "orig:%i", ORIGINAL_REGNO (in_rtx));
kono
parents: 67
diff changeset
540 if (REG_EXPR (in_rtx))
kono
parents: 67
diff changeset
541 print_mem_expr (m_outfile, REG_EXPR (in_rtx));
kono
parents: 67
diff changeset
542
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
543 if (maybe_ne (REG_OFFSET (in_rtx), 0))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
544 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
545 fprintf (m_outfile, "+");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
546 print_poly_int (m_outfile, REG_OFFSET (in_rtx));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
547 }
111
kono
parents: 67
diff changeset
548 fputs (" ]", m_outfile);
kono
parents: 67
diff changeset
549 }
kono
parents: 67
diff changeset
550 if (regno != ORIGINAL_REGNO (in_rtx))
kono
parents: 67
diff changeset
551 fprintf (m_outfile, " [%d]", ORIGINAL_REGNO (in_rtx));
kono
parents: 67
diff changeset
552 #endif
kono
parents: 67
diff changeset
553 }
kono
parents: 67
diff changeset
554
kono
parents: 67
diff changeset
555 /* Subroutine of print_rtx_operand for handling code 'u'. */
kono
parents: 67
diff changeset
556
kono
parents: 67
diff changeset
557 void
kono
parents: 67
diff changeset
558 rtx_writer::print_rtx_operand_code_u (const_rtx in_rtx, int idx)
kono
parents: 67
diff changeset
559 {
kono
parents: 67
diff changeset
560 /* Don't print insn UIDs for PREV/NEXT_INSN in compact mode. */
kono
parents: 67
diff changeset
561 if (m_compact && INSN_CHAIN_CODE_P (GET_CODE (in_rtx)) && idx < 2)
kono
parents: 67
diff changeset
562 return;
kono
parents: 67
diff changeset
563
kono
parents: 67
diff changeset
564 if (XEXP (in_rtx, idx) != NULL)
kono
parents: 67
diff changeset
565 {
kono
parents: 67
diff changeset
566 rtx sub = XEXP (in_rtx, idx);
kono
parents: 67
diff changeset
567 enum rtx_code subc = GET_CODE (sub);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568
111
kono
parents: 67
diff changeset
569 if (GET_CODE (in_rtx) == LABEL_REF)
kono
parents: 67
diff changeset
570 {
kono
parents: 67
diff changeset
571 if (subc == NOTE
kono
parents: 67
diff changeset
572 && NOTE_KIND (sub) == NOTE_INSN_DELETED_LABEL)
kono
parents: 67
diff changeset
573 {
kono
parents: 67
diff changeset
574 if (flag_dump_unnumbered)
kono
parents: 67
diff changeset
575 fprintf (m_outfile, " [# deleted]");
kono
parents: 67
diff changeset
576 else
kono
parents: 67
diff changeset
577 fprintf (m_outfile, " [%d deleted]", INSN_UID (sub));
kono
parents: 67
diff changeset
578 m_sawclose = 0;
kono
parents: 67
diff changeset
579 return;
kono
parents: 67
diff changeset
580 }
kono
parents: 67
diff changeset
581
kono
parents: 67
diff changeset
582 if (subc != CODE_LABEL)
kono
parents: 67
diff changeset
583 {
kono
parents: 67
diff changeset
584 print_rtx_operand_code_e (in_rtx, idx);
kono
parents: 67
diff changeset
585 return;
kono
parents: 67
diff changeset
586 }
kono
parents: 67
diff changeset
587 }
kono
parents: 67
diff changeset
588
kono
parents: 67
diff changeset
589 if (flag_dump_unnumbered
kono
parents: 67
diff changeset
590 || (flag_dump_unnumbered_links && idx <= 1
kono
parents: 67
diff changeset
591 && (INSN_P (in_rtx) || NOTE_P (in_rtx)
kono
parents: 67
diff changeset
592 || LABEL_P (in_rtx) || BARRIER_P (in_rtx))))
kono
parents: 67
diff changeset
593 fputs (" #", m_outfile);
kono
parents: 67
diff changeset
594 else
kono
parents: 67
diff changeset
595 fprintf (m_outfile, " %d", INSN_UID (sub));
kono
parents: 67
diff changeset
596 }
kono
parents: 67
diff changeset
597 else
kono
parents: 67
diff changeset
598 fputs (" 0", m_outfile);
kono
parents: 67
diff changeset
599 m_sawclose = 0;
kono
parents: 67
diff changeset
600 }
kono
parents: 67
diff changeset
601
kono
parents: 67
diff changeset
602 /* Subroutine of print_rtx. Print operand IDX of IN_RTX. */
kono
parents: 67
diff changeset
603
kono
parents: 67
diff changeset
604 void
kono
parents: 67
diff changeset
605 rtx_writer::print_rtx_operand (const_rtx in_rtx, int idx)
kono
parents: 67
diff changeset
606 {
kono
parents: 67
diff changeset
607 const char *format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
kono
parents: 67
diff changeset
608
kono
parents: 67
diff changeset
609 switch (format_ptr[idx])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 {
111
kono
parents: 67
diff changeset
611 const char *str;
kono
parents: 67
diff changeset
612
kono
parents: 67
diff changeset
613 case 'T':
kono
parents: 67
diff changeset
614 str = XTMPL (in_rtx, idx);
kono
parents: 67
diff changeset
615 goto string;
kono
parents: 67
diff changeset
616
kono
parents: 67
diff changeset
617 case 'S':
kono
parents: 67
diff changeset
618 case 's':
kono
parents: 67
diff changeset
619 str = XSTR (in_rtx, idx);
kono
parents: 67
diff changeset
620 string:
kono
parents: 67
diff changeset
621
kono
parents: 67
diff changeset
622 if (str == 0)
kono
parents: 67
diff changeset
623 fputs (" (nil)", m_outfile);
kono
parents: 67
diff changeset
624 else
kono
parents: 67
diff changeset
625 fprintf (m_outfile, " (\"%s\")", str);
kono
parents: 67
diff changeset
626 m_sawclose = 1;
kono
parents: 67
diff changeset
627 break;
kono
parents: 67
diff changeset
628
kono
parents: 67
diff changeset
629 case '0':
kono
parents: 67
diff changeset
630 print_rtx_operand_code_0 (in_rtx, idx);
kono
parents: 67
diff changeset
631 break;
kono
parents: 67
diff changeset
632
kono
parents: 67
diff changeset
633 case 'e':
kono
parents: 67
diff changeset
634 print_rtx_operand_code_e (in_rtx, idx);
kono
parents: 67
diff changeset
635 break;
kono
parents: 67
diff changeset
636
kono
parents: 67
diff changeset
637 case 'E':
kono
parents: 67
diff changeset
638 case 'V':
kono
parents: 67
diff changeset
639 print_rtx_operand_codes_E_and_V (in_rtx, idx);
kono
parents: 67
diff changeset
640 break;
kono
parents: 67
diff changeset
641
kono
parents: 67
diff changeset
642 case 'w':
kono
parents: 67
diff changeset
643 if (! m_simple)
kono
parents: 67
diff changeset
644 fprintf (m_outfile, " ");
kono
parents: 67
diff changeset
645 fprintf (m_outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, idx));
kono
parents: 67
diff changeset
646 if (! m_simple && !m_compact)
kono
parents: 67
diff changeset
647 fprintf (m_outfile, " [" HOST_WIDE_INT_PRINT_HEX "]",
kono
parents: 67
diff changeset
648 (unsigned HOST_WIDE_INT) XWINT (in_rtx, idx));
kono
parents: 67
diff changeset
649 break;
kono
parents: 67
diff changeset
650
kono
parents: 67
diff changeset
651 case 'i':
kono
parents: 67
diff changeset
652 print_rtx_operand_code_i (in_rtx, idx);
kono
parents: 67
diff changeset
653 break;
kono
parents: 67
diff changeset
654
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
655 case 'p':
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
656 fprintf (m_outfile, " ");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
657 print_poly_int (m_outfile, SUBREG_BYTE (in_rtx));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
658 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
659
111
kono
parents: 67
diff changeset
660 case 'r':
kono
parents: 67
diff changeset
661 print_rtx_operand_code_r (in_rtx);
kono
parents: 67
diff changeset
662 break;
kono
parents: 67
diff changeset
663
kono
parents: 67
diff changeset
664 /* Print NOTE_INSN names rather than integer codes. */
kono
parents: 67
diff changeset
665
kono
parents: 67
diff changeset
666 case 'n':
kono
parents: 67
diff changeset
667 fprintf (m_outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, idx)));
kono
parents: 67
diff changeset
668 m_sawclose = 0;
kono
parents: 67
diff changeset
669 break;
kono
parents: 67
diff changeset
670
kono
parents: 67
diff changeset
671 case 'u':
kono
parents: 67
diff changeset
672 print_rtx_operand_code_u (in_rtx, idx);
kono
parents: 67
diff changeset
673 break;
kono
parents: 67
diff changeset
674
kono
parents: 67
diff changeset
675 case 't':
kono
parents: 67
diff changeset
676 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
677 if (idx == 0 && GET_CODE (in_rtx) == DEBUG_IMPLICIT_PTR)
kono
parents: 67
diff changeset
678 print_mem_expr (m_outfile, DEBUG_IMPLICIT_PTR_DECL (in_rtx));
kono
parents: 67
diff changeset
679 else if (idx == 0 && GET_CODE (in_rtx) == DEBUG_PARAMETER_REF)
kono
parents: 67
diff changeset
680 print_mem_expr (m_outfile, DEBUG_PARAMETER_REF_DECL (in_rtx));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
681 else
111
kono
parents: 67
diff changeset
682 dump_addr (m_outfile, " ", XTREE (in_rtx, idx));
kono
parents: 67
diff changeset
683 #endif
kono
parents: 67
diff changeset
684 break;
kono
parents: 67
diff changeset
685
kono
parents: 67
diff changeset
686 case '*':
kono
parents: 67
diff changeset
687 fputs (" Unknown", m_outfile);
kono
parents: 67
diff changeset
688 m_sawclose = 0;
kono
parents: 67
diff changeset
689 break;
kono
parents: 67
diff changeset
690
kono
parents: 67
diff changeset
691 case 'B':
kono
parents: 67
diff changeset
692 /* Don't print basic block ids in compact mode. */
kono
parents: 67
diff changeset
693 if (m_compact)
kono
parents: 67
diff changeset
694 break;
kono
parents: 67
diff changeset
695 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
696 if (XBBDEF (in_rtx, idx))
kono
parents: 67
diff changeset
697 fprintf (m_outfile, " %i", XBBDEF (in_rtx, idx)->index);
kono
parents: 67
diff changeset
698 #endif
kono
parents: 67
diff changeset
699 break;
kono
parents: 67
diff changeset
700
kono
parents: 67
diff changeset
701 default:
kono
parents: 67
diff changeset
702 gcc_unreachable ();
kono
parents: 67
diff changeset
703 }
kono
parents: 67
diff changeset
704 }
kono
parents: 67
diff changeset
705
kono
parents: 67
diff changeset
706 /* Subroutine of rtx_writer::print_rtx.
kono
parents: 67
diff changeset
707 In compact mode, determine if operand IDX of IN_RTX is interesting
kono
parents: 67
diff changeset
708 to dump, or (if in a trailing position) it can be omitted. */
kono
parents: 67
diff changeset
709
kono
parents: 67
diff changeset
710 bool
kono
parents: 67
diff changeset
711 rtx_writer::operand_has_default_value_p (const_rtx in_rtx, int idx)
kono
parents: 67
diff changeset
712 {
kono
parents: 67
diff changeset
713 const char *format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
kono
parents: 67
diff changeset
714
kono
parents: 67
diff changeset
715 switch (format_ptr[idx])
kono
parents: 67
diff changeset
716 {
kono
parents: 67
diff changeset
717 case 'e':
kono
parents: 67
diff changeset
718 case 'u':
kono
parents: 67
diff changeset
719 return XEXP (in_rtx, idx) == NULL_RTX;
kono
parents: 67
diff changeset
720
kono
parents: 67
diff changeset
721 case 's':
kono
parents: 67
diff changeset
722 return XSTR (in_rtx, idx) == NULL;
kono
parents: 67
diff changeset
723
kono
parents: 67
diff changeset
724 case '0':
kono
parents: 67
diff changeset
725 switch (GET_CODE (in_rtx))
kono
parents: 67
diff changeset
726 {
kono
parents: 67
diff changeset
727 case JUMP_INSN:
kono
parents: 67
diff changeset
728 /* JUMP_LABELs are always omitted in compact mode, so treat
kono
parents: 67
diff changeset
729 any value here as omittable, so that earlier operands can
kono
parents: 67
diff changeset
730 potentially be omitted also. */
kono
parents: 67
diff changeset
731 return m_compact;
kono
parents: 67
diff changeset
732
kono
parents: 67
diff changeset
733 default:
kono
parents: 67
diff changeset
734 return false;
kono
parents: 67
diff changeset
735
kono
parents: 67
diff changeset
736 }
kono
parents: 67
diff changeset
737
kono
parents: 67
diff changeset
738 default:
kono
parents: 67
diff changeset
739 return false;
kono
parents: 67
diff changeset
740 }
kono
parents: 67
diff changeset
741 }
kono
parents: 67
diff changeset
742
kono
parents: 67
diff changeset
743 /* Print IN_RTX onto m_outfile. This is the recursive part of printing. */
kono
parents: 67
diff changeset
744
kono
parents: 67
diff changeset
745 void
kono
parents: 67
diff changeset
746 rtx_writer::print_rtx (const_rtx in_rtx)
kono
parents: 67
diff changeset
747 {
kono
parents: 67
diff changeset
748 int idx = 0;
kono
parents: 67
diff changeset
749
kono
parents: 67
diff changeset
750 if (m_sawclose)
kono
parents: 67
diff changeset
751 {
kono
parents: 67
diff changeset
752 if (m_simple)
kono
parents: 67
diff changeset
753 fputc (' ', m_outfile);
kono
parents: 67
diff changeset
754 else
kono
parents: 67
diff changeset
755 fprintf (m_outfile, "\n%s%*s", print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
756 m_sawclose = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 if (in_rtx == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760 {
111
kono
parents: 67
diff changeset
761 fputs ("(nil)", m_outfile);
kono
parents: 67
diff changeset
762 m_sawclose = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
765 else if (GET_CODE (in_rtx) > NUM_RTX_CODE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
766 {
111
kono
parents: 67
diff changeset
767 fprintf (m_outfile, "(??? bad code %d\n%s%*s)", GET_CODE (in_rtx),
kono
parents: 67
diff changeset
768 print_rtx_head, m_indent * 2, "");
kono
parents: 67
diff changeset
769 m_sawclose = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 return;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
771 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772
111
kono
parents: 67
diff changeset
773 fputc ('(', m_outfile);
kono
parents: 67
diff changeset
774
kono
parents: 67
diff changeset
775 /* Print name of expression code. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
776
111
kono
parents: 67
diff changeset
777 /* Handle reuse. */
kono
parents: 67
diff changeset
778 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
779 if (m_rtx_reuse_manager)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 {
111
kono
parents: 67
diff changeset
781 int reuse_id;
kono
parents: 67
diff changeset
782 if (m_rtx_reuse_manager->has_reuse_id (in_rtx, &reuse_id))
kono
parents: 67
diff changeset
783 {
kono
parents: 67
diff changeset
784 /* Have we already seen the defn of this rtx? */
kono
parents: 67
diff changeset
785 if (m_rtx_reuse_manager->seen_def_p (reuse_id))
kono
parents: 67
diff changeset
786 {
kono
parents: 67
diff changeset
787 fprintf (m_outfile, "reuse_rtx %i)", reuse_id);
kono
parents: 67
diff changeset
788 m_sawclose = 1;
kono
parents: 67
diff changeset
789 return;
kono
parents: 67
diff changeset
790 }
kono
parents: 67
diff changeset
791 else
kono
parents: 67
diff changeset
792 {
kono
parents: 67
diff changeset
793 /* First time we've seen this reused-rtx. */
kono
parents: 67
diff changeset
794 fprintf (m_outfile, "%i|", reuse_id);
kono
parents: 67
diff changeset
795 m_rtx_reuse_manager->set_seen_def (reuse_id);
kono
parents: 67
diff changeset
796 }
kono
parents: 67
diff changeset
797 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 }
111
kono
parents: 67
diff changeset
799 #endif /* #ifndef GENERATOR_FILE */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
800
111
kono
parents: 67
diff changeset
801 /* In compact mode, prefix the code of insns with "c",
kono
parents: 67
diff changeset
802 giving "cinsn", "cnote" etc. */
kono
parents: 67
diff changeset
803 if (m_compact && is_a <const rtx_insn *, const struct rtx_def> (in_rtx))
kono
parents: 67
diff changeset
804 {
kono
parents: 67
diff changeset
805 /* "ccode_label" is slightly awkward, so special-case it as
kono
parents: 67
diff changeset
806 just "clabel". */
kono
parents: 67
diff changeset
807 rtx_code code = GET_CODE (in_rtx);
kono
parents: 67
diff changeset
808 if (code == CODE_LABEL)
kono
parents: 67
diff changeset
809 fprintf (m_outfile, "clabel");
kono
parents: 67
diff changeset
810 else
kono
parents: 67
diff changeset
811 fprintf (m_outfile, "c%s", GET_RTX_NAME (code));
kono
parents: 67
diff changeset
812 }
kono
parents: 67
diff changeset
813 else if (m_simple && CONST_INT_P (in_rtx))
kono
parents: 67
diff changeset
814 ; /* no code. */
kono
parents: 67
diff changeset
815 else
kono
parents: 67
diff changeset
816 fprintf (m_outfile, "%s", GET_RTX_NAME (GET_CODE (in_rtx)));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817
111
kono
parents: 67
diff changeset
818 if (! m_simple)
kono
parents: 67
diff changeset
819 {
kono
parents: 67
diff changeset
820 if (RTX_FLAG (in_rtx, in_struct))
kono
parents: 67
diff changeset
821 fputs ("/s", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
822
111
kono
parents: 67
diff changeset
823 if (RTX_FLAG (in_rtx, volatil))
kono
parents: 67
diff changeset
824 fputs ("/v", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
825
111
kono
parents: 67
diff changeset
826 if (RTX_FLAG (in_rtx, unchanging))
kono
parents: 67
diff changeset
827 fputs ("/u", m_outfile);
kono
parents: 67
diff changeset
828
kono
parents: 67
diff changeset
829 if (RTX_FLAG (in_rtx, frame_related))
kono
parents: 67
diff changeset
830 fputs ("/f", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
831
111
kono
parents: 67
diff changeset
832 if (RTX_FLAG (in_rtx, jump))
kono
parents: 67
diff changeset
833 fputs ("/j", m_outfile);
kono
parents: 67
diff changeset
834
kono
parents: 67
diff changeset
835 if (RTX_FLAG (in_rtx, call))
kono
parents: 67
diff changeset
836 fputs ("/c", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837
111
kono
parents: 67
diff changeset
838 if (RTX_FLAG (in_rtx, return_val))
kono
parents: 67
diff changeset
839 fputs ("/i", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840
111
kono
parents: 67
diff changeset
841 /* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
kono
parents: 67
diff changeset
842 if ((GET_CODE (in_rtx) == EXPR_LIST
kono
parents: 67
diff changeset
843 || GET_CODE (in_rtx) == INSN_LIST
kono
parents: 67
diff changeset
844 || GET_CODE (in_rtx) == INT_LIST)
kono
parents: 67
diff changeset
845 && (int)GET_MODE (in_rtx) < REG_NOTE_MAX
kono
parents: 67
diff changeset
846 && !m_in_call_function_usage)
kono
parents: 67
diff changeset
847 fprintf (m_outfile, ":%s",
kono
parents: 67
diff changeset
848 GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
kono
parents: 67
diff changeset
849
kono
parents: 67
diff changeset
850 /* For other rtl, print the mode if it's not VOID. */
kono
parents: 67
diff changeset
851 else if (GET_MODE (in_rtx) != VOIDmode)
kono
parents: 67
diff changeset
852 fprintf (m_outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
853
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
854 #ifndef GENERATOR_FILE
111
kono
parents: 67
diff changeset
855 if (GET_CODE (in_rtx) == VAR_LOCATION)
kono
parents: 67
diff changeset
856 {
kono
parents: 67
diff changeset
857 if (TREE_CODE (PAT_VAR_LOCATION_DECL (in_rtx)) == STRING_CST)
kono
parents: 67
diff changeset
858 fputs (" <debug string placeholder>", m_outfile);
kono
parents: 67
diff changeset
859 else
kono
parents: 67
diff changeset
860 print_mem_expr (m_outfile, PAT_VAR_LOCATION_DECL (in_rtx));
kono
parents: 67
diff changeset
861 fputc (' ', m_outfile);
kono
parents: 67
diff changeset
862 print_rtx (PAT_VAR_LOCATION_LOC (in_rtx));
kono
parents: 67
diff changeset
863 if (PAT_VAR_LOCATION_STATUS (in_rtx)
kono
parents: 67
diff changeset
864 == VAR_INIT_STATUS_UNINITIALIZED)
kono
parents: 67
diff changeset
865 fprintf (m_outfile, " [uninit]");
kono
parents: 67
diff changeset
866 m_sawclose = 1;
kono
parents: 67
diff changeset
867 idx = GET_RTX_LENGTH (VAR_LOCATION);
kono
parents: 67
diff changeset
868 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
869 #endif
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
870 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
871
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
872 #ifndef GENERATOR_FILE
111
kono
parents: 67
diff changeset
873 if (CONST_DOUBLE_AS_FLOAT_P (in_rtx))
kono
parents: 67
diff changeset
874 idx = 5;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
875 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
876
111
kono
parents: 67
diff changeset
877 /* For insns, print the INSN_UID. */
kono
parents: 67
diff changeset
878 if (INSN_CHAIN_CODE_P (GET_CODE (in_rtx)))
kono
parents: 67
diff changeset
879 {
kono
parents: 67
diff changeset
880 if (flag_dump_unnumbered)
kono
parents: 67
diff changeset
881 fprintf (m_outfile, " #");
kono
parents: 67
diff changeset
882 else
kono
parents: 67
diff changeset
883 fprintf (m_outfile, " %d", INSN_UID (in_rtx));
kono
parents: 67
diff changeset
884 }
kono
parents: 67
diff changeset
885
kono
parents: 67
diff changeset
886 /* Determine which is the final operand to print.
kono
parents: 67
diff changeset
887 In compact mode, skip trailing operands that have the default values
kono
parents: 67
diff changeset
888 e.g. trailing "(nil)" values. */
kono
parents: 67
diff changeset
889 int limit = GET_RTX_LENGTH (GET_CODE (in_rtx));
kono
parents: 67
diff changeset
890 if (m_compact)
kono
parents: 67
diff changeset
891 while (limit > idx && operand_has_default_value_p (in_rtx, limit - 1))
kono
parents: 67
diff changeset
892 limit--;
kono
parents: 67
diff changeset
893
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
894 /* Get the format string and skip the first elements if we have handled
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
895 them already. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
896
111
kono
parents: 67
diff changeset
897 for (; idx < limit; idx++)
kono
parents: 67
diff changeset
898 print_rtx_operand (in_rtx, idx);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
899
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
900 switch (GET_CODE (in_rtx))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
901 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
902 #ifndef GENERATOR_FILE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
903 case MEM:
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
904 if (__builtin_expect (final_insns_dump_p, false))
111
kono
parents: 67
diff changeset
905 fprintf (m_outfile, " [");
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
906 else
111
kono
parents: 67
diff changeset
907 fprintf (m_outfile, " [" HOST_WIDE_INT_PRINT_DEC,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
908 (HOST_WIDE_INT) MEM_ALIAS_SET (in_rtx));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
909
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
910 if (MEM_EXPR (in_rtx))
111
kono
parents: 67
diff changeset
911 print_mem_expr (m_outfile, MEM_EXPR (in_rtx));
kono
parents: 67
diff changeset
912 else
kono
parents: 67
diff changeset
913 fputc (' ', m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
914
111
kono
parents: 67
diff changeset
915 if (MEM_OFFSET_KNOWN_P (in_rtx))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
916 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
917 fprintf (m_outfile, "+");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
918 print_poly_int (m_outfile, MEM_OFFSET (in_rtx));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
919 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
920
111
kono
parents: 67
diff changeset
921 if (MEM_SIZE_KNOWN_P (in_rtx))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
922 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
923 fprintf (m_outfile, " S");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
924 print_poly_int (m_outfile, MEM_SIZE (in_rtx));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
925 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
926
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
927 if (MEM_ALIGN (in_rtx) != 1)
111
kono
parents: 67
diff changeset
928 fprintf (m_outfile, " A%u", MEM_ALIGN (in_rtx));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
929
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
930 if (!ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (in_rtx)))
111
kono
parents: 67
diff changeset
931 fprintf (m_outfile, " AS%u", MEM_ADDR_SPACE (in_rtx));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
932
111
kono
parents: 67
diff changeset
933 fputc (']', m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
934 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
935
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
936 case CONST_DOUBLE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
937 if (FLOAT_MODE_P (GET_MODE (in_rtx)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
938 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
939 char s[60];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
940
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
941 real_to_decimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 sizeof (s), 0, 1);
111
kono
parents: 67
diff changeset
943 fprintf (m_outfile, " %s", s);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
944
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945 real_to_hexadecimal (s, CONST_DOUBLE_REAL_VALUE (in_rtx),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
946 sizeof (s), 0, 1);
111
kono
parents: 67
diff changeset
947 fprintf (m_outfile, " [%s]", s);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
949 break;
111
kono
parents: 67
diff changeset
950
kono
parents: 67
diff changeset
951 case CONST_WIDE_INT:
kono
parents: 67
diff changeset
952 fprintf (m_outfile, " ");
kono
parents: 67
diff changeset
953 cwi_output_hex (m_outfile, in_rtx);
kono
parents: 67
diff changeset
954 break;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
955
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
956 case CONST_POLY_INT:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
957 fprintf (m_outfile, " [");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
958 print_dec (CONST_POLY_INT_COEFFS (in_rtx)[0], m_outfile, SIGNED);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
959 for (unsigned int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
960 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
961 fprintf (m_outfile, ", ");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
962 print_dec (CONST_POLY_INT_COEFFS (in_rtx)[i], m_outfile, SIGNED);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
963 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
964 fprintf (m_outfile, "]");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
965 break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
966 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
967
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
968 case CODE_LABEL:
111
kono
parents: 67
diff changeset
969 if (!m_compact)
kono
parents: 67
diff changeset
970 fprintf (m_outfile, " [%d uses]", LABEL_NUSES (in_rtx));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
971 switch (LABEL_KIND (in_rtx))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
972 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
973 case LABEL_NORMAL: break;
111
kono
parents: 67
diff changeset
974 case LABEL_STATIC_ENTRY: fputs (" [entry]", m_outfile); break;
kono
parents: 67
diff changeset
975 case LABEL_GLOBAL_ENTRY: fputs (" [global entry]", m_outfile); break;
kono
parents: 67
diff changeset
976 case LABEL_WEAK_ENTRY: fputs (" [weak entry]", m_outfile); break;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
977 default: gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
978 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
979 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
980
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
981 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
982 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
983 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
984
111
kono
parents: 67
diff changeset
985 fputc (')', m_outfile);
kono
parents: 67
diff changeset
986 m_sawclose = 1;
kono
parents: 67
diff changeset
987 }
kono
parents: 67
diff changeset
988
kono
parents: 67
diff changeset
989 /* Emit a closing parenthesis and newline. */
kono
parents: 67
diff changeset
990
kono
parents: 67
diff changeset
991 void
kono
parents: 67
diff changeset
992 rtx_writer::finish_directive ()
kono
parents: 67
diff changeset
993 {
kono
parents: 67
diff changeset
994 fprintf (m_outfile, ")\n");
kono
parents: 67
diff changeset
995 m_sawclose = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
996 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
997
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
998 /* Print an rtx on the current line of FILE. Initially indent IND
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
999 characters. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1000
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1001 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1002 print_inline_rtx (FILE *outf, const_rtx x, int ind)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003 {
111
kono
parents: 67
diff changeset
1004 rtx_writer w (outf, ind, false, false, NULL);
kono
parents: 67
diff changeset
1005 w.print_rtx (x);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1006 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1007
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1008 /* Call this function from the debugger to see what X looks like. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1009
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1010 DEBUG_FUNCTION void
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1011 debug_rtx (const_rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1012 {
111
kono
parents: 67
diff changeset
1013 rtx_writer w (stderr, 0, false, false, NULL);
kono
parents: 67
diff changeset
1014 w.print_rtx (x);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1015 fprintf (stderr, "\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1016 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1017
111
kono
parents: 67
diff changeset
1018 /* Dump rtx REF. */
kono
parents: 67
diff changeset
1019
kono
parents: 67
diff changeset
1020 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
1021 debug (const rtx_def &ref)
kono
parents: 67
diff changeset
1022 {
kono
parents: 67
diff changeset
1023 debug_rtx (&ref);
kono
parents: 67
diff changeset
1024 }
kono
parents: 67
diff changeset
1025
kono
parents: 67
diff changeset
1026 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
1027 debug (const rtx_def *ptr)
kono
parents: 67
diff changeset
1028 {
kono
parents: 67
diff changeset
1029 if (ptr)
kono
parents: 67
diff changeset
1030 debug (*ptr);
kono
parents: 67
diff changeset
1031 else
kono
parents: 67
diff changeset
1032 fprintf (stderr, "<nil>\n");
kono
parents: 67
diff changeset
1033 }
kono
parents: 67
diff changeset
1034
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1035 /* Like debug_rtx but with no newline, as debug_helper will add one.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1036
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1037 Note: No debug_slim(rtx_insn *) variant implemented, as this
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1038 function can serve for both rtx and rtx_insn. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1039
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1040 static void
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1041 debug_slim (const_rtx x)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1042 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1043 rtx_writer w (stderr, 0, false, false, NULL);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1044 w.print_rtx (x);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1045 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1046
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1047 DEFINE_DEBUG_VEC (rtx_def *)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1048 DEFINE_DEBUG_VEC (rtx_insn *)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1049 DEFINE_DEBUG_HASH_SET (rtx_def *)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1050 DEFINE_DEBUG_HASH_SET (rtx_insn *)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1051
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1052 /* Count of rtx's to print with debug_rtx_list.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1053 This global exists because gdb user defined commands have no arguments. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1054
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1055 DEBUG_VARIABLE int debug_rtx_count = 0; /* 0 is treated as equivalent to 1 */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1056
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1057 /* Call this function to print list from X on.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1058
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1059 N is a count of the rtx's to print. Positive values print from the specified
111
kono
parents: 67
diff changeset
1060 rtx_insn on. Negative values print a window around the rtx_insn.
kono
parents: 67
diff changeset
1061 EG: -5 prints 2 rtx_insn's on either side (in addition to the specified
kono
parents: 67
diff changeset
1062 rtx_insn). */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1063
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1064 DEBUG_FUNCTION void
111
kono
parents: 67
diff changeset
1065 debug_rtx_list (const rtx_insn *x, int n)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1066 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1067 int i,count;
111
kono
parents: 67
diff changeset
1068 const rtx_insn *insn;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1069
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1070 count = n == 0 ? 1 : n < 0 ? -n : n;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1071
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1072 /* If we are printing a window, back up to the start. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1073
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1074 if (n < 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1075 for (i = count / 2; i > 0; i--)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1076 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1077 if (PREV_INSN (x) == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1078 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1079 x = PREV_INSN (x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1080 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1081
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1082 for (i = count, insn = x; i > 0 && insn != 0; i--, insn = NEXT_INSN (insn))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1083 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1084 debug_rtx (insn);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1085 fprintf (stderr, "\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1086 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1087 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1088
111
kono
parents: 67
diff changeset
1089 /* Call this function to print an rtx_insn list from START to END
kono
parents: 67
diff changeset
1090 inclusive. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1091
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1092 DEBUG_FUNCTION void
111
kono
parents: 67
diff changeset
1093 debug_rtx_range (const rtx_insn *start, const rtx_insn *end)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1094 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1095 while (1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1096 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1097 debug_rtx (start);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1098 fprintf (stderr, "\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1099 if (!start || start == end)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1100 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1101 start = NEXT_INSN (start);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1102 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1103 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1104
111
kono
parents: 67
diff changeset
1105 /* Call this function to search an rtx_insn list to find one with insn uid UID,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1106 and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1107 The found insn is returned to enable further debugging analysis. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1108
111
kono
parents: 67
diff changeset
1109 DEBUG_FUNCTION const rtx_insn *
kono
parents: 67
diff changeset
1110 debug_rtx_find (const rtx_insn *x, int uid)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1111 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1112 while (x != 0 && INSN_UID (x) != uid)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1113 x = NEXT_INSN (x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1114 if (x != 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1115 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1116 debug_rtx_list (x, debug_rtx_count);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1117 return x;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1118 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1119 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1120 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1121 fprintf (stderr, "insn uid %d not found\n", uid);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1122 return 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1123 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1124 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1125
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1126 /* External entry point for printing a chain of insns
111
kono
parents: 67
diff changeset
1127 starting with RTX_FIRST.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1128 A blank line separates insns.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1129
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1130 If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1131
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1132 void
111
kono
parents: 67
diff changeset
1133 rtx_writer::print_rtl (const_rtx rtx_first)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1134 {
111
kono
parents: 67
diff changeset
1135 const rtx_insn *tmp_rtx;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1136
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1137 if (rtx_first == 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1138 {
111
kono
parents: 67
diff changeset
1139 fputs (print_rtx_head, m_outfile);
kono
parents: 67
diff changeset
1140 fputs ("(nil)\n", m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1141 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1142 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1143 switch (GET_CODE (rtx_first))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1144 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1145 case INSN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1146 case JUMP_INSN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1147 case CALL_INSN:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1148 case NOTE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1149 case CODE_LABEL:
111
kono
parents: 67
diff changeset
1150 case JUMP_TABLE_DATA:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1151 case BARRIER:
111
kono
parents: 67
diff changeset
1152 for (tmp_rtx = as_a <const rtx_insn *> (rtx_first);
kono
parents: 67
diff changeset
1153 tmp_rtx != 0;
kono
parents: 67
diff changeset
1154 tmp_rtx = NEXT_INSN (tmp_rtx))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1155 {
111
kono
parents: 67
diff changeset
1156 fputs (print_rtx_head, m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1157 print_rtx (tmp_rtx);
111
kono
parents: 67
diff changeset
1158 fprintf (m_outfile, "\n");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1159 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1160 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1161
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1162 default:
111
kono
parents: 67
diff changeset
1163 fputs (print_rtx_head, m_outfile);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1164 print_rtx (rtx_first);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1165 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1166 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1167
111
kono
parents: 67
diff changeset
1168 /* External entry point for printing a chain of insns
kono
parents: 67
diff changeset
1169 starting with RTX_FIRST onto file OUTF.
kono
parents: 67
diff changeset
1170 A blank line separates insns.
kono
parents: 67
diff changeset
1171
kono
parents: 67
diff changeset
1172 If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
kono
parents: 67
diff changeset
1173
kono
parents: 67
diff changeset
1174 void
kono
parents: 67
diff changeset
1175 print_rtl (FILE *outf, const_rtx rtx_first)
kono
parents: 67
diff changeset
1176 {
kono
parents: 67
diff changeset
1177 rtx_writer w (outf, 0, false, false, NULL);
kono
parents: 67
diff changeset
1178 w.print_rtl (rtx_first);
kono
parents: 67
diff changeset
1179 }
kono
parents: 67
diff changeset
1180
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1181 /* Like print_rtx, except specify a file. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1182 /* Return nonzero if we actually printed anything. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1183
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1184 int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1185 print_rtl_single (FILE *outf, const_rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1186 {
111
kono
parents: 67
diff changeset
1187 rtx_writer w (outf, 0, false, false, NULL);
kono
parents: 67
diff changeset
1188 return w.print_rtl_single_with_indent (x, 0);
kono
parents: 67
diff changeset
1189 }
kono
parents: 67
diff changeset
1190
kono
parents: 67
diff changeset
1191 /* Like print_rtl_single, except specify an indentation. */
kono
parents: 67
diff changeset
1192
kono
parents: 67
diff changeset
1193 int
kono
parents: 67
diff changeset
1194 rtx_writer::print_rtl_single_with_indent (const_rtx x, int ind)
kono
parents: 67
diff changeset
1195 {
kono
parents: 67
diff changeset
1196 char *s_indent = (char *) alloca ((size_t) ind + 1);
kono
parents: 67
diff changeset
1197 memset ((void *) s_indent, ' ', (size_t) ind);
kono
parents: 67
diff changeset
1198 s_indent[ind] = '\0';
kono
parents: 67
diff changeset
1199 fputs (s_indent, m_outfile);
kono
parents: 67
diff changeset
1200 fputs (print_rtx_head, m_outfile);
kono
parents: 67
diff changeset
1201
kono
parents: 67
diff changeset
1202 int old_indent = m_indent;
kono
parents: 67
diff changeset
1203 m_indent = ind;
kono
parents: 67
diff changeset
1204 m_sawclose = 0;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1205 print_rtx (x);
111
kono
parents: 67
diff changeset
1206 putc ('\n', m_outfile);
kono
parents: 67
diff changeset
1207 m_indent = old_indent;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1208 return 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1209 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1210
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1211
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1212 /* Like print_rtl except without all the detail; for example,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1213 if RTX is a CONST_INT then print in decimal format. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1214
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1215 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1216 print_simple_rtl (FILE *outf, const_rtx x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1217 {
111
kono
parents: 67
diff changeset
1218 rtx_writer w (outf, 0, true, false, NULL);
kono
parents: 67
diff changeset
1219 w.print_rtl (x);
kono
parents: 67
diff changeset
1220 }
kono
parents: 67
diff changeset
1221
kono
parents: 67
diff changeset
1222 /* Print the elements of VEC to FILE. */
kono
parents: 67
diff changeset
1223
kono
parents: 67
diff changeset
1224 void
kono
parents: 67
diff changeset
1225 print_rtx_insn_vec (FILE *file, const vec<rtx_insn *> &vec)
kono
parents: 67
diff changeset
1226 {
kono
parents: 67
diff changeset
1227 fputc('{', file);
kono
parents: 67
diff changeset
1228
kono
parents: 67
diff changeset
1229 unsigned int len = vec.length ();
kono
parents: 67
diff changeset
1230 for (unsigned int i = 0; i < len; i++)
kono
parents: 67
diff changeset
1231 {
kono
parents: 67
diff changeset
1232 print_rtl (file, vec[i]);
kono
parents: 67
diff changeset
1233 if (i < len - 1)
kono
parents: 67
diff changeset
1234 fputs (", ", file);
kono
parents: 67
diff changeset
1235 }
kono
parents: 67
diff changeset
1236
kono
parents: 67
diff changeset
1237 fputc ('}', file);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1238 }
111
kono
parents: 67
diff changeset
1239
kono
parents: 67
diff changeset
1240 #ifndef GENERATOR_FILE
kono
parents: 67
diff changeset
1241 /* The functions below try to print RTL in a form resembling assembler
kono
parents: 67
diff changeset
1242 mnemonics. Because this form is more concise than the "traditional" form
kono
parents: 67
diff changeset
1243 of RTL printing in Lisp-style, the form printed by this file is called
kono
parents: 67
diff changeset
1244 "slim". RTL dumps in slim format can be obtained by appending the "-slim"
kono
parents: 67
diff changeset
1245 option to -fdump-rtl-<pass>. Control flow graph output as a DOT file is
kono
parents: 67
diff changeset
1246 always printed in slim form.
kono
parents: 67
diff changeset
1247
kono
parents: 67
diff changeset
1248 The normal interface to the functionality provided in this pretty-printer
kono
parents: 67
diff changeset
1249 is through the dump_*_slim functions to print to a stream, or via the
kono
parents: 67
diff changeset
1250 print_*_slim functions to print into a user's pretty-printer.
kono
parents: 67
diff changeset
1251
kono
parents: 67
diff changeset
1252 It is also possible to obtain a string for a single pattern as a string
kono
parents: 67
diff changeset
1253 pointer, via str_pattern_slim, but this usage is discouraged. */
kono
parents: 67
diff changeset
1254
kono
parents: 67
diff changeset
1255 /* For insns we print patterns, and for some patterns we print insns... */
kono
parents: 67
diff changeset
1256 static void print_insn_with_notes (pretty_printer *, const rtx_insn *);
kono
parents: 67
diff changeset
1257
kono
parents: 67
diff changeset
1258 /* This recognizes rtx'en classified as expressions. These are always
kono
parents: 67
diff changeset
1259 represent some action on values or results of other expression, that
kono
parents: 67
diff changeset
1260 may be stored in objects representing values. */
kono
parents: 67
diff changeset
1261
kono
parents: 67
diff changeset
1262 static void
kono
parents: 67
diff changeset
1263 print_exp (pretty_printer *pp, const_rtx x, int verbose)
kono
parents: 67
diff changeset
1264 {
kono
parents: 67
diff changeset
1265 const char *st[4];
kono
parents: 67
diff changeset
1266 const char *fun;
kono
parents: 67
diff changeset
1267 rtx op[4];
kono
parents: 67
diff changeset
1268 int i;
kono
parents: 67
diff changeset
1269
kono
parents: 67
diff changeset
1270 fun = (char *) 0;
kono
parents: 67
diff changeset
1271 for (i = 0; i < 4; i++)
kono
parents: 67
diff changeset
1272 {
kono
parents: 67
diff changeset
1273 st[i] = (char *) 0;
kono
parents: 67
diff changeset
1274 op[i] = NULL_RTX;
kono
parents: 67
diff changeset
1275 }
kono
parents: 67
diff changeset
1276
kono
parents: 67
diff changeset
1277 switch (GET_CODE (x))
kono
parents: 67
diff changeset
1278 {
kono
parents: 67
diff changeset
1279 case PLUS:
kono
parents: 67
diff changeset
1280 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1281 if (CONST_INT_P (XEXP (x, 1))
kono
parents: 67
diff changeset
1282 && INTVAL (XEXP (x, 1)) < 0)
kono
parents: 67
diff changeset
1283 {
kono
parents: 67
diff changeset
1284 st[1] = "-";
kono
parents: 67
diff changeset
1285 op[1] = GEN_INT (-INTVAL (XEXP (x, 1)));
kono
parents: 67
diff changeset
1286 }
kono
parents: 67
diff changeset
1287 else
kono
parents: 67
diff changeset
1288 {
kono
parents: 67
diff changeset
1289 st[1] = "+";
kono
parents: 67
diff changeset
1290 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1291 }
kono
parents: 67
diff changeset
1292 break;
kono
parents: 67
diff changeset
1293 case LO_SUM:
kono
parents: 67
diff changeset
1294 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1295 st[1] = "+low(";
kono
parents: 67
diff changeset
1296 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1297 st[2] = ")";
kono
parents: 67
diff changeset
1298 break;
kono
parents: 67
diff changeset
1299 case MINUS:
kono
parents: 67
diff changeset
1300 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1301 st[1] = "-";
kono
parents: 67
diff changeset
1302 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1303 break;
kono
parents: 67
diff changeset
1304 case COMPARE:
kono
parents: 67
diff changeset
1305 fun = "cmp";
kono
parents: 67
diff changeset
1306 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1307 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1308 break;
kono
parents: 67
diff changeset
1309 case NEG:
kono
parents: 67
diff changeset
1310 st[0] = "-";
kono
parents: 67
diff changeset
1311 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1312 break;
kono
parents: 67
diff changeset
1313 case FMA:
kono
parents: 67
diff changeset
1314 st[0] = "{";
kono
parents: 67
diff changeset
1315 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1316 st[1] = "*";
kono
parents: 67
diff changeset
1317 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1318 st[2] = "+";
kono
parents: 67
diff changeset
1319 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1320 st[3] = "}";
kono
parents: 67
diff changeset
1321 break;
kono
parents: 67
diff changeset
1322 case MULT:
kono
parents: 67
diff changeset
1323 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1324 st[1] = "*";
kono
parents: 67
diff changeset
1325 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1326 break;
kono
parents: 67
diff changeset
1327 case DIV:
kono
parents: 67
diff changeset
1328 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1329 st[1] = "/";
kono
parents: 67
diff changeset
1330 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1331 break;
kono
parents: 67
diff changeset
1332 case UDIV:
kono
parents: 67
diff changeset
1333 fun = "udiv";
kono
parents: 67
diff changeset
1334 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1335 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1336 break;
kono
parents: 67
diff changeset
1337 case MOD:
kono
parents: 67
diff changeset
1338 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1339 st[1] = "%";
kono
parents: 67
diff changeset
1340 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1341 break;
kono
parents: 67
diff changeset
1342 case UMOD:
kono
parents: 67
diff changeset
1343 fun = "umod";
kono
parents: 67
diff changeset
1344 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1345 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1346 break;
kono
parents: 67
diff changeset
1347 case SMIN:
kono
parents: 67
diff changeset
1348 fun = "smin";
kono
parents: 67
diff changeset
1349 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1350 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1351 break;
kono
parents: 67
diff changeset
1352 case SMAX:
kono
parents: 67
diff changeset
1353 fun = "smax";
kono
parents: 67
diff changeset
1354 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1355 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1356 break;
kono
parents: 67
diff changeset
1357 case UMIN:
kono
parents: 67
diff changeset
1358 fun = "umin";
kono
parents: 67
diff changeset
1359 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1360 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1361 break;
kono
parents: 67
diff changeset
1362 case UMAX:
kono
parents: 67
diff changeset
1363 fun = "umax";
kono
parents: 67
diff changeset
1364 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1365 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1366 break;
kono
parents: 67
diff changeset
1367 case NOT:
kono
parents: 67
diff changeset
1368 st[0] = "~";
kono
parents: 67
diff changeset
1369 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1370 break;
kono
parents: 67
diff changeset
1371 case AND:
kono
parents: 67
diff changeset
1372 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1373 st[1] = "&";
kono
parents: 67
diff changeset
1374 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1375 break;
kono
parents: 67
diff changeset
1376 case IOR:
kono
parents: 67
diff changeset
1377 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1378 st[1] = "|";
kono
parents: 67
diff changeset
1379 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1380 break;
kono
parents: 67
diff changeset
1381 case XOR:
kono
parents: 67
diff changeset
1382 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1383 st[1] = "^";
kono
parents: 67
diff changeset
1384 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1385 break;
kono
parents: 67
diff changeset
1386 case ASHIFT:
kono
parents: 67
diff changeset
1387 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1388 st[1] = "<<";
kono
parents: 67
diff changeset
1389 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1390 break;
kono
parents: 67
diff changeset
1391 case LSHIFTRT:
kono
parents: 67
diff changeset
1392 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1393 st[1] = " 0>>";
kono
parents: 67
diff changeset
1394 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1395 break;
kono
parents: 67
diff changeset
1396 case ASHIFTRT:
kono
parents: 67
diff changeset
1397 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1398 st[1] = ">>";
kono
parents: 67
diff changeset
1399 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1400 break;
kono
parents: 67
diff changeset
1401 case ROTATE:
kono
parents: 67
diff changeset
1402 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1403 st[1] = "<-<";
kono
parents: 67
diff changeset
1404 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1405 break;
kono
parents: 67
diff changeset
1406 case ROTATERT:
kono
parents: 67
diff changeset
1407 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1408 st[1] = ">->";
kono
parents: 67
diff changeset
1409 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1410 break;
kono
parents: 67
diff changeset
1411 case NE:
kono
parents: 67
diff changeset
1412 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1413 st[1] = "!=";
kono
parents: 67
diff changeset
1414 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1415 break;
kono
parents: 67
diff changeset
1416 case EQ:
kono
parents: 67
diff changeset
1417 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1418 st[1] = "==";
kono
parents: 67
diff changeset
1419 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1420 break;
kono
parents: 67
diff changeset
1421 case GE:
kono
parents: 67
diff changeset
1422 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1423 st[1] = ">=";
kono
parents: 67
diff changeset
1424 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1425 break;
kono
parents: 67
diff changeset
1426 case GT:
kono
parents: 67
diff changeset
1427 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1428 st[1] = ">";
kono
parents: 67
diff changeset
1429 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1430 break;
kono
parents: 67
diff changeset
1431 case LE:
kono
parents: 67
diff changeset
1432 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1433 st[1] = "<=";
kono
parents: 67
diff changeset
1434 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1435 break;
kono
parents: 67
diff changeset
1436 case LT:
kono
parents: 67
diff changeset
1437 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1438 st[1] = "<";
kono
parents: 67
diff changeset
1439 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1440 break;
kono
parents: 67
diff changeset
1441 case SIGN_EXTRACT:
kono
parents: 67
diff changeset
1442 fun = (verbose) ? "sign_extract" : "sxt";
kono
parents: 67
diff changeset
1443 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1444 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1445 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1446 break;
kono
parents: 67
diff changeset
1447 case ZERO_EXTRACT:
kono
parents: 67
diff changeset
1448 fun = (verbose) ? "zero_extract" : "zxt";
kono
parents: 67
diff changeset
1449 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1450 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1451 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1452 break;
kono
parents: 67
diff changeset
1453 case SIGN_EXTEND:
kono
parents: 67
diff changeset
1454 fun = (verbose) ? "sign_extend" : "sxn";
kono
parents: 67
diff changeset
1455 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1456 break;
kono
parents: 67
diff changeset
1457 case ZERO_EXTEND:
kono
parents: 67
diff changeset
1458 fun = (verbose) ? "zero_extend" : "zxn";
kono
parents: 67
diff changeset
1459 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1460 break;
kono
parents: 67
diff changeset
1461 case FLOAT_EXTEND:
kono
parents: 67
diff changeset
1462 fun = (verbose) ? "float_extend" : "fxn";
kono
parents: 67
diff changeset
1463 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1464 break;
kono
parents: 67
diff changeset
1465 case TRUNCATE:
kono
parents: 67
diff changeset
1466 fun = (verbose) ? "trunc" : "trn";
kono
parents: 67
diff changeset
1467 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1468 break;
kono
parents: 67
diff changeset
1469 case FLOAT_TRUNCATE:
kono
parents: 67
diff changeset
1470 fun = (verbose) ? "float_trunc" : "ftr";
kono
parents: 67
diff changeset
1471 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1472 break;
kono
parents: 67
diff changeset
1473 case FLOAT:
kono
parents: 67
diff changeset
1474 fun = (verbose) ? "float" : "flt";
kono
parents: 67
diff changeset
1475 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1476 break;
kono
parents: 67
diff changeset
1477 case UNSIGNED_FLOAT:
kono
parents: 67
diff changeset
1478 fun = (verbose) ? "uns_float" : "ufl";
kono
parents: 67
diff changeset
1479 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1480 break;
kono
parents: 67
diff changeset
1481 case FIX:
kono
parents: 67
diff changeset
1482 fun = "fix";
kono
parents: 67
diff changeset
1483 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1484 break;
kono
parents: 67
diff changeset
1485 case UNSIGNED_FIX:
kono
parents: 67
diff changeset
1486 fun = (verbose) ? "uns_fix" : "ufx";
kono
parents: 67
diff changeset
1487 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1488 break;
kono
parents: 67
diff changeset
1489 case PRE_DEC:
kono
parents: 67
diff changeset
1490 st[0] = "--";
kono
parents: 67
diff changeset
1491 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1492 break;
kono
parents: 67
diff changeset
1493 case PRE_INC:
kono
parents: 67
diff changeset
1494 st[0] = "++";
kono
parents: 67
diff changeset
1495 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1496 break;
kono
parents: 67
diff changeset
1497 case POST_DEC:
kono
parents: 67
diff changeset
1498 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1499 st[1] = "--";
kono
parents: 67
diff changeset
1500 break;
kono
parents: 67
diff changeset
1501 case POST_INC:
kono
parents: 67
diff changeset
1502 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1503 st[1] = "++";
kono
parents: 67
diff changeset
1504 break;
kono
parents: 67
diff changeset
1505 case PRE_MODIFY:
kono
parents: 67
diff changeset
1506 st[0] = "pre ";
kono
parents: 67
diff changeset
1507 op[0] = XEXP (XEXP (x, 1), 0);
kono
parents: 67
diff changeset
1508 st[1] = "+=";
kono
parents: 67
diff changeset
1509 op[1] = XEXP (XEXP (x, 1), 1);
kono
parents: 67
diff changeset
1510 break;
kono
parents: 67
diff changeset
1511 case POST_MODIFY:
kono
parents: 67
diff changeset
1512 st[0] = "post ";
kono
parents: 67
diff changeset
1513 op[0] = XEXP (XEXP (x, 1), 0);
kono
parents: 67
diff changeset
1514 st[1] = "+=";
kono
parents: 67
diff changeset
1515 op[1] = XEXP (XEXP (x, 1), 1);
kono
parents: 67
diff changeset
1516 break;
kono
parents: 67
diff changeset
1517 case CALL:
kono
parents: 67
diff changeset
1518 st[0] = "call ";
kono
parents: 67
diff changeset
1519 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1520 if (verbose)
kono
parents: 67
diff changeset
1521 {
kono
parents: 67
diff changeset
1522 st[1] = " argc:";
kono
parents: 67
diff changeset
1523 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1524 }
kono
parents: 67
diff changeset
1525 break;
kono
parents: 67
diff changeset
1526 case IF_THEN_ELSE:
kono
parents: 67
diff changeset
1527 st[0] = "{(";
kono
parents: 67
diff changeset
1528 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1529 st[1] = ")?";
kono
parents: 67
diff changeset
1530 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1531 st[2] = ":";
kono
parents: 67
diff changeset
1532 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1533 st[3] = "}";
kono
parents: 67
diff changeset
1534 break;
kono
parents: 67
diff changeset
1535 case TRAP_IF:
kono
parents: 67
diff changeset
1536 fun = "trap_if";
kono
parents: 67
diff changeset
1537 op[0] = TRAP_CONDITION (x);
kono
parents: 67
diff changeset
1538 break;
kono
parents: 67
diff changeset
1539 case PREFETCH:
kono
parents: 67
diff changeset
1540 fun = "prefetch";
kono
parents: 67
diff changeset
1541 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1542 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1543 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1544 break;
kono
parents: 67
diff changeset
1545 case UNSPEC:
kono
parents: 67
diff changeset
1546 case UNSPEC_VOLATILE:
kono
parents: 67
diff changeset
1547 {
kono
parents: 67
diff changeset
1548 pp_string (pp, "unspec");
kono
parents: 67
diff changeset
1549 if (GET_CODE (x) == UNSPEC_VOLATILE)
kono
parents: 67
diff changeset
1550 pp_string (pp, "/v");
kono
parents: 67
diff changeset
1551 pp_left_bracket (pp);
kono
parents: 67
diff changeset
1552 for (i = 0; i < XVECLEN (x, 0); i++)
kono
parents: 67
diff changeset
1553 {
kono
parents: 67
diff changeset
1554 if (i != 0)
kono
parents: 67
diff changeset
1555 pp_comma (pp);
kono
parents: 67
diff changeset
1556 print_pattern (pp, XVECEXP (x, 0, i), verbose);
kono
parents: 67
diff changeset
1557 }
kono
parents: 67
diff changeset
1558 pp_string (pp, "] ");
kono
parents: 67
diff changeset
1559 pp_decimal_int (pp, XINT (x, 1));
kono
parents: 67
diff changeset
1560 }
kono
parents: 67
diff changeset
1561 break;
kono
parents: 67
diff changeset
1562 default:
kono
parents: 67
diff changeset
1563 {
kono
parents: 67
diff changeset
1564 /* Most unhandled codes can be printed as pseudo-functions. */
kono
parents: 67
diff changeset
1565 if (GET_RTX_CLASS (GET_CODE (x)) == RTX_UNARY)
kono
parents: 67
diff changeset
1566 {
kono
parents: 67
diff changeset
1567 fun = GET_RTX_NAME (GET_CODE (x));
kono
parents: 67
diff changeset
1568 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1569 }
kono
parents: 67
diff changeset
1570 else if (GET_RTX_CLASS (GET_CODE (x)) == RTX_COMPARE
kono
parents: 67
diff changeset
1571 || GET_RTX_CLASS (GET_CODE (x)) == RTX_COMM_COMPARE
kono
parents: 67
diff changeset
1572 || GET_RTX_CLASS (GET_CODE (x)) == RTX_BIN_ARITH
kono
parents: 67
diff changeset
1573 || GET_RTX_CLASS (GET_CODE (x)) == RTX_COMM_ARITH)
kono
parents: 67
diff changeset
1574 {
kono
parents: 67
diff changeset
1575 fun = GET_RTX_NAME (GET_CODE (x));
kono
parents: 67
diff changeset
1576 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1577 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1578 }
kono
parents: 67
diff changeset
1579 else if (GET_RTX_CLASS (GET_CODE (x)) == RTX_TERNARY)
kono
parents: 67
diff changeset
1580 {
kono
parents: 67
diff changeset
1581 fun = GET_RTX_NAME (GET_CODE (x));
kono
parents: 67
diff changeset
1582 op[0] = XEXP (x, 0);
kono
parents: 67
diff changeset
1583 op[1] = XEXP (x, 1);
kono
parents: 67
diff changeset
1584 op[2] = XEXP (x, 2);
kono
parents: 67
diff changeset
1585 }
kono
parents: 67
diff changeset
1586 else
kono
parents: 67
diff changeset
1587 /* Give up, just print the RTX name. */
kono
parents: 67
diff changeset
1588 st[0] = GET_RTX_NAME (GET_CODE (x));
kono
parents: 67
diff changeset
1589 }
kono
parents: 67
diff changeset
1590 break;
kono
parents: 67
diff changeset
1591 }
kono
parents: 67
diff changeset
1592
kono
parents: 67
diff changeset
1593 /* Print this as a function? */
kono
parents: 67
diff changeset
1594 if (fun)
kono
parents: 67
diff changeset
1595 {
kono
parents: 67
diff changeset
1596 pp_string (pp, fun);
kono
parents: 67
diff changeset
1597 pp_left_paren (pp);
kono
parents: 67
diff changeset
1598 }
kono
parents: 67
diff changeset
1599
kono
parents: 67
diff changeset
1600 for (i = 0; i < 4; i++)
kono
parents: 67
diff changeset
1601 {
kono
parents: 67
diff changeset
1602 if (st[i])
kono
parents: 67
diff changeset
1603 pp_string (pp, st[i]);
kono
parents: 67
diff changeset
1604
kono
parents: 67
diff changeset
1605 if (op[i])
kono
parents: 67
diff changeset
1606 {
kono
parents: 67
diff changeset
1607 if (fun && i != 0)
kono
parents: 67
diff changeset
1608 pp_comma (pp);
kono
parents: 67
diff changeset
1609 print_value (pp, op[i], verbose);
kono
parents: 67
diff changeset
1610 }
kono
parents: 67
diff changeset
1611 }
kono
parents: 67
diff changeset
1612
kono
parents: 67
diff changeset
1613 if (fun)
kono
parents: 67
diff changeset
1614 pp_right_paren (pp);
kono
parents: 67
diff changeset
1615 } /* print_exp */
kono
parents: 67
diff changeset
1616
kono
parents: 67
diff changeset
1617 /* Prints rtxes, I customarily classified as values. They're constants,
kono
parents: 67
diff changeset
1618 registers, labels, symbols and memory accesses. */
kono
parents: 67
diff changeset
1619
kono
parents: 67
diff changeset
1620 void
kono
parents: 67
diff changeset
1621 print_value (pretty_printer *pp, const_rtx x, int verbose)
kono
parents: 67
diff changeset
1622 {
kono
parents: 67
diff changeset
1623 char tmp[1024];
kono
parents: 67
diff changeset
1624
kono
parents: 67
diff changeset
1625 if (!x)
kono
parents: 67
diff changeset
1626 {
kono
parents: 67
diff changeset
1627 pp_string (pp, "(nil)");
kono
parents: 67
diff changeset
1628 return;
kono
parents: 67
diff changeset
1629 }
kono
parents: 67
diff changeset
1630 switch (GET_CODE (x))
kono
parents: 67
diff changeset
1631 {
kono
parents: 67
diff changeset
1632 case CONST_INT:
kono
parents: 67
diff changeset
1633 pp_scalar (pp, HOST_WIDE_INT_PRINT_HEX,
kono
parents: 67
diff changeset
1634 (unsigned HOST_WIDE_INT) INTVAL (x));
kono
parents: 67
diff changeset
1635 break;
kono
parents: 67
diff changeset
1636
kono
parents: 67
diff changeset
1637 case CONST_WIDE_INT:
kono
parents: 67
diff changeset
1638 {
kono
parents: 67
diff changeset
1639 const char *sep = "<";
kono
parents: 67
diff changeset
1640 int i;
kono
parents: 67
diff changeset
1641 for (i = CONST_WIDE_INT_NUNITS (x) - 1; i >= 0; i--)
kono
parents: 67
diff changeset
1642 {
kono
parents: 67
diff changeset
1643 pp_string (pp, sep);
kono
parents: 67
diff changeset
1644 sep = ",";
kono
parents: 67
diff changeset
1645 sprintf (tmp, HOST_WIDE_INT_PRINT_HEX,
kono
parents: 67
diff changeset
1646 (unsigned HOST_WIDE_INT) CONST_WIDE_INT_ELT (x, i));
kono
parents: 67
diff changeset
1647 pp_string (pp, tmp);
kono
parents: 67
diff changeset
1648 }
kono
parents: 67
diff changeset
1649 pp_greater (pp);
kono
parents: 67
diff changeset
1650 }
kono
parents: 67
diff changeset
1651 break;
kono
parents: 67
diff changeset
1652
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1653 case CONST_POLY_INT:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1654 pp_left_bracket (pp);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1655 pp_wide_int (pp, CONST_POLY_INT_COEFFS (x)[0], SIGNED);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1656 for (unsigned int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1657 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1658 pp_string (pp, ", ");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1659 pp_wide_int (pp, CONST_POLY_INT_COEFFS (x)[i], SIGNED);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1660 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1661 pp_right_bracket (pp);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1662 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1663
111
kono
parents: 67
diff changeset
1664 case CONST_DOUBLE:
kono
parents: 67
diff changeset
1665 if (FLOAT_MODE_P (GET_MODE (x)))
kono
parents: 67
diff changeset
1666 {
kono
parents: 67
diff changeset
1667 real_to_decimal (tmp, CONST_DOUBLE_REAL_VALUE (x),
kono
parents: 67
diff changeset
1668 sizeof (tmp), 0, 1);
kono
parents: 67
diff changeset
1669 pp_string (pp, tmp);
kono
parents: 67
diff changeset
1670 }
kono
parents: 67
diff changeset
1671 else
kono
parents: 67
diff changeset
1672 pp_printf (pp, "<%wx,%wx>",
kono
parents: 67
diff changeset
1673 (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x),
kono
parents: 67
diff changeset
1674 (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x));
kono
parents: 67
diff changeset
1675 break;
kono
parents: 67
diff changeset
1676 case CONST_FIXED:
kono
parents: 67
diff changeset
1677 fixed_to_decimal (tmp, CONST_FIXED_VALUE (x), sizeof (tmp));
kono
parents: 67
diff changeset
1678 pp_string (pp, tmp);
kono
parents: 67
diff changeset
1679 break;
kono
parents: 67
diff changeset
1680 case CONST_STRING:
kono
parents: 67
diff changeset
1681 pp_printf (pp, "\"%s\"", XSTR (x, 0));
kono
parents: 67
diff changeset
1682 break;
kono
parents: 67
diff changeset
1683 case SYMBOL_REF:
kono
parents: 67
diff changeset
1684 pp_printf (pp, "`%s'", XSTR (x, 0));
kono
parents: 67
diff changeset
1685 break;
kono
parents: 67
diff changeset
1686 case LABEL_REF:
kono
parents: 67
diff changeset
1687 pp_printf (pp, "L%d", INSN_UID (label_ref_label (x)));
kono
parents: 67
diff changeset
1688 break;
kono
parents: 67
diff changeset
1689 case CONST:
kono
parents: 67
diff changeset
1690 case HIGH:
kono
parents: 67
diff changeset
1691 case STRICT_LOW_PART:
kono
parents: 67
diff changeset
1692 pp_printf (pp, "%s(", GET_RTX_NAME (GET_CODE (x)));
kono
parents: 67
diff changeset
1693 print_value (pp, XEXP (x, 0), verbose);
kono
parents: 67
diff changeset
1694 pp_right_paren (pp);
kono
parents: 67
diff changeset
1695 break;
kono
parents: 67
diff changeset
1696 case REG:
kono
parents: 67
diff changeset
1697 if (REGNO (x) < FIRST_PSEUDO_REGISTER)
kono
parents: 67
diff changeset
1698 {
kono
parents: 67
diff changeset
1699 if (ISDIGIT (reg_names[REGNO (x)][0]))
kono
parents: 67
diff changeset
1700 pp_modulo (pp);
kono
parents: 67
diff changeset
1701 pp_string (pp, reg_names[REGNO (x)]);
kono
parents: 67
diff changeset
1702 }
kono
parents: 67
diff changeset
1703 else
kono
parents: 67
diff changeset
1704 pp_printf (pp, "r%d", REGNO (x));
kono
parents: 67
diff changeset
1705 if (verbose)
kono
parents: 67
diff changeset
1706 pp_printf (pp, ":%s", GET_MODE_NAME (GET_MODE (x)));
kono
parents: 67
diff changeset
1707 break;
kono
parents: 67
diff changeset
1708 case SUBREG:
kono
parents: 67
diff changeset
1709 print_value (pp, SUBREG_REG (x), verbose);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1710 pp_printf (pp, "#");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1711 pp_wide_integer (pp, SUBREG_BYTE (x));
111
kono
parents: 67
diff changeset
1712 break;
kono
parents: 67
diff changeset
1713 case SCRATCH:
kono
parents: 67
diff changeset
1714 case CC0:
kono
parents: 67
diff changeset
1715 case PC:
kono
parents: 67
diff changeset
1716 pp_string (pp, GET_RTX_NAME (GET_CODE (x)));
kono
parents: 67
diff changeset
1717 break;
kono
parents: 67
diff changeset
1718 case MEM:
kono
parents: 67
diff changeset
1719 pp_left_bracket (pp);
kono
parents: 67
diff changeset
1720 print_value (pp, XEXP (x, 0), verbose);
kono
parents: 67
diff changeset
1721 pp_right_bracket (pp);
kono
parents: 67
diff changeset
1722 break;
kono
parents: 67
diff changeset
1723 case DEBUG_EXPR:
kono
parents: 67
diff changeset
1724 pp_printf (pp, "D#%i", DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x)));
kono
parents: 67
diff changeset
1725 break;
kono
parents: 67
diff changeset
1726 default:
kono
parents: 67
diff changeset
1727 print_exp (pp, x, verbose);
kono
parents: 67
diff changeset
1728 break;
kono
parents: 67
diff changeset
1729 }
kono
parents: 67
diff changeset
1730 } /* print_value */
kono
parents: 67
diff changeset
1731
kono
parents: 67
diff changeset
1732 /* The next step in insn detalization, its pattern recognition. */
kono
parents: 67
diff changeset
1733
kono
parents: 67
diff changeset
1734 void
kono
parents: 67
diff changeset
1735 print_pattern (pretty_printer *pp, const_rtx x, int verbose)
kono
parents: 67
diff changeset
1736 {
kono
parents: 67
diff changeset
1737 if (! x)
kono
parents: 67
diff changeset
1738 {
kono
parents: 67
diff changeset
1739 pp_string (pp, "(nil)");
kono
parents: 67
diff changeset
1740 return;
kono
parents: 67
diff changeset
1741 }
kono
parents: 67
diff changeset
1742
kono
parents: 67
diff changeset
1743 switch (GET_CODE (x))
kono
parents: 67
diff changeset
1744 {
kono
parents: 67
diff changeset
1745 case SET:
kono
parents: 67
diff changeset
1746 print_value (pp, SET_DEST (x), verbose);
kono
parents: 67
diff changeset
1747 pp_equal (pp);
kono
parents: 67
diff changeset
1748 print_value (pp, SET_SRC (x), verbose);
kono
parents: 67
diff changeset
1749 break;
kono
parents: 67
diff changeset
1750 case RETURN:
kono
parents: 67
diff changeset
1751 case SIMPLE_RETURN:
kono
parents: 67
diff changeset
1752 case EH_RETURN:
kono
parents: 67
diff changeset
1753 pp_string (pp, GET_RTX_NAME (GET_CODE (x)));
kono
parents: 67
diff changeset
1754 break;
kono
parents: 67
diff changeset
1755 case CALL:
kono
parents: 67
diff changeset
1756 print_exp (pp, x, verbose);
kono
parents: 67
diff changeset
1757 break;
kono
parents: 67
diff changeset
1758 case CLOBBER:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1759 case CLOBBER_HIGH:
111
kono
parents: 67
diff changeset
1760 case USE:
kono
parents: 67
diff changeset
1761 pp_printf (pp, "%s ", GET_RTX_NAME (GET_CODE (x)));
kono
parents: 67
diff changeset
1762 print_value (pp, XEXP (x, 0), verbose);
kono
parents: 67
diff changeset
1763 break;
kono
parents: 67
diff changeset
1764 case VAR_LOCATION:
kono
parents: 67
diff changeset
1765 pp_string (pp, "loc ");
kono
parents: 67
diff changeset
1766 print_value (pp, PAT_VAR_LOCATION_LOC (x), verbose);
kono
parents: 67
diff changeset
1767 break;
kono
parents: 67
diff changeset
1768 case COND_EXEC:
kono
parents: 67
diff changeset
1769 pp_left_paren (pp);
kono
parents: 67
diff changeset
1770 if (GET_CODE (COND_EXEC_TEST (x)) == NE
kono
parents: 67
diff changeset
1771 && XEXP (COND_EXEC_TEST (x), 1) == const0_rtx)
kono
parents: 67
diff changeset
1772 print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose);
kono
parents: 67
diff changeset
1773 else if (GET_CODE (COND_EXEC_TEST (x)) == EQ
kono
parents: 67
diff changeset
1774 && XEXP (COND_EXEC_TEST (x), 1) == const0_rtx)
kono
parents: 67
diff changeset
1775 {
kono
parents: 67
diff changeset
1776 pp_exclamation (pp);
kono
parents: 67
diff changeset
1777 print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose);
kono
parents: 67
diff changeset
1778 }
kono
parents: 67
diff changeset
1779 else
kono
parents: 67
diff changeset
1780 print_value (pp, COND_EXEC_TEST (x), verbose);
kono
parents: 67
diff changeset
1781 pp_string (pp, ") ");
kono
parents: 67
diff changeset
1782 print_pattern (pp, COND_EXEC_CODE (x), verbose);
kono
parents: 67
diff changeset
1783 break;
kono
parents: 67
diff changeset
1784 case PARALLEL:
kono
parents: 67
diff changeset
1785 {
kono
parents: 67
diff changeset
1786 int i;
kono
parents: 67
diff changeset
1787
kono
parents: 67
diff changeset
1788 pp_left_brace (pp);
kono
parents: 67
diff changeset
1789 for (i = 0; i < XVECLEN (x, 0); i++)
kono
parents: 67
diff changeset
1790 {
kono
parents: 67
diff changeset
1791 print_pattern (pp, XVECEXP (x, 0, i), verbose);
kono
parents: 67
diff changeset
1792 pp_semicolon (pp);
kono
parents: 67
diff changeset
1793 }
kono
parents: 67
diff changeset
1794 pp_right_brace (pp);
kono
parents: 67
diff changeset
1795 }
kono
parents: 67
diff changeset
1796 break;
kono
parents: 67
diff changeset
1797 case SEQUENCE:
kono
parents: 67
diff changeset
1798 {
kono
parents: 67
diff changeset
1799 const rtx_sequence *seq = as_a <const rtx_sequence *> (x);
kono
parents: 67
diff changeset
1800 pp_string (pp, "sequence{");
kono
parents: 67
diff changeset
1801 if (INSN_P (seq->element (0)))
kono
parents: 67
diff changeset
1802 {
kono
parents: 67
diff changeset
1803 /* Print the sequence insns indented. */
kono
parents: 67
diff changeset
1804 const char * save_print_rtx_head = print_rtx_head;
kono
parents: 67
diff changeset
1805 char indented_print_rtx_head[32];
kono
parents: 67
diff changeset
1806
kono
parents: 67
diff changeset
1807 pp_newline (pp);
kono
parents: 67
diff changeset
1808 gcc_assert (strlen (print_rtx_head) < sizeof (indented_print_rtx_head) - 4);
kono
parents: 67
diff changeset
1809 snprintf (indented_print_rtx_head,
kono
parents: 67
diff changeset
1810 sizeof (indented_print_rtx_head),
kono
parents: 67
diff changeset
1811 "%s ", print_rtx_head);
kono
parents: 67
diff changeset
1812 print_rtx_head = indented_print_rtx_head;
kono
parents: 67
diff changeset
1813 for (int i = 0; i < seq->len (); i++)
kono
parents: 67
diff changeset
1814 print_insn_with_notes (pp, seq->insn (i));
kono
parents: 67
diff changeset
1815 pp_printf (pp, "%s ", save_print_rtx_head);
kono
parents: 67
diff changeset
1816 print_rtx_head = save_print_rtx_head;
kono
parents: 67
diff changeset
1817 }
kono
parents: 67
diff changeset
1818 else
kono
parents: 67
diff changeset
1819 {
kono
parents: 67
diff changeset
1820 for (int i = 0; i < seq->len (); i++)
kono
parents: 67
diff changeset
1821 {
kono
parents: 67
diff changeset
1822 print_pattern (pp, seq->element (i), verbose);
kono
parents: 67
diff changeset
1823 pp_semicolon (pp);
kono
parents: 67
diff changeset
1824 }
kono
parents: 67
diff changeset
1825 }
kono
parents: 67
diff changeset
1826 pp_right_brace (pp);
kono
parents: 67
diff changeset
1827 }
kono
parents: 67
diff changeset
1828 break;
kono
parents: 67
diff changeset
1829 case ASM_INPUT:
kono
parents: 67
diff changeset
1830 pp_printf (pp, "asm {%s}", XSTR (x, 0));
kono
parents: 67
diff changeset
1831 break;
kono
parents: 67
diff changeset
1832 case ADDR_VEC:
kono
parents: 67
diff changeset
1833 for (int i = 0; i < XVECLEN (x, 0); i++)
kono
parents: 67
diff changeset
1834 {
kono
parents: 67
diff changeset
1835 print_value (pp, XVECEXP (x, 0, i), verbose);
kono
parents: 67
diff changeset
1836 pp_semicolon (pp);
kono
parents: 67
diff changeset
1837 }
kono
parents: 67
diff changeset
1838 break;
kono
parents: 67
diff changeset
1839 case ADDR_DIFF_VEC:
kono
parents: 67
diff changeset
1840 for (int i = 0; i < XVECLEN (x, 1); i++)
kono
parents: 67
diff changeset
1841 {
kono
parents: 67
diff changeset
1842 print_value (pp, XVECEXP (x, 1, i), verbose);
kono
parents: 67
diff changeset
1843 pp_semicolon (pp);
kono
parents: 67
diff changeset
1844 }
kono
parents: 67
diff changeset
1845 break;
kono
parents: 67
diff changeset
1846 case TRAP_IF:
kono
parents: 67
diff changeset
1847 pp_string (pp, "trap_if ");
kono
parents: 67
diff changeset
1848 print_value (pp, TRAP_CONDITION (x), verbose);
kono
parents: 67
diff changeset
1849 break;
kono
parents: 67
diff changeset
1850 case UNSPEC:
kono
parents: 67
diff changeset
1851 case UNSPEC_VOLATILE:
kono
parents: 67
diff changeset
1852 /* Fallthru -- leave UNSPECs to print_exp. */
kono
parents: 67
diff changeset
1853 default:
kono
parents: 67
diff changeset
1854 print_value (pp, x, verbose);
kono
parents: 67
diff changeset
1855 }
kono
parents: 67
diff changeset
1856 } /* print_pattern */
kono
parents: 67
diff changeset
1857
kono
parents: 67
diff changeset
1858 /* This is the main function in slim rtl visualization mechanism.
kono
parents: 67
diff changeset
1859
kono
parents: 67
diff changeset
1860 X is an insn, to be printed into PP.
kono
parents: 67
diff changeset
1861
kono
parents: 67
diff changeset
1862 This function tries to print it properly in human-readable form,
kono
parents: 67
diff changeset
1863 resembling assembler mnemonics (instead of the older Lisp-style
kono
parents: 67
diff changeset
1864 form).
kono
parents: 67
diff changeset
1865
kono
parents: 67
diff changeset
1866 If VERBOSE is TRUE, insns are printed with more complete (but
kono
parents: 67
diff changeset
1867 longer) pattern names and with extra information, and prefixed
kono
parents: 67
diff changeset
1868 with their INSN_UIDs. */
kono
parents: 67
diff changeset
1869
kono
parents: 67
diff changeset
1870 void
kono
parents: 67
diff changeset
1871 print_insn (pretty_printer *pp, const rtx_insn *x, int verbose)
kono
parents: 67
diff changeset
1872 {
kono
parents: 67
diff changeset
1873 if (verbose)
kono
parents: 67
diff changeset
1874 {
kono
parents: 67
diff changeset
1875 /* Blech, pretty-print can't print integers with a specified width. */
kono
parents: 67
diff changeset
1876 char uid_prefix[32];
kono
parents: 67
diff changeset
1877 snprintf (uid_prefix, sizeof uid_prefix, " %4d: ", INSN_UID (x));
kono
parents: 67
diff changeset
1878 pp_string (pp, uid_prefix);
kono
parents: 67
diff changeset
1879 }
kono
parents: 67
diff changeset
1880
kono
parents: 67
diff changeset
1881 switch (GET_CODE (x))
kono
parents: 67
diff changeset
1882 {
kono
parents: 67
diff changeset
1883 case INSN:
kono
parents: 67
diff changeset
1884 print_pattern (pp, PATTERN (x), verbose);
kono
parents: 67
diff changeset
1885 break;
kono
parents: 67
diff changeset
1886
kono
parents: 67
diff changeset
1887 case DEBUG_INSN:
kono
parents: 67
diff changeset
1888 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1889 if (DEBUG_MARKER_INSN_P (x))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1890 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1891 switch (INSN_DEBUG_MARKER_KIND (x))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1892 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1893 case NOTE_INSN_BEGIN_STMT:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1894 pp_string (pp, "debug begin stmt marker");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1895 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1896
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1897 case NOTE_INSN_INLINE_ENTRY:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1898 pp_string (pp, "debug inline entry marker");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1899 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1900
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1901 default:
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1902 gcc_unreachable ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1903 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1904 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1905 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1906
111
kono
parents: 67
diff changeset
1907 const char *name = "?";
kono
parents: 67
diff changeset
1908 char idbuf[32];
kono
parents: 67
diff changeset
1909
kono
parents: 67
diff changeset
1910 if (DECL_P (INSN_VAR_LOCATION_DECL (x)))
kono
parents: 67
diff changeset
1911 {
kono
parents: 67
diff changeset
1912 tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x));
kono
parents: 67
diff changeset
1913 if (id)
kono
parents: 67
diff changeset
1914 name = IDENTIFIER_POINTER (id);
kono
parents: 67
diff changeset
1915 else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x))
kono
parents: 67
diff changeset
1916 == DEBUG_EXPR_DECL)
kono
parents: 67
diff changeset
1917 {
kono
parents: 67
diff changeset
1918 sprintf (idbuf, "D#%i",
kono
parents: 67
diff changeset
1919 DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (x)));
kono
parents: 67
diff changeset
1920 name = idbuf;
kono
parents: 67
diff changeset
1921 }
kono
parents: 67
diff changeset
1922 else
kono
parents: 67
diff changeset
1923 {
kono
parents: 67
diff changeset
1924 sprintf (idbuf, "D.%i",
kono
parents: 67
diff changeset
1925 DECL_UID (INSN_VAR_LOCATION_DECL (x)));
kono
parents: 67
diff changeset
1926 name = idbuf;
kono
parents: 67
diff changeset
1927 }
kono
parents: 67
diff changeset
1928 }
kono
parents: 67
diff changeset
1929 pp_printf (pp, "debug %s => ", name);
kono
parents: 67
diff changeset
1930 if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (x)))
kono
parents: 67
diff changeset
1931 pp_string (pp, "optimized away");
kono
parents: 67
diff changeset
1932 else
kono
parents: 67
diff changeset
1933 print_pattern (pp, INSN_VAR_LOCATION_LOC (x), verbose);
kono
parents: 67
diff changeset
1934 }
kono
parents: 67
diff changeset
1935 break;
kono
parents: 67
diff changeset
1936
kono
parents: 67
diff changeset
1937 case JUMP_INSN:
kono
parents: 67
diff changeset
1938 print_pattern (pp, PATTERN (x), verbose);
kono
parents: 67
diff changeset
1939 break;
kono
parents: 67
diff changeset
1940 case CALL_INSN:
kono
parents: 67
diff changeset
1941 if (GET_CODE (PATTERN (x)) == PARALLEL)
kono
parents: 67
diff changeset
1942 print_pattern (pp, XVECEXP (PATTERN (x), 0, 0), verbose);
kono
parents: 67
diff changeset
1943 else
kono
parents: 67
diff changeset
1944 print_pattern (pp, PATTERN (x), verbose);
kono
parents: 67
diff changeset
1945 break;
kono
parents: 67
diff changeset
1946 case CODE_LABEL:
kono
parents: 67
diff changeset
1947 pp_printf (pp, "L%d:", INSN_UID (x));
kono
parents: 67
diff changeset
1948 break;
kono
parents: 67
diff changeset
1949 case JUMP_TABLE_DATA:
kono
parents: 67
diff changeset
1950 pp_string (pp, "jump_table_data{\n");
kono
parents: 67
diff changeset
1951 print_pattern (pp, PATTERN (x), verbose);
kono
parents: 67
diff changeset
1952 pp_right_brace (pp);
kono
parents: 67
diff changeset
1953 break;
kono
parents: 67
diff changeset
1954 case BARRIER:
kono
parents: 67
diff changeset
1955 pp_string (pp, "barrier");
kono
parents: 67
diff changeset
1956 break;
kono
parents: 67
diff changeset
1957 case NOTE:
kono
parents: 67
diff changeset
1958 {
kono
parents: 67
diff changeset
1959 pp_string (pp, GET_NOTE_INSN_NAME (NOTE_KIND (x)));
kono
parents: 67
diff changeset
1960 switch (NOTE_KIND (x))
kono
parents: 67
diff changeset
1961 {
kono
parents: 67
diff changeset
1962 case NOTE_INSN_EH_REGION_BEG:
kono
parents: 67
diff changeset
1963 case NOTE_INSN_EH_REGION_END:
kono
parents: 67
diff changeset
1964 pp_printf (pp, " %d", NOTE_EH_HANDLER (x));
kono
parents: 67
diff changeset
1965 break;
kono
parents: 67
diff changeset
1966
kono
parents: 67
diff changeset
1967 case NOTE_INSN_BLOCK_BEG:
kono
parents: 67
diff changeset
1968 case NOTE_INSN_BLOCK_END:
kono
parents: 67
diff changeset
1969 pp_printf (pp, " %d", BLOCK_NUMBER (NOTE_BLOCK (x)));
kono
parents: 67
diff changeset
1970 break;
kono
parents: 67
diff changeset
1971
kono
parents: 67
diff changeset
1972 case NOTE_INSN_BASIC_BLOCK:
kono
parents: 67
diff changeset
1973 pp_printf (pp, " %d", NOTE_BASIC_BLOCK (x)->index);
kono
parents: 67
diff changeset
1974 break;
kono
parents: 67
diff changeset
1975
kono
parents: 67
diff changeset
1976 case NOTE_INSN_DELETED_LABEL:
kono
parents: 67
diff changeset
1977 case NOTE_INSN_DELETED_DEBUG_LABEL:
kono
parents: 67
diff changeset
1978 {
kono
parents: 67
diff changeset
1979 const char *label = NOTE_DELETED_LABEL_NAME (x);
kono
parents: 67
diff changeset
1980 if (label == NULL)
kono
parents: 67
diff changeset
1981 label = "";
kono
parents: 67
diff changeset
1982 pp_printf (pp, " (\"%s\")", label);
kono
parents: 67
diff changeset
1983 }
kono
parents: 67
diff changeset
1984 break;
kono
parents: 67
diff changeset
1985
kono
parents: 67
diff changeset
1986 case NOTE_INSN_VAR_LOCATION:
kono
parents: 67
diff changeset
1987 pp_left_brace (pp);
kono
parents: 67
diff changeset
1988 print_pattern (pp, NOTE_VAR_LOCATION (x), verbose);
kono
parents: 67
diff changeset
1989 pp_right_brace (pp);
kono
parents: 67
diff changeset
1990 break;
kono
parents: 67
diff changeset
1991
kono
parents: 67
diff changeset
1992 default:
kono
parents: 67
diff changeset
1993 break;
kono
parents: 67
diff changeset
1994 }
kono
parents: 67
diff changeset
1995 break;
kono
parents: 67
diff changeset
1996 }
kono
parents: 67
diff changeset
1997 default:
kono
parents: 67
diff changeset
1998 gcc_unreachable ();
kono
parents: 67
diff changeset
1999 }
kono
parents: 67
diff changeset
2000 } /* print_insn */
kono
parents: 67
diff changeset
2001
kono
parents: 67
diff changeset
2002 /* Pretty-print a slim dump of X (an insn) to PP, including any register
kono
parents: 67
diff changeset
2003 note attached to the instruction. */
kono
parents: 67
diff changeset
2004
kono
parents: 67
diff changeset
2005 static void
kono
parents: 67
diff changeset
2006 print_insn_with_notes (pretty_printer *pp, const rtx_insn *x)
kono
parents: 67
diff changeset
2007 {
kono
parents: 67
diff changeset
2008 pp_string (pp, print_rtx_head);
kono
parents: 67
diff changeset
2009 print_insn (pp, x, 1);
kono
parents: 67
diff changeset
2010 pp_newline (pp);
kono
parents: 67
diff changeset
2011 if (INSN_P (x) && REG_NOTES (x))
kono
parents: 67
diff changeset
2012 for (rtx note = REG_NOTES (x); note; note = XEXP (note, 1))
kono
parents: 67
diff changeset
2013 {
kono
parents: 67
diff changeset
2014 pp_printf (pp, "%s %s ", print_rtx_head,
kono
parents: 67
diff changeset
2015 GET_REG_NOTE_NAME (REG_NOTE_KIND (note)));
kono
parents: 67
diff changeset
2016 if (GET_CODE (note) == INT_LIST)
kono
parents: 67
diff changeset
2017 pp_printf (pp, "%d", XINT (note, 0));
kono
parents: 67
diff changeset
2018 else
kono
parents: 67
diff changeset
2019 print_pattern (pp, XEXP (note, 0), 1);
kono
parents: 67
diff changeset
2020 pp_newline (pp);
kono
parents: 67
diff changeset
2021 }
kono
parents: 67
diff changeset
2022 }
kono
parents: 67
diff changeset
2023
kono
parents: 67
diff changeset
2024 /* Print X, an RTL value node, to file F in slim format. Include
kono
parents: 67
diff changeset
2025 additional information if VERBOSE is nonzero.
kono
parents: 67
diff changeset
2026
kono
parents: 67
diff changeset
2027 Value nodes are constants, registers, labels, symbols and
kono
parents: 67
diff changeset
2028 memory. */
kono
parents: 67
diff changeset
2029
kono
parents: 67
diff changeset
2030 void
kono
parents: 67
diff changeset
2031 dump_value_slim (FILE *f, const_rtx x, int verbose)
kono
parents: 67
diff changeset
2032 {
kono
parents: 67
diff changeset
2033 pretty_printer rtl_slim_pp;
kono
parents: 67
diff changeset
2034 rtl_slim_pp.buffer->stream = f;
kono
parents: 67
diff changeset
2035 print_value (&rtl_slim_pp, x, verbose);
kono
parents: 67
diff changeset
2036 pp_flush (&rtl_slim_pp);
kono
parents: 67
diff changeset
2037 }
kono
parents: 67
diff changeset
2038
kono
parents: 67
diff changeset
2039 /* Emit a slim dump of X (an insn) to the file F, including any register
kono
parents: 67
diff changeset
2040 note attached to the instruction. */
kono
parents: 67
diff changeset
2041 void
kono
parents: 67
diff changeset
2042 dump_insn_slim (FILE *f, const rtx_insn *x)
kono
parents: 67
diff changeset
2043 {
kono
parents: 67
diff changeset
2044 pretty_printer rtl_slim_pp;
kono
parents: 67
diff changeset
2045 rtl_slim_pp.buffer->stream = f;
kono
parents: 67
diff changeset
2046 print_insn_with_notes (&rtl_slim_pp, x);
kono
parents: 67
diff changeset
2047 pp_flush (&rtl_slim_pp);
kono
parents: 67
diff changeset
2048 }
kono
parents: 67
diff changeset
2049
kono
parents: 67
diff changeset
2050 /* Same as above, but stop at LAST or when COUNT == 0.
kono
parents: 67
diff changeset
2051 If COUNT < 0 it will stop only at LAST or NULL rtx. */
kono
parents: 67
diff changeset
2052
kono
parents: 67
diff changeset
2053 void
kono
parents: 67
diff changeset
2054 dump_rtl_slim (FILE *f, const rtx_insn *first, const rtx_insn *last,
kono
parents: 67
diff changeset
2055 int count, int flags ATTRIBUTE_UNUSED)
kono
parents: 67
diff changeset
2056 {
kono
parents: 67
diff changeset
2057 const rtx_insn *insn, *tail;
kono
parents: 67
diff changeset
2058 pretty_printer rtl_slim_pp;
kono
parents: 67
diff changeset
2059 rtl_slim_pp.buffer->stream = f;
kono
parents: 67
diff changeset
2060
kono
parents: 67
diff changeset
2061 tail = last ? NEXT_INSN (last) : NULL;
kono
parents: 67
diff changeset
2062 for (insn = first;
kono
parents: 67
diff changeset
2063 (insn != NULL) && (insn != tail) && (count != 0);
kono
parents: 67
diff changeset
2064 insn = NEXT_INSN (insn))
kono
parents: 67
diff changeset
2065 {
kono
parents: 67
diff changeset
2066 print_insn_with_notes (&rtl_slim_pp, insn);
kono
parents: 67
diff changeset
2067 if (count > 0)
kono
parents: 67
diff changeset
2068 count--;
kono
parents: 67
diff changeset
2069 }
kono
parents: 67
diff changeset
2070
kono
parents: 67
diff changeset
2071 pp_flush (&rtl_slim_pp);
kono
parents: 67
diff changeset
2072 }
kono
parents: 67
diff changeset
2073
kono
parents: 67
diff changeset
2074 /* Dumps basic block BB to pretty-printer PP in slim form and without and
kono
parents: 67
diff changeset
2075 no indentation, for use as a label of a DOT graph record-node. */
kono
parents: 67
diff changeset
2076
kono
parents: 67
diff changeset
2077 void
kono
parents: 67
diff changeset
2078 rtl_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
kono
parents: 67
diff changeset
2079 {
kono
parents: 67
diff changeset
2080 rtx_insn *insn;
kono
parents: 67
diff changeset
2081 bool first = true;
kono
parents: 67
diff changeset
2082
kono
parents: 67
diff changeset
2083 /* TODO: inter-bb stuff. */
kono
parents: 67
diff changeset
2084 FOR_BB_INSNS (bb, insn)
kono
parents: 67
diff changeset
2085 {
kono
parents: 67
diff changeset
2086 if (! first)
kono
parents: 67
diff changeset
2087 {
kono
parents: 67
diff changeset
2088 pp_bar (pp);
kono
parents: 67
diff changeset
2089 pp_write_text_to_stream (pp);
kono
parents: 67
diff changeset
2090 }
kono
parents: 67
diff changeset
2091 first = false;
kono
parents: 67
diff changeset
2092 print_insn_with_notes (pp, insn);
kono
parents: 67
diff changeset
2093 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
kono
parents: 67
diff changeset
2094 }
kono
parents: 67
diff changeset
2095 }
kono
parents: 67
diff changeset
2096
kono
parents: 67
diff changeset
2097 /* Pretty-print pattern X of some insn in non-verbose mode.
kono
parents: 67
diff changeset
2098 Return a string pointer to the pretty-printer buffer.
kono
parents: 67
diff changeset
2099
kono
parents: 67
diff changeset
2100 This function is only exported exists only to accommodate some older users
kono
parents: 67
diff changeset
2101 of the slim RTL pretty printers. Please do not use it for new code. */
kono
parents: 67
diff changeset
2102
kono
parents: 67
diff changeset
2103 const char *
kono
parents: 67
diff changeset
2104 str_pattern_slim (const_rtx x)
kono
parents: 67
diff changeset
2105 {
kono
parents: 67
diff changeset
2106 pretty_printer rtl_slim_pp;
kono
parents: 67
diff changeset
2107 print_pattern (&rtl_slim_pp, x, 0);
kono
parents: 67
diff changeset
2108 return ggc_strdup (pp_formatted_text (&rtl_slim_pp));
kono
parents: 67
diff changeset
2109 }
kono
parents: 67
diff changeset
2110
kono
parents: 67
diff changeset
2111 /* Emit a slim dump of X (an insn) to stderr. */
kono
parents: 67
diff changeset
2112 extern void debug_insn_slim (const rtx_insn *);
kono
parents: 67
diff changeset
2113 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
2114 debug_insn_slim (const rtx_insn *x)
kono
parents: 67
diff changeset
2115 {
kono
parents: 67
diff changeset
2116 dump_insn_slim (stderr, x);
kono
parents: 67
diff changeset
2117 }
kono
parents: 67
diff changeset
2118
kono
parents: 67
diff changeset
2119 /* Same as above, but using dump_rtl_slim. */
kono
parents: 67
diff changeset
2120 extern void debug_rtl_slim (FILE *, const rtx_insn *, const rtx_insn *,
kono
parents: 67
diff changeset
2121 int, int);
kono
parents: 67
diff changeset
2122 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
2123 debug_rtl_slim (const rtx_insn *first, const rtx_insn *last, int count,
kono
parents: 67
diff changeset
2124 int flags)
kono
parents: 67
diff changeset
2125 {
kono
parents: 67
diff changeset
2126 dump_rtl_slim (stderr, first, last, count, flags);
kono
parents: 67
diff changeset
2127 }
kono
parents: 67
diff changeset
2128
kono
parents: 67
diff changeset
2129 extern void debug_bb_slim (basic_block);
kono
parents: 67
diff changeset
2130 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
2131 debug_bb_slim (basic_block bb)
kono
parents: 67
diff changeset
2132 {
kono
parents: 67
diff changeset
2133 dump_bb (stderr, bb, 0, TDF_SLIM | TDF_BLOCKS);
kono
parents: 67
diff changeset
2134 }
kono
parents: 67
diff changeset
2135
kono
parents: 67
diff changeset
2136 extern void debug_bb_n_slim (int);
kono
parents: 67
diff changeset
2137 DEBUG_FUNCTION void
kono
parents: 67
diff changeset
2138 debug_bb_n_slim (int n)
kono
parents: 67
diff changeset
2139 {
kono
parents: 67
diff changeset
2140 basic_block bb = BASIC_BLOCK_FOR_FN (cfun, n);
kono
parents: 67
diff changeset
2141 debug_bb_slim (bb);
kono
parents: 67
diff changeset
2142 }
kono
parents: 67
diff changeset
2143
kono
parents: 67
diff changeset
2144 #endif