annotate gcc/print-rtl.c @ 158:494b0b89df80 default tip

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