xref: /dflybsd-src/contrib/gcc-4.7/gcc/tree-dump.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Tree-dumping functionality for intermediate representation.
2*e4b17023SJohn Marino    Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008, 2009, 2010
3*e4b17023SJohn Marino    Free Software Foundation, Inc.
4*e4b17023SJohn Marino    Written by Mark Mitchell <mark@codesourcery.com>
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino This file is part of GCC.
7*e4b17023SJohn Marino 
8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
11*e4b17023SJohn Marino version.
12*e4b17023SJohn Marino 
13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16*e4b17023SJohn Marino for more details.
17*e4b17023SJohn Marino 
18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21*e4b17023SJohn Marino 
22*e4b17023SJohn Marino #ifndef GCC_TREE_DUMP_H
23*e4b17023SJohn Marino #define GCC_TREE_DUMP_H
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #include "splay-tree.h"
26*e4b17023SJohn Marino #include "tree-pass.h"
27*e4b17023SJohn Marino 
28*e4b17023SJohn Marino typedef struct dump_info *dump_info_p;
29*e4b17023SJohn Marino 
30*e4b17023SJohn Marino /* Flags used with queue functions.  */
31*e4b17023SJohn Marino #define DUMP_NONE     0
32*e4b17023SJohn Marino #define DUMP_BINFO    1
33*e4b17023SJohn Marino 
34*e4b17023SJohn Marino /* Information about a node to be dumped.  */
35*e4b17023SJohn Marino 
36*e4b17023SJohn Marino typedef struct dump_node_info
37*e4b17023SJohn Marino {
38*e4b17023SJohn Marino   /* The index for the node.  */
39*e4b17023SJohn Marino   unsigned int index;
40*e4b17023SJohn Marino   /* Nonzero if the node is a binfo.  */
41*e4b17023SJohn Marino   unsigned int binfo_p : 1;
42*e4b17023SJohn Marino } *dump_node_info_p;
43*e4b17023SJohn Marino 
44*e4b17023SJohn Marino /* A dump_queue is a link in the queue of things to be dumped.  */
45*e4b17023SJohn Marino 
46*e4b17023SJohn Marino typedef struct dump_queue
47*e4b17023SJohn Marino {
48*e4b17023SJohn Marino   /* The queued tree node.  */
49*e4b17023SJohn Marino   splay_tree_node node;
50*e4b17023SJohn Marino   /* The next node in the queue.  */
51*e4b17023SJohn Marino   struct dump_queue *next;
52*e4b17023SJohn Marino } *dump_queue_p;
53*e4b17023SJohn Marino 
54*e4b17023SJohn Marino /* A dump_info gives information about how we should perform the dump
55*e4b17023SJohn Marino    and about the current state of the dump.  */
56*e4b17023SJohn Marino 
57*e4b17023SJohn Marino struct dump_info
58*e4b17023SJohn Marino {
59*e4b17023SJohn Marino   /* The stream on which to dump the information.  */
60*e4b17023SJohn Marino   FILE *stream;
61*e4b17023SJohn Marino   /* The original node.  */
62*e4b17023SJohn Marino   const_tree node;
63*e4b17023SJohn Marino   /* User flags.  */
64*e4b17023SJohn Marino   int flags;
65*e4b17023SJohn Marino   /* The next unused node index.  */
66*e4b17023SJohn Marino   unsigned int index;
67*e4b17023SJohn Marino   /* The next column.  */
68*e4b17023SJohn Marino   unsigned int column;
69*e4b17023SJohn Marino   /* The first node in the queue of nodes to be written out.  */
70*e4b17023SJohn Marino   dump_queue_p queue;
71*e4b17023SJohn Marino   /* The last node in the queue.  */
72*e4b17023SJohn Marino   dump_queue_p queue_end;
73*e4b17023SJohn Marino   /* Free queue nodes.  */
74*e4b17023SJohn Marino   dump_queue_p free_list;
75*e4b17023SJohn Marino   /* The tree nodes which we have already written out.  The
76*e4b17023SJohn Marino      keys are the addresses of the nodes; the values are the integer
77*e4b17023SJohn Marino      indices we assigned them.  */
78*e4b17023SJohn Marino   splay_tree nodes;
79*e4b17023SJohn Marino };
80*e4b17023SJohn Marino 
81*e4b17023SJohn Marino /* Dump the CHILD and its children.  */
82*e4b17023SJohn Marino #define dump_child(field, child) \
83*e4b17023SJohn Marino   queue_and_dump_index (di, field, child, DUMP_NONE)
84*e4b17023SJohn Marino 
85*e4b17023SJohn Marino extern void dump_pointer (dump_info_p, const char *, void *);
86*e4b17023SJohn Marino extern void dump_int (dump_info_p, const char *, int);
87*e4b17023SJohn Marino extern void dump_string (dump_info_p, const char *);
88*e4b17023SJohn Marino extern void dump_string_field (dump_info_p, const char *, const char *);
89*e4b17023SJohn Marino extern void dump_stmt (dump_info_p, const_tree);
90*e4b17023SJohn Marino extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int);
91*e4b17023SJohn Marino extern void queue_and_dump_type (dump_info_p, const_tree);
92*e4b17023SJohn Marino extern void dump_function (int, tree);
93*e4b17023SJohn Marino extern void dump_function_to_file (tree, FILE *, int);
94*e4b17023SJohn Marino extern void dump_enumerated_decls (FILE *, int);
95*e4b17023SJohn Marino extern void debug_function (tree, int);
96*e4b17023SJohn Marino extern int dump_flag (dump_info_p, int, const_tree);
97*e4b17023SJohn Marino 
98*e4b17023SJohn Marino extern unsigned int dump_register (const char *, const char *, const char *,
99*e4b17023SJohn Marino 				   int);
100*e4b17023SJohn Marino 
101*e4b17023SJohn Marino 
102*e4b17023SJohn Marino #endif /* ! GCC_TREE_DUMP_H */
103