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