1*e4b17023SJohn Marino /* Tree-dumping functionality for C-family languages.
2*e4b17023SJohn Marino Copyright (C) 2002, 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
3*e4b17023SJohn Marino Written by Mark Mitchell <mark@codesourcery.com>
4*e4b17023SJohn Marino
5*e4b17023SJohn Marino This file is part of GCC.
6*e4b17023SJohn Marino
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3. If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */
20*e4b17023SJohn Marino
21*e4b17023SJohn Marino #include "config.h"
22*e4b17023SJohn Marino #include "system.h"
23*e4b17023SJohn Marino #include "coretypes.h"
24*e4b17023SJohn Marino #include "tm.h"
25*e4b17023SJohn Marino #include "tree.h"
26*e4b17023SJohn Marino #include "tree-dump.h"
27*e4b17023SJohn Marino #include "c-common.h"
28*e4b17023SJohn Marino
29*e4b17023SJohn Marino /* Dump information common to statements from STMT. */
30*e4b17023SJohn Marino
31*e4b17023SJohn Marino void
dump_stmt(dump_info_p di,const_tree t)32*e4b17023SJohn Marino dump_stmt (dump_info_p di, const_tree t)
33*e4b17023SJohn Marino {
34*e4b17023SJohn Marino if (EXPR_HAS_LOCATION (t))
35*e4b17023SJohn Marino dump_int (di, "line", EXPR_LINENO (t));
36*e4b17023SJohn Marino }
37*e4b17023SJohn Marino
38*e4b17023SJohn Marino /* Dump any C-specific tree codes and attributes of common codes. */
39*e4b17023SJohn Marino
40*e4b17023SJohn Marino bool
c_dump_tree(void * dump_info,tree t)41*e4b17023SJohn Marino c_dump_tree (void *dump_info, tree t)
42*e4b17023SJohn Marino {
43*e4b17023SJohn Marino enum tree_code code;
44*e4b17023SJohn Marino dump_info_p di = (dump_info_p) dump_info;
45*e4b17023SJohn Marino
46*e4b17023SJohn Marino /* Figure out what kind of node this is. */
47*e4b17023SJohn Marino code = TREE_CODE (t);
48*e4b17023SJohn Marino
49*e4b17023SJohn Marino switch (code)
50*e4b17023SJohn Marino {
51*e4b17023SJohn Marino case FIELD_DECL:
52*e4b17023SJohn Marino if (DECL_C_BIT_FIELD (t))
53*e4b17023SJohn Marino dump_string (di, "bitfield");
54*e4b17023SJohn Marino break;
55*e4b17023SJohn Marino
56*e4b17023SJohn Marino default:
57*e4b17023SJohn Marino break;
58*e4b17023SJohn Marino }
59*e4b17023SJohn Marino
60*e4b17023SJohn Marino return false;
61*e4b17023SJohn Marino }
62