1 /* Print RTL functions for GCC.
2 Copyright (C) 2016 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
22 #include "coretypes.h"
31 #include "basic-block.h"
32 #include "print-rtl.h"
33 #include "langhooks.h"
36 /* Write FN to OUTFILE in a form suitable for parsing, with indentation
37 and comments to make the structure easy for a human to grok.
43 (note 1 0 4 (nil) NOTE_INSN_DELETED)
44 (note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
45 (insn 2 4 3 2 (set (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars)
46 (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32])
47 (reg:SI 5 di [ i ])) t.c:2 -1
49 (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
50 (insn 6 3 7 2 (set (reg:SI 89)
51 (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars)
52 (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32])) t.c:3 -1
54 (insn 7 6 10 2 (parallel [
55 (set (reg:SI 87 [ _2 ])
56 (ashift:SI (reg:SI 89)
58 (clobber (reg:CC 17 flags))
60 (expr_list:REG_EQUAL (ashift:SI (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars)
61 (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32])
64 (insn 10 7 14 2 (set (reg:SI 88 [ <retval> ])
65 (reg:SI 87 [ _2 ])) t.c:3 -1
67 (insn 14 10 15 2 (set (reg/i:SI 0 ax)
68 (reg:SI 88 [ <retval> ])) t.c:4 -1
70 (insn 15 14 0 2 (use (reg/i:SI 0 ax)) t.c:4 -1
75 (edge 0 2 (flags 0x1))
78 (edge 2 1 (flags 0x1))
88 ) ;; function "times_two"
92 print_rtx_function (FILE *outfile
, function
*fn
)
94 tree fdecl
= fn
->decl
;
96 const char *dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
98 fprintf (outfile
, "(function \"%s\"\n", dname
);
100 /* The instruction chain. */
101 fprintf (outfile
, " (insn-chain\n");
102 for (rtx_insn
*insn
= get_insns (); insn
; insn
= NEXT_INSN (insn
))
103 print_rtl_single_with_indent (outfile
, insn
, 4);
104 fprintf (outfile
, " ) ;; insn-chain\n");
107 fprintf (outfile
, " (cfg\n");
110 FOR_ALL_BB_FN (bb
, fn
)
112 fprintf (outfile
, " (bb %i\n", bb
->index
);
115 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
116 fprintf (outfile
, " (edge %i %i (flags 0x%x))\n",
117 e
->src
->index
, e
->dest
->index
, e
->flags
);
118 fprintf (outfile
, " ) ;; bb\n");
121 fprintf (outfile
, " ) ;; cfg\n");
123 /* Additional RTL state. */
124 fprintf (outfile
, " (crtl\n");
125 fprintf (outfile
, " (return_rtx \n");
126 print_rtl_single_with_indent (outfile
, crtl
->return_rtx
, 6);
127 fprintf (outfile
, " ) ;; return_rtx\n");
128 fprintf (outfile
, " ) ;; crtl\n");
130 fprintf (outfile
, ") ;; function \"%s\"\n", dname
);