1*c3d31fe1Smrg /* Prints out tree in human readable form - GCC 2*c3d31fe1Smrg Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3*c3d31fe1Smrg 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4*c3d31fe1Smrg Free Software Foundation, Inc. 5*c3d31fe1Smrg 6*c3d31fe1Smrg This file is part of GCC. 7*c3d31fe1Smrg 8*c3d31fe1Smrg GCC is free software; you can redistribute it and/or modify it under 9*c3d31fe1Smrg the terms of the GNU General Public License as published by the Free 10*c3d31fe1Smrg Software Foundation; either version 3, or (at your option) any later 11*c3d31fe1Smrg version. 12*c3d31fe1Smrg 13*c3d31fe1Smrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY 14*c3d31fe1Smrg WARRANTY; without even the implied warranty of MERCHANTABILITY or 15*c3d31fe1Smrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16*c3d31fe1Smrg for more details. 17*c3d31fe1Smrg 18*c3d31fe1Smrg You should have received a copy of the GNU General Public License 19*c3d31fe1Smrg along with GCC; see the file COPYING3. If not see 20*c3d31fe1Smrg <http://www.gnu.org/licenses/>. */ 21*c3d31fe1Smrg 22*c3d31fe1Smrg 23*c3d31fe1Smrg #include "config.h" 24*c3d31fe1Smrg #include "system.h" 25*c3d31fe1Smrg #include "coretypes.h" 26*c3d31fe1Smrg #include "tm.h" 27*c3d31fe1Smrg #include "tree.h" 28*c3d31fe1Smrg #include "real.h" 29*c3d31fe1Smrg #include "fixed-value.h" 30*c3d31fe1Smrg #include "ggc.h" 31*c3d31fe1Smrg #include "langhooks.h" 32*c3d31fe1Smrg #include "tree-iterator.h" 33*c3d31fe1Smrg #include "diagnostic.h" 34*c3d31fe1Smrg #include "tree-flow.h" 35*c3d31fe1Smrg #include "tree-pass.h" 36*c3d31fe1Smrg 37*c3d31fe1Smrg /* Define the hash table of nodes already seen. 38*c3d31fe1Smrg Such nodes are not repeated; brief cross-references are used. */ 39*c3d31fe1Smrg 40*c3d31fe1Smrg #define HASH_SIZE 37 41*c3d31fe1Smrg 42*c3d31fe1Smrg struct bucket 43*c3d31fe1Smrg { 44*c3d31fe1Smrg tree node; 45*c3d31fe1Smrg struct bucket *next; 46*c3d31fe1Smrg }; 47*c3d31fe1Smrg 48*c3d31fe1Smrg static struct bucket **table; 49*c3d31fe1Smrg 50*c3d31fe1Smrg /* Print the node NODE on standard error, for debugging. 51*c3d31fe1Smrg Most nodes referred to by this one are printed recursively 52*c3d31fe1Smrg down to a depth of six. */ 53*c3d31fe1Smrg 54*c3d31fe1Smrg void 55*c3d31fe1Smrg debug_tree (tree node) 56*c3d31fe1Smrg { 57*c3d31fe1Smrg table = XCNEWVEC (struct bucket *, HASH_SIZE); 58*c3d31fe1Smrg print_node (stderr, "", node, 0); 59*c3d31fe1Smrg free (table); 60*c3d31fe1Smrg table = 0; 61*c3d31fe1Smrg putc ('\n', stderr); 62*c3d31fe1Smrg } 63*c3d31fe1Smrg 64*c3d31fe1Smrg /* Print PREFIX and ADDR to FILE. */ 65*c3d31fe1Smrg void 66*c3d31fe1Smrg dump_addr (FILE *file, const char *prefix, const void *addr) 67*c3d31fe1Smrg { 68*c3d31fe1Smrg if (flag_dump_noaddr || flag_dump_unnumbered) 69*c3d31fe1Smrg fprintf (file, "%s#", prefix); 70*c3d31fe1Smrg else 71*c3d31fe1Smrg fprintf (file, "%s" HOST_PTR_PRINTF, prefix, addr); 72*c3d31fe1Smrg } 73*c3d31fe1Smrg 74*c3d31fe1Smrg /* Print a node in brief fashion, with just the code, address and name. */ 75*c3d31fe1Smrg 76*c3d31fe1Smrg void 77*c3d31fe1Smrg print_node_brief (FILE *file, const char *prefix, const_tree node, int indent) 78*c3d31fe1Smrg { 79*c3d31fe1Smrg enum tree_code_class tclass; 80*c3d31fe1Smrg 81*c3d31fe1Smrg if (node == 0) 82*c3d31fe1Smrg return; 83*c3d31fe1Smrg 84*c3d31fe1Smrg tclass = TREE_CODE_CLASS (TREE_CODE (node)); 85*c3d31fe1Smrg 86*c3d31fe1Smrg /* Always print the slot this node is in, and its code, address and 87*c3d31fe1Smrg name if any. */ 88*c3d31fe1Smrg if (indent > 0) 89*c3d31fe1Smrg fprintf (file, " "); 90*c3d31fe1Smrg fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]); 91*c3d31fe1Smrg dump_addr (file, " ", node); 92*c3d31fe1Smrg 93*c3d31fe1Smrg if (tclass == tcc_declaration) 94*c3d31fe1Smrg { 95*c3d31fe1Smrg if (DECL_NAME (node)) 96*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node))); 97*c3d31fe1Smrg else if (TREE_CODE (node) == LABEL_DECL 98*c3d31fe1Smrg && LABEL_DECL_UID (node) != -1) 99*c3d31fe1Smrg { 100*c3d31fe1Smrg if (dump_flags & TDF_NOUID) 101*c3d31fe1Smrg fprintf (file, " L.xxxx"); 102*c3d31fe1Smrg else 103*c3d31fe1Smrg fprintf (file, " L.%d", (int) LABEL_DECL_UID (node)); 104*c3d31fe1Smrg } 105*c3d31fe1Smrg else 106*c3d31fe1Smrg { 107*c3d31fe1Smrg if (dump_flags & TDF_NOUID) 108*c3d31fe1Smrg fprintf (file, " %c.xxxx", 109*c3d31fe1Smrg TREE_CODE (node) == CONST_DECL ? 'C' : 'D'); 110*c3d31fe1Smrg else 111*c3d31fe1Smrg fprintf (file, " %c.%u", 112*c3d31fe1Smrg TREE_CODE (node) == CONST_DECL ? 'C' : 'D', 113*c3d31fe1Smrg DECL_UID (node)); 114*c3d31fe1Smrg } 115*c3d31fe1Smrg } 116*c3d31fe1Smrg else if (tclass == tcc_type) 117*c3d31fe1Smrg { 118*c3d31fe1Smrg if (TYPE_NAME (node)) 119*c3d31fe1Smrg { 120*c3d31fe1Smrg if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) 121*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); 122*c3d31fe1Smrg else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL 123*c3d31fe1Smrg && DECL_NAME (TYPE_NAME (node))) 124*c3d31fe1Smrg fprintf (file, " %s", 125*c3d31fe1Smrg IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); 126*c3d31fe1Smrg } 127*c3d31fe1Smrg if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node))) 128*c3d31fe1Smrg fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node)); 129*c3d31fe1Smrg } 130*c3d31fe1Smrg if (TREE_CODE (node) == IDENTIFIER_NODE) 131*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (node)); 132*c3d31fe1Smrg 133*c3d31fe1Smrg /* We might as well always print the value of an integer or real. */ 134*c3d31fe1Smrg if (TREE_CODE (node) == INTEGER_CST) 135*c3d31fe1Smrg { 136*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 137*c3d31fe1Smrg fprintf (file, " overflow"); 138*c3d31fe1Smrg 139*c3d31fe1Smrg fprintf (file, " "); 140*c3d31fe1Smrg if (TREE_INT_CST_HIGH (node) == 0) 141*c3d31fe1Smrg fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node)); 142*c3d31fe1Smrg else if (TREE_INT_CST_HIGH (node) == -1 143*c3d31fe1Smrg && TREE_INT_CST_LOW (node) != 0) 144*c3d31fe1Smrg fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED, 145*c3d31fe1Smrg -TREE_INT_CST_LOW (node)); 146*c3d31fe1Smrg else 147*c3d31fe1Smrg fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, 148*c3d31fe1Smrg (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (node), 149*c3d31fe1Smrg (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (node)); 150*c3d31fe1Smrg } 151*c3d31fe1Smrg if (TREE_CODE (node) == REAL_CST) 152*c3d31fe1Smrg { 153*c3d31fe1Smrg REAL_VALUE_TYPE d; 154*c3d31fe1Smrg 155*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 156*c3d31fe1Smrg fprintf (file, " overflow"); 157*c3d31fe1Smrg 158*c3d31fe1Smrg d = TREE_REAL_CST (node); 159*c3d31fe1Smrg if (REAL_VALUE_ISINF (d)) 160*c3d31fe1Smrg fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf"); 161*c3d31fe1Smrg else if (REAL_VALUE_ISNAN (d)) 162*c3d31fe1Smrg fprintf (file, " Nan"); 163*c3d31fe1Smrg else 164*c3d31fe1Smrg { 165*c3d31fe1Smrg char string[60]; 166*c3d31fe1Smrg real_to_decimal (string, &d, sizeof (string), 0, 1); 167*c3d31fe1Smrg fprintf (file, " %s", string); 168*c3d31fe1Smrg } 169*c3d31fe1Smrg } 170*c3d31fe1Smrg if (TREE_CODE (node) == FIXED_CST) 171*c3d31fe1Smrg { 172*c3d31fe1Smrg FIXED_VALUE_TYPE f; 173*c3d31fe1Smrg char string[60]; 174*c3d31fe1Smrg 175*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 176*c3d31fe1Smrg fprintf (file, " overflow"); 177*c3d31fe1Smrg 178*c3d31fe1Smrg f = TREE_FIXED_CST (node); 179*c3d31fe1Smrg fixed_to_decimal (string, &f, sizeof (string)); 180*c3d31fe1Smrg fprintf (file, " %s", string); 181*c3d31fe1Smrg } 182*c3d31fe1Smrg 183*c3d31fe1Smrg fprintf (file, ">"); 184*c3d31fe1Smrg } 185*c3d31fe1Smrg 186*c3d31fe1Smrg void 187*c3d31fe1Smrg indent_to (FILE *file, int column) 188*c3d31fe1Smrg { 189*c3d31fe1Smrg int i; 190*c3d31fe1Smrg 191*c3d31fe1Smrg /* Since this is the long way, indent to desired column. */ 192*c3d31fe1Smrg if (column > 0) 193*c3d31fe1Smrg fprintf (file, "\n"); 194*c3d31fe1Smrg for (i = 0; i < column; i++) 195*c3d31fe1Smrg fprintf (file, " "); 196*c3d31fe1Smrg } 197*c3d31fe1Smrg 198*c3d31fe1Smrg /* Print the node NODE in full on file FILE, preceded by PREFIX, 199*c3d31fe1Smrg starting in column INDENT. */ 200*c3d31fe1Smrg 201*c3d31fe1Smrg void 202*c3d31fe1Smrg print_node (FILE *file, const char *prefix, tree node, int indent) 203*c3d31fe1Smrg { 204*c3d31fe1Smrg int hash; 205*c3d31fe1Smrg struct bucket *b; 206*c3d31fe1Smrg enum machine_mode mode; 207*c3d31fe1Smrg enum tree_code_class tclass; 208*c3d31fe1Smrg int len; 209*c3d31fe1Smrg int i; 210*c3d31fe1Smrg expanded_location xloc; 211*c3d31fe1Smrg enum tree_code code; 212*c3d31fe1Smrg 213*c3d31fe1Smrg if (node == 0) 214*c3d31fe1Smrg return; 215*c3d31fe1Smrg 216*c3d31fe1Smrg code = TREE_CODE (node); 217*c3d31fe1Smrg tclass = TREE_CODE_CLASS (code); 218*c3d31fe1Smrg 219*c3d31fe1Smrg /* Don't get too deep in nesting. If the user wants to see deeper, 220*c3d31fe1Smrg it is easy to use the address of a lowest-level node 221*c3d31fe1Smrg as an argument in another call to debug_tree. */ 222*c3d31fe1Smrg 223*c3d31fe1Smrg if (indent > 24) 224*c3d31fe1Smrg { 225*c3d31fe1Smrg print_node_brief (file, prefix, node, indent); 226*c3d31fe1Smrg return; 227*c3d31fe1Smrg } 228*c3d31fe1Smrg 229*c3d31fe1Smrg if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration)) 230*c3d31fe1Smrg { 231*c3d31fe1Smrg print_node_brief (file, prefix, node, indent); 232*c3d31fe1Smrg return; 233*c3d31fe1Smrg } 234*c3d31fe1Smrg 235*c3d31fe1Smrg /* It is unsafe to look at any other fields of an ERROR_MARK node. */ 236*c3d31fe1Smrg if (code == ERROR_MARK) 237*c3d31fe1Smrg { 238*c3d31fe1Smrg print_node_brief (file, prefix, node, indent); 239*c3d31fe1Smrg return; 240*c3d31fe1Smrg } 241*c3d31fe1Smrg 242*c3d31fe1Smrg /* Allow this function to be called if the table is not there. */ 243*c3d31fe1Smrg if (table) 244*c3d31fe1Smrg { 245*c3d31fe1Smrg hash = ((unsigned long) node) % HASH_SIZE; 246*c3d31fe1Smrg 247*c3d31fe1Smrg /* If node is in the table, just mention its address. */ 248*c3d31fe1Smrg for (b = table[hash]; b; b = b->next) 249*c3d31fe1Smrg if (b->node == node) 250*c3d31fe1Smrg { 251*c3d31fe1Smrg print_node_brief (file, prefix, node, indent); 252*c3d31fe1Smrg return; 253*c3d31fe1Smrg } 254*c3d31fe1Smrg 255*c3d31fe1Smrg /* Add this node to the table. */ 256*c3d31fe1Smrg b = XNEW (struct bucket); 257*c3d31fe1Smrg b->node = node; 258*c3d31fe1Smrg b->next = table[hash]; 259*c3d31fe1Smrg table[hash] = b; 260*c3d31fe1Smrg } 261*c3d31fe1Smrg 262*c3d31fe1Smrg /* Indent to the specified column, since this is the long form. */ 263*c3d31fe1Smrg indent_to (file, indent); 264*c3d31fe1Smrg 265*c3d31fe1Smrg /* Print the slot this node is in, and its code, and address. */ 266*c3d31fe1Smrg fprintf (file, "%s <%s", prefix, tree_code_name[(int) code]); 267*c3d31fe1Smrg dump_addr (file, " ", node); 268*c3d31fe1Smrg 269*c3d31fe1Smrg /* Print the name, if any. */ 270*c3d31fe1Smrg if (tclass == tcc_declaration) 271*c3d31fe1Smrg { 272*c3d31fe1Smrg if (DECL_NAME (node)) 273*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node))); 274*c3d31fe1Smrg else if (code == LABEL_DECL 275*c3d31fe1Smrg && LABEL_DECL_UID (node) != -1) 276*c3d31fe1Smrg { 277*c3d31fe1Smrg if (dump_flags & TDF_NOUID) 278*c3d31fe1Smrg fprintf (file, " L.xxxx"); 279*c3d31fe1Smrg else 280*c3d31fe1Smrg fprintf (file, " L.%d", (int) LABEL_DECL_UID (node)); 281*c3d31fe1Smrg } 282*c3d31fe1Smrg else 283*c3d31fe1Smrg { 284*c3d31fe1Smrg if (dump_flags & TDF_NOUID) 285*c3d31fe1Smrg fprintf (file, " %c.xxxx", code == CONST_DECL ? 'C' : 'D'); 286*c3d31fe1Smrg else 287*c3d31fe1Smrg fprintf (file, " %c.%u", code == CONST_DECL ? 'C' : 'D', 288*c3d31fe1Smrg DECL_UID (node)); 289*c3d31fe1Smrg } 290*c3d31fe1Smrg } 291*c3d31fe1Smrg else if (tclass == tcc_type) 292*c3d31fe1Smrg { 293*c3d31fe1Smrg if (TYPE_NAME (node)) 294*c3d31fe1Smrg { 295*c3d31fe1Smrg if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) 296*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); 297*c3d31fe1Smrg else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL 298*c3d31fe1Smrg && DECL_NAME (TYPE_NAME (node))) 299*c3d31fe1Smrg fprintf (file, " %s", 300*c3d31fe1Smrg IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); 301*c3d31fe1Smrg } 302*c3d31fe1Smrg } 303*c3d31fe1Smrg if (code == IDENTIFIER_NODE) 304*c3d31fe1Smrg fprintf (file, " %s", IDENTIFIER_POINTER (node)); 305*c3d31fe1Smrg 306*c3d31fe1Smrg if (code == INTEGER_CST) 307*c3d31fe1Smrg { 308*c3d31fe1Smrg if (indent <= 4) 309*c3d31fe1Smrg print_node_brief (file, "type", TREE_TYPE (node), indent + 4); 310*c3d31fe1Smrg } 311*c3d31fe1Smrg else 312*c3d31fe1Smrg { 313*c3d31fe1Smrg print_node (file, "type", TREE_TYPE (node), indent + 4); 314*c3d31fe1Smrg if (TREE_TYPE (node)) 315*c3d31fe1Smrg indent_to (file, indent + 3); 316*c3d31fe1Smrg } 317*c3d31fe1Smrg 318*c3d31fe1Smrg if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node)) 319*c3d31fe1Smrg fputs (" side-effects", file); 320*c3d31fe1Smrg 321*c3d31fe1Smrg if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node)) 322*c3d31fe1Smrg fputs (" readonly", file); 323*c3d31fe1Smrg if (!TYPE_P (node) && TREE_CONSTANT (node)) 324*c3d31fe1Smrg fputs (" constant", file); 325*c3d31fe1Smrg else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node)) 326*c3d31fe1Smrg fputs (" sizes-gimplified", file); 327*c3d31fe1Smrg 328*c3d31fe1Smrg if (TYPE_P (node) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node))) 329*c3d31fe1Smrg fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node)); 330*c3d31fe1Smrg 331*c3d31fe1Smrg if (TREE_ADDRESSABLE (node)) 332*c3d31fe1Smrg fputs (" addressable", file); 333*c3d31fe1Smrg if (TREE_THIS_VOLATILE (node)) 334*c3d31fe1Smrg fputs (" volatile", file); 335*c3d31fe1Smrg if (TREE_ASM_WRITTEN (node)) 336*c3d31fe1Smrg fputs (" asm_written", file); 337*c3d31fe1Smrg if (TREE_USED (node)) 338*c3d31fe1Smrg fputs (" used", file); 339*c3d31fe1Smrg if (TREE_NOTHROW (node)) 340*c3d31fe1Smrg fputs (TYPE_P (node) ? " align-ok" : " nothrow", file); 341*c3d31fe1Smrg if (TREE_PUBLIC (node)) 342*c3d31fe1Smrg fputs (" public", file); 343*c3d31fe1Smrg if (TREE_PRIVATE (node)) 344*c3d31fe1Smrg fputs (" private", file); 345*c3d31fe1Smrg if (TREE_PROTECTED (node)) 346*c3d31fe1Smrg fputs (" protected", file); 347*c3d31fe1Smrg if (TREE_STATIC (node)) 348*c3d31fe1Smrg fputs (" static", file); 349*c3d31fe1Smrg if (TREE_DEPRECATED (node)) 350*c3d31fe1Smrg fputs (" deprecated", file); 351*c3d31fe1Smrg if (TREE_VISITED (node)) 352*c3d31fe1Smrg fputs (" visited", file); 353*c3d31fe1Smrg if (TREE_LANG_FLAG_0 (node)) 354*c3d31fe1Smrg fputs (" tree_0", file); 355*c3d31fe1Smrg if (TREE_LANG_FLAG_1 (node)) 356*c3d31fe1Smrg fputs (" tree_1", file); 357*c3d31fe1Smrg if (TREE_LANG_FLAG_2 (node)) 358*c3d31fe1Smrg fputs (" tree_2", file); 359*c3d31fe1Smrg if (TREE_LANG_FLAG_3 (node)) 360*c3d31fe1Smrg fputs (" tree_3", file); 361*c3d31fe1Smrg if (TREE_LANG_FLAG_4 (node)) 362*c3d31fe1Smrg fputs (" tree_4", file); 363*c3d31fe1Smrg if (TREE_LANG_FLAG_5 (node)) 364*c3d31fe1Smrg fputs (" tree_5", file); 365*c3d31fe1Smrg if (TREE_LANG_FLAG_6 (node)) 366*c3d31fe1Smrg fputs (" tree_6", file); 367*c3d31fe1Smrg 368*c3d31fe1Smrg /* DECL_ nodes have additional attributes. */ 369*c3d31fe1Smrg 370*c3d31fe1Smrg switch (TREE_CODE_CLASS (code)) 371*c3d31fe1Smrg { 372*c3d31fe1Smrg case tcc_declaration: 373*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) 374*c3d31fe1Smrg { 375*c3d31fe1Smrg if (DECL_UNSIGNED (node)) 376*c3d31fe1Smrg fputs (" unsigned", file); 377*c3d31fe1Smrg if (DECL_IGNORED_P (node)) 378*c3d31fe1Smrg fputs (" ignored", file); 379*c3d31fe1Smrg if (DECL_ABSTRACT (node)) 380*c3d31fe1Smrg fputs (" abstract", file); 381*c3d31fe1Smrg if (DECL_EXTERNAL (node)) 382*c3d31fe1Smrg fputs (" external", file); 383*c3d31fe1Smrg if (DECL_NONLOCAL (node)) 384*c3d31fe1Smrg fputs (" nonlocal", file); 385*c3d31fe1Smrg } 386*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) 387*c3d31fe1Smrg { 388*c3d31fe1Smrg if (DECL_WEAK (node)) 389*c3d31fe1Smrg fputs (" weak", file); 390*c3d31fe1Smrg if (DECL_IN_SYSTEM_HEADER (node)) 391*c3d31fe1Smrg fputs (" in_system_header", file); 392*c3d31fe1Smrg } 393*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL) 394*c3d31fe1Smrg && code != LABEL_DECL 395*c3d31fe1Smrg && code != FUNCTION_DECL 396*c3d31fe1Smrg && DECL_REGISTER (node)) 397*c3d31fe1Smrg fputs (" regdecl", file); 398*c3d31fe1Smrg 399*c3d31fe1Smrg if (code == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node)) 400*c3d31fe1Smrg fputs (" suppress-debug", file); 401*c3d31fe1Smrg 402*c3d31fe1Smrg if (code == FUNCTION_DECL 403*c3d31fe1Smrg && DECL_FUNCTION_SPECIFIC_TARGET (node)) 404*c3d31fe1Smrg fputs (" function-specific-target", file); 405*c3d31fe1Smrg if (code == FUNCTION_DECL 406*c3d31fe1Smrg && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node)) 407*c3d31fe1Smrg fputs (" function-specific-opt", file); 408*c3d31fe1Smrg if (code == FUNCTION_DECL && DECL_DECLARED_INLINE_P (node)) 409*c3d31fe1Smrg fputs (" autoinline", file); 410*c3d31fe1Smrg if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) 411*c3d31fe1Smrg fputs (" built-in", file); 412*c3d31fe1Smrg if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node)) 413*c3d31fe1Smrg fputs (" static-chain", file); 414*c3d31fe1Smrg 415*c3d31fe1Smrg if (code == FIELD_DECL && DECL_PACKED (node)) 416*c3d31fe1Smrg fputs (" packed", file); 417*c3d31fe1Smrg if (code == FIELD_DECL && DECL_BIT_FIELD (node)) 418*c3d31fe1Smrg fputs (" bit-field", file); 419*c3d31fe1Smrg if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node)) 420*c3d31fe1Smrg fputs (" nonaddressable", file); 421*c3d31fe1Smrg 422*c3d31fe1Smrg if (code == LABEL_DECL && DECL_ERROR_ISSUED (node)) 423*c3d31fe1Smrg fputs (" error-issued", file); 424*c3d31fe1Smrg if (code == LABEL_DECL && EH_LANDING_PAD_NR (node)) 425*c3d31fe1Smrg fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node)); 426*c3d31fe1Smrg 427*c3d31fe1Smrg if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node)) 428*c3d31fe1Smrg fputs (" in-text-section", file); 429*c3d31fe1Smrg if (code == VAR_DECL && DECL_COMMON (node)) 430*c3d31fe1Smrg fputs (" common", file); 431*c3d31fe1Smrg if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node)) 432*c3d31fe1Smrg { 433*c3d31fe1Smrg enum tls_model kind = DECL_TLS_MODEL (node); 434*c3d31fe1Smrg switch (kind) 435*c3d31fe1Smrg { 436*c3d31fe1Smrg case TLS_MODEL_GLOBAL_DYNAMIC: 437*c3d31fe1Smrg fputs (" tls-global-dynamic", file); 438*c3d31fe1Smrg break; 439*c3d31fe1Smrg case TLS_MODEL_LOCAL_DYNAMIC: 440*c3d31fe1Smrg fputs (" tls-local-dynamic", file); 441*c3d31fe1Smrg break; 442*c3d31fe1Smrg case TLS_MODEL_INITIAL_EXEC: 443*c3d31fe1Smrg fputs (" tls-initial-exec", file); 444*c3d31fe1Smrg break; 445*c3d31fe1Smrg case TLS_MODEL_LOCAL_EXEC: 446*c3d31fe1Smrg fputs (" tls-local-exec", file); 447*c3d31fe1Smrg break; 448*c3d31fe1Smrg default: 449*c3d31fe1Smrg gcc_unreachable (); 450*c3d31fe1Smrg } 451*c3d31fe1Smrg } 452*c3d31fe1Smrg 453*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) 454*c3d31fe1Smrg { 455*c3d31fe1Smrg if (DECL_VIRTUAL_P (node)) 456*c3d31fe1Smrg fputs (" virtual", file); 457*c3d31fe1Smrg if (DECL_PRESERVE_P (node)) 458*c3d31fe1Smrg fputs (" preserve", file); 459*c3d31fe1Smrg if (DECL_LANG_FLAG_0 (node)) 460*c3d31fe1Smrg fputs (" decl_0", file); 461*c3d31fe1Smrg if (DECL_LANG_FLAG_1 (node)) 462*c3d31fe1Smrg fputs (" decl_1", file); 463*c3d31fe1Smrg if (DECL_LANG_FLAG_2 (node)) 464*c3d31fe1Smrg fputs (" decl_2", file); 465*c3d31fe1Smrg if (DECL_LANG_FLAG_3 (node)) 466*c3d31fe1Smrg fputs (" decl_3", file); 467*c3d31fe1Smrg if (DECL_LANG_FLAG_4 (node)) 468*c3d31fe1Smrg fputs (" decl_4", file); 469*c3d31fe1Smrg if (DECL_LANG_FLAG_5 (node)) 470*c3d31fe1Smrg fputs (" decl_5", file); 471*c3d31fe1Smrg if (DECL_LANG_FLAG_6 (node)) 472*c3d31fe1Smrg fputs (" decl_6", file); 473*c3d31fe1Smrg if (DECL_LANG_FLAG_7 (node)) 474*c3d31fe1Smrg fputs (" decl_7", file); 475*c3d31fe1Smrg 476*c3d31fe1Smrg mode = DECL_MODE (node); 477*c3d31fe1Smrg fprintf (file, " %s", GET_MODE_NAME (mode)); 478*c3d31fe1Smrg } 479*c3d31fe1Smrg 480*c3d31fe1Smrg if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) 481*c3d31fe1Smrg && DECL_BY_REFERENCE (node)) 482*c3d31fe1Smrg fputs (" passed-by-reference", file); 483*c3d31fe1Smrg 484*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node)) 485*c3d31fe1Smrg fputs (" defer-output", file); 486*c3d31fe1Smrg 487*c3d31fe1Smrg 488*c3d31fe1Smrg xloc = expand_location (DECL_SOURCE_LOCATION (node)); 489*c3d31fe1Smrg fprintf (file, " file %s line %d col %d", xloc.file, xloc.line, 490*c3d31fe1Smrg xloc.column); 491*c3d31fe1Smrg 492*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) 493*c3d31fe1Smrg { 494*c3d31fe1Smrg print_node (file, "size", DECL_SIZE (node), indent + 4); 495*c3d31fe1Smrg print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); 496*c3d31fe1Smrg 497*c3d31fe1Smrg if (code != FUNCTION_DECL || DECL_BUILT_IN (node)) 498*c3d31fe1Smrg indent_to (file, indent + 3); 499*c3d31fe1Smrg 500*c3d31fe1Smrg if (DECL_USER_ALIGN (node)) 501*c3d31fe1Smrg fprintf (file, " user"); 502*c3d31fe1Smrg 503*c3d31fe1Smrg fprintf (file, " align %d", DECL_ALIGN (node)); 504*c3d31fe1Smrg if (code == FIELD_DECL) 505*c3d31fe1Smrg fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, 506*c3d31fe1Smrg DECL_OFFSET_ALIGN (node)); 507*c3d31fe1Smrg 508*c3d31fe1Smrg if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) 509*c3d31fe1Smrg { 510*c3d31fe1Smrg if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) 511*c3d31fe1Smrg fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node)); 512*c3d31fe1Smrg else 513*c3d31fe1Smrg fprintf (file, " built-in %s:%s", 514*c3d31fe1Smrg built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], 515*c3d31fe1Smrg built_in_names[(int) DECL_FUNCTION_CODE (node)]); 516*c3d31fe1Smrg } 517*c3d31fe1Smrg } 518*c3d31fe1Smrg if (code == FIELD_DECL) 519*c3d31fe1Smrg { 520*c3d31fe1Smrg print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); 521*c3d31fe1Smrg print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), 522*c3d31fe1Smrg indent + 4); 523*c3d31fe1Smrg if (DECL_BIT_FIELD_TYPE (node)) 524*c3d31fe1Smrg print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node), 525*c3d31fe1Smrg indent + 4); 526*c3d31fe1Smrg } 527*c3d31fe1Smrg 528*c3d31fe1Smrg print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4); 529*c3d31fe1Smrg 530*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) 531*c3d31fe1Smrg { 532*c3d31fe1Smrg print_node_brief (file, "attributes", 533*c3d31fe1Smrg DECL_ATTRIBUTES (node), indent + 4); 534*c3d31fe1Smrg if (code != PARM_DECL) 535*c3d31fe1Smrg print_node_brief (file, "initial", DECL_INITIAL (node), 536*c3d31fe1Smrg indent + 4); 537*c3d31fe1Smrg } 538*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) 539*c3d31fe1Smrg { 540*c3d31fe1Smrg print_node_brief (file, "abstract_origin", 541*c3d31fe1Smrg DECL_ABSTRACT_ORIGIN (node), indent + 4); 542*c3d31fe1Smrg } 543*c3d31fe1Smrg if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) 544*c3d31fe1Smrg { 545*c3d31fe1Smrg print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4); 546*c3d31fe1Smrg print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); 547*c3d31fe1Smrg } 548*c3d31fe1Smrg 549*c3d31fe1Smrg lang_hooks.print_decl (file, node, indent); 550*c3d31fe1Smrg 551*c3d31fe1Smrg if (DECL_RTL_SET_P (node)) 552*c3d31fe1Smrg { 553*c3d31fe1Smrg indent_to (file, indent + 4); 554*c3d31fe1Smrg print_rtl (file, DECL_RTL (node)); 555*c3d31fe1Smrg } 556*c3d31fe1Smrg 557*c3d31fe1Smrg if (code == PARM_DECL) 558*c3d31fe1Smrg { 559*c3d31fe1Smrg print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4); 560*c3d31fe1Smrg 561*c3d31fe1Smrg if (DECL_INCOMING_RTL (node) != 0) 562*c3d31fe1Smrg { 563*c3d31fe1Smrg indent_to (file, indent + 4); 564*c3d31fe1Smrg fprintf (file, "incoming-rtl "); 565*c3d31fe1Smrg print_rtl (file, DECL_INCOMING_RTL (node)); 566*c3d31fe1Smrg } 567*c3d31fe1Smrg } 568*c3d31fe1Smrg else if (code == FUNCTION_DECL 569*c3d31fe1Smrg && DECL_STRUCT_FUNCTION (node) != 0) 570*c3d31fe1Smrg { 571*c3d31fe1Smrg indent_to (file, indent + 4); 572*c3d31fe1Smrg dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); 573*c3d31fe1Smrg } 574*c3d31fe1Smrg 575*c3d31fe1Smrg if ((code == VAR_DECL || code == PARM_DECL) 576*c3d31fe1Smrg && DECL_HAS_VALUE_EXPR_P (node)) 577*c3d31fe1Smrg print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4); 578*c3d31fe1Smrg 579*c3d31fe1Smrg /* Print the decl chain only if decl is at second level. */ 580*c3d31fe1Smrg if (indent == 4) 581*c3d31fe1Smrg print_node (file, "chain", TREE_CHAIN (node), indent + 4); 582*c3d31fe1Smrg else 583*c3d31fe1Smrg print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); 584*c3d31fe1Smrg break; 585*c3d31fe1Smrg 586*c3d31fe1Smrg case tcc_type: 587*c3d31fe1Smrg if (TYPE_UNSIGNED (node)) 588*c3d31fe1Smrg fputs (" unsigned", file); 589*c3d31fe1Smrg 590*c3d31fe1Smrg /* The no-force-blk flag is used for different things in 591*c3d31fe1Smrg different types. */ 592*c3d31fe1Smrg if ((code == RECORD_TYPE 593*c3d31fe1Smrg || code == UNION_TYPE 594*c3d31fe1Smrg || code == QUAL_UNION_TYPE) 595*c3d31fe1Smrg && TYPE_NO_FORCE_BLK (node)) 596*c3d31fe1Smrg fputs (" no-force-blk", file); 597*c3d31fe1Smrg else if (code == INTEGER_TYPE 598*c3d31fe1Smrg && TYPE_IS_SIZETYPE (node)) 599*c3d31fe1Smrg fputs (" sizetype", file); 600*c3d31fe1Smrg 601*c3d31fe1Smrg if (TYPE_STRING_FLAG (node)) 602*c3d31fe1Smrg fputs (" string-flag", file); 603*c3d31fe1Smrg if (TYPE_NEEDS_CONSTRUCTING (node)) 604*c3d31fe1Smrg fputs (" needs-constructing", file); 605*c3d31fe1Smrg 606*c3d31fe1Smrg /* The transparent-union flag is used for different things in 607*c3d31fe1Smrg different nodes. */ 608*c3d31fe1Smrg if ((code == UNION_TYPE || code == RECORD_TYPE) 609*c3d31fe1Smrg && TYPE_TRANSPARENT_AGGR (node)) 610*c3d31fe1Smrg fputs (" transparent-aggr", file); 611*c3d31fe1Smrg else if (code == ARRAY_TYPE 612*c3d31fe1Smrg && TYPE_NONALIASED_COMPONENT (node)) 613*c3d31fe1Smrg fputs (" nonaliased-component", file); 614*c3d31fe1Smrg 615*c3d31fe1Smrg if (TYPE_PACKED (node)) 616*c3d31fe1Smrg fputs (" packed", file); 617*c3d31fe1Smrg 618*c3d31fe1Smrg if (TYPE_RESTRICT (node)) 619*c3d31fe1Smrg fputs (" restrict", file); 620*c3d31fe1Smrg 621*c3d31fe1Smrg if (TYPE_LANG_FLAG_0 (node)) 622*c3d31fe1Smrg fputs (" type_0", file); 623*c3d31fe1Smrg if (TYPE_LANG_FLAG_1 (node)) 624*c3d31fe1Smrg fputs (" type_1", file); 625*c3d31fe1Smrg if (TYPE_LANG_FLAG_2 (node)) 626*c3d31fe1Smrg fputs (" type_2", file); 627*c3d31fe1Smrg if (TYPE_LANG_FLAG_3 (node)) 628*c3d31fe1Smrg fputs (" type_3", file); 629*c3d31fe1Smrg if (TYPE_LANG_FLAG_4 (node)) 630*c3d31fe1Smrg fputs (" type_4", file); 631*c3d31fe1Smrg if (TYPE_LANG_FLAG_5 (node)) 632*c3d31fe1Smrg fputs (" type_5", file); 633*c3d31fe1Smrg if (TYPE_LANG_FLAG_6 (node)) 634*c3d31fe1Smrg fputs (" type_6", file); 635*c3d31fe1Smrg 636*c3d31fe1Smrg mode = TYPE_MODE (node); 637*c3d31fe1Smrg fprintf (file, " %s", GET_MODE_NAME (mode)); 638*c3d31fe1Smrg 639*c3d31fe1Smrg print_node (file, "size", TYPE_SIZE (node), indent + 4); 640*c3d31fe1Smrg print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4); 641*c3d31fe1Smrg indent_to (file, indent + 3); 642*c3d31fe1Smrg 643*c3d31fe1Smrg if (TYPE_USER_ALIGN (node)) 644*c3d31fe1Smrg fprintf (file, " user"); 645*c3d31fe1Smrg 646*c3d31fe1Smrg fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC, 647*c3d31fe1Smrg TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node), 648*c3d31fe1Smrg (HOST_WIDE_INT) TYPE_ALIAS_SET (node)); 649*c3d31fe1Smrg 650*c3d31fe1Smrg if (TYPE_STRUCTURAL_EQUALITY_P (node)) 651*c3d31fe1Smrg fprintf (file, " structural equality"); 652*c3d31fe1Smrg else 653*c3d31fe1Smrg dump_addr (file, " canonical type ", TYPE_CANONICAL (node)); 654*c3d31fe1Smrg 655*c3d31fe1Smrg print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); 656*c3d31fe1Smrg 657*c3d31fe1Smrg if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE 658*c3d31fe1Smrg || code == FIXED_POINT_TYPE) 659*c3d31fe1Smrg { 660*c3d31fe1Smrg fprintf (file, " precision %d", TYPE_PRECISION (node)); 661*c3d31fe1Smrg print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4); 662*c3d31fe1Smrg print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4); 663*c3d31fe1Smrg } 664*c3d31fe1Smrg 665*c3d31fe1Smrg if (code == ENUMERAL_TYPE) 666*c3d31fe1Smrg print_node (file, "values", TYPE_VALUES (node), indent + 4); 667*c3d31fe1Smrg else if (code == ARRAY_TYPE) 668*c3d31fe1Smrg print_node (file, "domain", TYPE_DOMAIN (node), indent + 4); 669*c3d31fe1Smrg else if (code == VECTOR_TYPE) 670*c3d31fe1Smrg fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node)); 671*c3d31fe1Smrg else if (code == RECORD_TYPE 672*c3d31fe1Smrg || code == UNION_TYPE 673*c3d31fe1Smrg || code == QUAL_UNION_TYPE) 674*c3d31fe1Smrg print_node (file, "fields", TYPE_FIELDS (node), indent + 4); 675*c3d31fe1Smrg else if (code == FUNCTION_TYPE 676*c3d31fe1Smrg || code == METHOD_TYPE) 677*c3d31fe1Smrg { 678*c3d31fe1Smrg if (TYPE_METHOD_BASETYPE (node)) 679*c3d31fe1Smrg print_node_brief (file, "method basetype", 680*c3d31fe1Smrg TYPE_METHOD_BASETYPE (node), indent + 4); 681*c3d31fe1Smrg print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4); 682*c3d31fe1Smrg } 683*c3d31fe1Smrg else if (code == OFFSET_TYPE) 684*c3d31fe1Smrg print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node), 685*c3d31fe1Smrg indent + 4); 686*c3d31fe1Smrg 687*c3d31fe1Smrg if (TYPE_CONTEXT (node)) 688*c3d31fe1Smrg print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4); 689*c3d31fe1Smrg 690*c3d31fe1Smrg lang_hooks.print_type (file, node, indent); 691*c3d31fe1Smrg 692*c3d31fe1Smrg if (TYPE_POINTER_TO (node) || TREE_CHAIN (node)) 693*c3d31fe1Smrg indent_to (file, indent + 3); 694*c3d31fe1Smrg 695*c3d31fe1Smrg print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), 696*c3d31fe1Smrg indent + 4); 697*c3d31fe1Smrg print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), 698*c3d31fe1Smrg indent + 4); 699*c3d31fe1Smrg print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); 700*c3d31fe1Smrg break; 701*c3d31fe1Smrg 702*c3d31fe1Smrg case tcc_expression: 703*c3d31fe1Smrg case tcc_comparison: 704*c3d31fe1Smrg case tcc_unary: 705*c3d31fe1Smrg case tcc_binary: 706*c3d31fe1Smrg case tcc_reference: 707*c3d31fe1Smrg case tcc_statement: 708*c3d31fe1Smrg case tcc_vl_exp: 709*c3d31fe1Smrg if (code == BIND_EXPR) 710*c3d31fe1Smrg { 711*c3d31fe1Smrg print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4); 712*c3d31fe1Smrg print_node (file, "body", TREE_OPERAND (node, 1), indent + 4); 713*c3d31fe1Smrg print_node (file, "block", TREE_OPERAND (node, 2), indent + 4); 714*c3d31fe1Smrg break; 715*c3d31fe1Smrg } 716*c3d31fe1Smrg if (code == CALL_EXPR) 717*c3d31fe1Smrg { 718*c3d31fe1Smrg call_expr_arg_iterator iter; 719*c3d31fe1Smrg tree arg; 720*c3d31fe1Smrg print_node (file, "fn", CALL_EXPR_FN (node), indent + 4); 721*c3d31fe1Smrg print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node), 722*c3d31fe1Smrg indent + 4); 723*c3d31fe1Smrg i = 0; 724*c3d31fe1Smrg FOR_EACH_CALL_EXPR_ARG (arg, iter, node) 725*c3d31fe1Smrg { 726*c3d31fe1Smrg char temp[10]; 727*c3d31fe1Smrg sprintf (temp, "arg %d", i); 728*c3d31fe1Smrg print_node (file, temp, arg, indent + 4); 729*c3d31fe1Smrg i++; 730*c3d31fe1Smrg } 731*c3d31fe1Smrg } 732*c3d31fe1Smrg else 733*c3d31fe1Smrg { 734*c3d31fe1Smrg len = TREE_OPERAND_LENGTH (node); 735*c3d31fe1Smrg 736*c3d31fe1Smrg for (i = 0; i < len; i++) 737*c3d31fe1Smrg { 738*c3d31fe1Smrg char temp[10]; 739*c3d31fe1Smrg 740*c3d31fe1Smrg sprintf (temp, "arg %d", i); 741*c3d31fe1Smrg print_node (file, temp, TREE_OPERAND (node, i), indent + 4); 742*c3d31fe1Smrg } 743*c3d31fe1Smrg } 744*c3d31fe1Smrg print_node (file, "chain", TREE_CHAIN (node), indent + 4); 745*c3d31fe1Smrg break; 746*c3d31fe1Smrg 747*c3d31fe1Smrg case tcc_constant: 748*c3d31fe1Smrg case tcc_exceptional: 749*c3d31fe1Smrg switch (code) 750*c3d31fe1Smrg { 751*c3d31fe1Smrg case INTEGER_CST: 752*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 753*c3d31fe1Smrg fprintf (file, " overflow"); 754*c3d31fe1Smrg 755*c3d31fe1Smrg fprintf (file, " "); 756*c3d31fe1Smrg if (TREE_INT_CST_HIGH (node) == 0) 757*c3d31fe1Smrg fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, 758*c3d31fe1Smrg TREE_INT_CST_LOW (node)); 759*c3d31fe1Smrg else if (TREE_INT_CST_HIGH (node) == -1 760*c3d31fe1Smrg && TREE_INT_CST_LOW (node) != 0) 761*c3d31fe1Smrg fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED, 762*c3d31fe1Smrg -TREE_INT_CST_LOW (node)); 763*c3d31fe1Smrg else 764*c3d31fe1Smrg fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, 765*c3d31fe1Smrg (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (node), 766*c3d31fe1Smrg (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (node)); 767*c3d31fe1Smrg break; 768*c3d31fe1Smrg 769*c3d31fe1Smrg case REAL_CST: 770*c3d31fe1Smrg { 771*c3d31fe1Smrg REAL_VALUE_TYPE d; 772*c3d31fe1Smrg 773*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 774*c3d31fe1Smrg fprintf (file, " overflow"); 775*c3d31fe1Smrg 776*c3d31fe1Smrg d = TREE_REAL_CST (node); 777*c3d31fe1Smrg if (REAL_VALUE_ISINF (d)) 778*c3d31fe1Smrg fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf"); 779*c3d31fe1Smrg else if (REAL_VALUE_ISNAN (d)) 780*c3d31fe1Smrg fprintf (file, " Nan"); 781*c3d31fe1Smrg else 782*c3d31fe1Smrg { 783*c3d31fe1Smrg char string[64]; 784*c3d31fe1Smrg real_to_decimal (string, &d, sizeof (string), 0, 1); 785*c3d31fe1Smrg fprintf (file, " %s", string); 786*c3d31fe1Smrg } 787*c3d31fe1Smrg } 788*c3d31fe1Smrg break; 789*c3d31fe1Smrg 790*c3d31fe1Smrg case FIXED_CST: 791*c3d31fe1Smrg { 792*c3d31fe1Smrg FIXED_VALUE_TYPE f; 793*c3d31fe1Smrg char string[64]; 794*c3d31fe1Smrg 795*c3d31fe1Smrg if (TREE_OVERFLOW (node)) 796*c3d31fe1Smrg fprintf (file, " overflow"); 797*c3d31fe1Smrg 798*c3d31fe1Smrg f = TREE_FIXED_CST (node); 799*c3d31fe1Smrg fixed_to_decimal (string, &f, sizeof (string)); 800*c3d31fe1Smrg fprintf (file, " %s", string); 801*c3d31fe1Smrg } 802*c3d31fe1Smrg break; 803*c3d31fe1Smrg 804*c3d31fe1Smrg case VECTOR_CST: 805*c3d31fe1Smrg { 806*c3d31fe1Smrg tree vals = TREE_VECTOR_CST_ELTS (node); 807*c3d31fe1Smrg char buf[10]; 808*c3d31fe1Smrg tree link; 809*c3d31fe1Smrg int i; 810*c3d31fe1Smrg 811*c3d31fe1Smrg i = 0; 812*c3d31fe1Smrg for (link = vals; link; link = TREE_CHAIN (link), ++i) 813*c3d31fe1Smrg { 814*c3d31fe1Smrg sprintf (buf, "elt%d: ", i); 815*c3d31fe1Smrg print_node (file, buf, TREE_VALUE (link), indent + 4); 816*c3d31fe1Smrg } 817*c3d31fe1Smrg } 818*c3d31fe1Smrg break; 819*c3d31fe1Smrg 820*c3d31fe1Smrg case COMPLEX_CST: 821*c3d31fe1Smrg print_node (file, "real", TREE_REALPART (node), indent + 4); 822*c3d31fe1Smrg print_node (file, "imag", TREE_IMAGPART (node), indent + 4); 823*c3d31fe1Smrg break; 824*c3d31fe1Smrg 825*c3d31fe1Smrg case STRING_CST: 826*c3d31fe1Smrg { 827*c3d31fe1Smrg const char *p = TREE_STRING_POINTER (node); 828*c3d31fe1Smrg int i = TREE_STRING_LENGTH (node); 829*c3d31fe1Smrg fputs (" \"", file); 830*c3d31fe1Smrg while (--i >= 0) 831*c3d31fe1Smrg { 832*c3d31fe1Smrg char ch = *p++; 833*c3d31fe1Smrg if (ch >= ' ' && ch < 127) 834*c3d31fe1Smrg putc (ch, file); 835*c3d31fe1Smrg else 836*c3d31fe1Smrg fprintf(file, "\\%03o", ch & 0xFF); 837*c3d31fe1Smrg } 838*c3d31fe1Smrg fputc ('\"', file); 839*c3d31fe1Smrg } 840*c3d31fe1Smrg /* Print the chain at second level. */ 841*c3d31fe1Smrg if (indent == 4) 842*c3d31fe1Smrg print_node (file, "chain", TREE_CHAIN (node), indent + 4); 843*c3d31fe1Smrg else 844*c3d31fe1Smrg print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); 845*c3d31fe1Smrg break; 846*c3d31fe1Smrg 847*c3d31fe1Smrg case IDENTIFIER_NODE: 848*c3d31fe1Smrg lang_hooks.print_identifier (file, node, indent); 849*c3d31fe1Smrg break; 850*c3d31fe1Smrg 851*c3d31fe1Smrg case TREE_LIST: 852*c3d31fe1Smrg print_node (file, "purpose", TREE_PURPOSE (node), indent + 4); 853*c3d31fe1Smrg print_node (file, "value", TREE_VALUE (node), indent + 4); 854*c3d31fe1Smrg print_node (file, "chain", TREE_CHAIN (node), indent + 4); 855*c3d31fe1Smrg break; 856*c3d31fe1Smrg 857*c3d31fe1Smrg case TREE_VEC: 858*c3d31fe1Smrg len = TREE_VEC_LENGTH (node); 859*c3d31fe1Smrg for (i = 0; i < len; i++) 860*c3d31fe1Smrg if (TREE_VEC_ELT (node, i)) 861*c3d31fe1Smrg { 862*c3d31fe1Smrg char temp[10]; 863*c3d31fe1Smrg sprintf (temp, "elt %d", i); 864*c3d31fe1Smrg indent_to (file, indent + 4); 865*c3d31fe1Smrg print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0); 866*c3d31fe1Smrg } 867*c3d31fe1Smrg break; 868*c3d31fe1Smrg 869*c3d31fe1Smrg case CONSTRUCTOR: 870*c3d31fe1Smrg { 871*c3d31fe1Smrg unsigned HOST_WIDE_INT cnt; 872*c3d31fe1Smrg tree index, value; 873*c3d31fe1Smrg len = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (node)); 874*c3d31fe1Smrg fprintf (file, " lngt %d", len); 875*c3d31fe1Smrg FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), 876*c3d31fe1Smrg cnt, index, value) 877*c3d31fe1Smrg { 878*c3d31fe1Smrg print_node (file, "idx", index, indent + 4); 879*c3d31fe1Smrg print_node (file, "val", value, indent + 4); 880*c3d31fe1Smrg } 881*c3d31fe1Smrg } 882*c3d31fe1Smrg break; 883*c3d31fe1Smrg 884*c3d31fe1Smrg case STATEMENT_LIST: 885*c3d31fe1Smrg dump_addr (file, " head ", node->stmt_list.head); 886*c3d31fe1Smrg dump_addr (file, " tail ", node->stmt_list.tail); 887*c3d31fe1Smrg fprintf (file, " stmts"); 888*c3d31fe1Smrg { 889*c3d31fe1Smrg tree_stmt_iterator i; 890*c3d31fe1Smrg for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i)) 891*c3d31fe1Smrg { 892*c3d31fe1Smrg /* Not printing the addresses of the (not-a-tree) 893*c3d31fe1Smrg 'struct tree_stmt_list_node's. */ 894*c3d31fe1Smrg dump_addr (file, " ", tsi_stmt (i)); 895*c3d31fe1Smrg } 896*c3d31fe1Smrg fprintf (file, "\n"); 897*c3d31fe1Smrg for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i)) 898*c3d31fe1Smrg { 899*c3d31fe1Smrg /* Not printing the addresses of the (not-a-tree) 900*c3d31fe1Smrg 'struct tree_stmt_list_node's. */ 901*c3d31fe1Smrg print_node (file, "stmt", tsi_stmt (i), indent + 4); 902*c3d31fe1Smrg } 903*c3d31fe1Smrg } 904*c3d31fe1Smrg print_node (file, "chain", TREE_CHAIN (node), indent + 4); 905*c3d31fe1Smrg break; 906*c3d31fe1Smrg 907*c3d31fe1Smrg case BLOCK: 908*c3d31fe1Smrg print_node (file, "vars", BLOCK_VARS (node), indent + 4); 909*c3d31fe1Smrg print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), 910*c3d31fe1Smrg indent + 4); 911*c3d31fe1Smrg print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4); 912*c3d31fe1Smrg print_node (file, "chain", BLOCK_CHAIN (node), indent + 4); 913*c3d31fe1Smrg print_node (file, "abstract_origin", 914*c3d31fe1Smrg BLOCK_ABSTRACT_ORIGIN (node), indent + 4); 915*c3d31fe1Smrg break; 916*c3d31fe1Smrg 917*c3d31fe1Smrg case SSA_NAME: 918*c3d31fe1Smrg print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4); 919*c3d31fe1Smrg fprintf (file, "def_stmt "); 920*c3d31fe1Smrg print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0); 921*c3d31fe1Smrg 922*c3d31fe1Smrg indent_to (file, indent + 4); 923*c3d31fe1Smrg fprintf (file, "version %u", SSA_NAME_VERSION (node)); 924*c3d31fe1Smrg if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node)) 925*c3d31fe1Smrg fprintf (file, " in-abnormal-phi"); 926*c3d31fe1Smrg if (SSA_NAME_IN_FREE_LIST (node)) 927*c3d31fe1Smrg fprintf (file, " in-free-list"); 928*c3d31fe1Smrg 929*c3d31fe1Smrg if (SSA_NAME_PTR_INFO (node)) 930*c3d31fe1Smrg { 931*c3d31fe1Smrg indent_to (file, indent + 3); 932*c3d31fe1Smrg if (SSA_NAME_PTR_INFO (node)) 933*c3d31fe1Smrg dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node)); 934*c3d31fe1Smrg } 935*c3d31fe1Smrg break; 936*c3d31fe1Smrg 937*c3d31fe1Smrg case OMP_CLAUSE: 938*c3d31fe1Smrg { 939*c3d31fe1Smrg int i; 940*c3d31fe1Smrg fprintf (file, " %s", 941*c3d31fe1Smrg omp_clause_code_name[OMP_CLAUSE_CODE (node)]); 942*c3d31fe1Smrg for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++) 943*c3d31fe1Smrg { 944*c3d31fe1Smrg indent_to (file, indent + 4); 945*c3d31fe1Smrg fprintf (file, "op %d:", i); 946*c3d31fe1Smrg print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0); 947*c3d31fe1Smrg } 948*c3d31fe1Smrg } 949*c3d31fe1Smrg break; 950*c3d31fe1Smrg 951*c3d31fe1Smrg case OPTIMIZATION_NODE: 952*c3d31fe1Smrg cl_optimization_print (file, indent + 4, TREE_OPTIMIZATION (node)); 953*c3d31fe1Smrg break; 954*c3d31fe1Smrg 955*c3d31fe1Smrg case TARGET_OPTION_NODE: 956*c3d31fe1Smrg cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node)); 957*c3d31fe1Smrg break; 958*c3d31fe1Smrg case IMPORTED_DECL: 959*c3d31fe1Smrg fprintf (file, " imported declaration"); 960*c3d31fe1Smrg print_node_brief (file, "associated declaration", 961*c3d31fe1Smrg IMPORTED_DECL_ASSOCIATED_DECL (node), 962*c3d31fe1Smrg indent + 4); 963*c3d31fe1Smrg break; 964*c3d31fe1Smrg 965*c3d31fe1Smrg default: 966*c3d31fe1Smrg if (EXCEPTIONAL_CLASS_P (node)) 967*c3d31fe1Smrg lang_hooks.print_xnode (file, node, indent); 968*c3d31fe1Smrg break; 969*c3d31fe1Smrg } 970*c3d31fe1Smrg 971*c3d31fe1Smrg break; 972*c3d31fe1Smrg } 973*c3d31fe1Smrg 974*c3d31fe1Smrg if (EXPR_HAS_LOCATION (node)) 975*c3d31fe1Smrg { 976*c3d31fe1Smrg expanded_location xloc = expand_location (EXPR_LOCATION (node)); 977*c3d31fe1Smrg indent_to (file, indent+4); 978*c3d31fe1Smrg fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column); 979*c3d31fe1Smrg } 980*c3d31fe1Smrg 981*c3d31fe1Smrg fprintf (file, ">"); 982*c3d31fe1Smrg } 983