1 /* Tree-dumping functionality for intermediate representation.
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3 Written by Mark Mitchell <mark@codesourcery.com>
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
28 static void dump_access
29 PARAMS ((dump_info_p, tree));
31 /* Dump a representation of the accessibility information associated
39 if (TREE_PROTECTED(t))
40 dump_string (di, "protected");
41 else if (TREE_PRIVATE(t))
42 dump_string (di, "private");
44 dump_string (di, "public");
54 /* Figure out what kind of node this is. */
59 if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
60 dump_string (di, language_to_string (DECL_LANGUAGE (t), 0));
66 if (IDENTIFIER_OPNAME_P (t))
68 dump_string (di, "operator");
71 else if (IDENTIFIER_TYPENAME_P (t))
73 dump_child ("tynm", TREE_TYPE (t));
76 else if (t == anonymous_namespace_name)
78 dump_string (di, "unnamed");
84 if (TYPE_PTRMEM_P (t))
86 dump_string (di, "ptrmem");
87 dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
88 dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
95 if (TYPE_PTRMEMFUNC_P (t))
97 dump_string (di, "ptrmem");
98 dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
99 dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
103 dump_child ("vfld", TYPE_VFIELD (t));
108 for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
110 tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
111 dump_child ("base", BINFO_TYPE (base_binfo));
112 if (TREE_VIA_VIRTUAL (base_binfo))
113 dump_string (di, "virtual");
114 dump_access (di, base_binfo);
124 if (!DECL_THUNK_P (t))
126 if (DECL_FUNCTION_MEMBER_P (t))
128 dump_string (di, "member");
131 if (DECL_CONSTRUCTOR_P (t))
132 dump_string (di, "constructor");
133 if (DECL_DESTRUCTOR_P (t))
134 dump_string (di, "destructor");
135 if (DECL_OVERLOADED_OPERATOR_P (t))
136 dump_string (di, "operator");
137 if (DECL_CONV_FN_P (t))
138 dump_string (di, "conversion");
139 if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
141 if (DECL_GLOBAL_CTOR_P (t))
142 dump_string (di, "global init");
143 if (DECL_GLOBAL_DTOR_P (t))
144 dump_string (di, "global fini");
145 dump_int (di, "prio", GLOBAL_INIT_PRIORITY (t));
147 if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
148 dump_string (di, "pseudo tmpl");
152 dump_string (di, "thunk");
153 dump_int (di, "dlta", THUNK_DELTA (t));
154 dump_child ("vcll", THUNK_VCALL_OFFSET (t));
155 dump_child ("fn", DECL_INITIAL (t));
160 /* The fake `::std' namespace does not have DECL_LANG_SPECIFIC,
161 and therefore many other macros do not work on it. */
162 if (t == fake_std_node)
164 if (DECL_NAMESPACE_ALIAS (t))
165 dump_child ("alis", DECL_NAMESPACE_ALIAS (t));
167 dump_child ("dcls", cp_namespace_decls (t));
171 dump_child ("rslt", DECL_TEMPLATE_RESULT (t));
172 dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t));
173 dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t));
174 dump_child ("prms", DECL_TEMPLATE_PARMS (t));
178 dump_child ("crnt", OVL_CURRENT (t));
179 dump_child ("chan", OVL_CHAIN (t));
185 dump_string (di, "cleanup");
186 dump_child ("body", TRY_STMTS (t));
187 dump_child ("hdlr", TRY_HANDLERS (t));
188 dump_next_stmt (di, t);
192 dump_child ("clas", PTRMEM_CST_CLASS (t));
193 dump_child ("mbr", PTRMEM_CST_MEMBER (t));
197 /* These nodes are unary, but do not have code class `1'. */
198 dump_child ("op 0", TREE_OPERAND (t, 0));
202 dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
203 dump_child ("fn", TREE_OPERAND (t, 0));
204 dump_child ("args", TREE_OPERAND (t, 1));
205 dump_child ("decl", TREE_OPERAND (t, 2));
210 dump_child ("decl", CLEANUP_DECL (t));
211 dump_child ("expr", CLEANUP_EXPR (t));
212 dump_next_stmt (di, t);
217 if (CTOR_BEGIN_P (t))
218 dump_string (di, "begn");
220 dump_string (di, "end");
221 dump_next_stmt (di, t);
226 dump_child ("body", HANDLER_BODY (t));
227 dump_next_stmt (di, t);
232 dump_child ("clnp", TREE_OPERAND (t, 0));
233 dump_next_stmt (di, t);
236 case START_CATCH_STMT:
238 queue_and_dump_type (di, t);
239 dump_next_stmt (di, t);