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));
105 if (!dump_flag (di, TDF_SLIM, t))
109 for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
111 tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
112 dump_child ("base", BINFO_TYPE (base_binfo));
113 if (TREE_VIA_VIRTUAL (base_binfo))
114 dump_string (di, "virtual");
115 dump_access (di, base_binfo);
125 if (!DECL_THUNK_P (t))
127 if (DECL_FUNCTION_MEMBER_P (t))
129 dump_string (di, "member");
132 if (DECL_CONSTRUCTOR_P (t))
133 dump_string (di, "constructor");
134 if (DECL_DESTRUCTOR_P (t))
135 dump_string (di, "destructor");
136 if (DECL_OVERLOADED_OPERATOR_P (t))
137 dump_string (di, "operator");
138 if (DECL_CONV_FN_P (t))
139 dump_string (di, "conversion");
140 if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
142 if (DECL_GLOBAL_CTOR_P (t))
143 dump_string (di, "global init");
144 if (DECL_GLOBAL_DTOR_P (t))
145 dump_string (di, "global fini");
146 dump_int (di, "prio", GLOBAL_INIT_PRIORITY (t));
148 if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
149 dump_string (di, "pseudo tmpl");
153 dump_string (di, "thunk");
154 dump_int (di, "dlta", THUNK_DELTA (t));
155 dump_child ("vcll", THUNK_VCALL_OFFSET (t));
156 dump_child ("fn", DECL_INITIAL (t));
161 if (DECL_NAMESPACE_ALIAS (t))
162 dump_child ("alis", DECL_NAMESPACE_ALIAS (t));
163 else if (!dump_flag (di, TDF_SLIM, t))
164 dump_child ("dcls", cp_namespace_decls (t));
168 dump_child ("rslt", DECL_TEMPLATE_RESULT (t));
169 dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t));
170 dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t));
171 dump_child ("prms", DECL_TEMPLATE_PARMS (t));
175 dump_child ("crnt", OVL_CURRENT (t));
176 dump_child ("chan", OVL_CHAIN (t));
182 dump_string (di, "cleanup");
183 dump_child ("body", TRY_STMTS (t));
184 dump_child ("hdlr", TRY_HANDLERS (t));
185 dump_next_stmt (di, t);
190 dump_child ("body", EH_SPEC_STMTS (t));
191 dump_child ("raises", EH_SPEC_RAISES (t));
192 dump_next_stmt (di, t);
196 dump_child ("clas", PTRMEM_CST_CLASS (t));
197 dump_child ("mbr", PTRMEM_CST_MEMBER (t));
201 /* These nodes are unary, but do not have code class `1'. */
202 dump_child ("op 0", TREE_OPERAND (t, 0));
206 dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
207 dump_child ("fn", TREE_OPERAND (t, 0));
208 dump_child ("args", TREE_OPERAND (t, 1));
209 dump_child ("decl", TREE_OPERAND (t, 2));
214 dump_child ("decl", CLEANUP_DECL (t));
215 dump_child ("expr", CLEANUP_EXPR (t));
216 dump_next_stmt (di, t);
221 if (CTOR_BEGIN_P (t))
222 dump_string (di, "begn");
224 dump_string (di, "end");
225 dump_next_stmt (di, t);
230 dump_child ("parm", HANDLER_PARMS (t));
231 dump_child ("body", HANDLER_BODY (t));
232 dump_next_stmt (di, t);
235 case MUST_NOT_THROW_EXPR:
237 dump_child ("body", TREE_OPERAND (t, 0));
238 dump_next_stmt (di, t);
243 dump_child ("clnp", TREE_OPERAND (t, 0));
244 dump_next_stmt (di, t);
249 dump_child ("nmsp", USING_STMT_NAMESPACE (t));
250 dump_next_stmt (di, t);