192422Sobrien/* Tree-dumping functionality for intermediate representation. 292422Sobrien Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 392422Sobrien Written by Mark Mitchell <mark@codesourcery.com> 492422Sobrien 592422SobrienThis file is part of GCC. 692422Sobrien 792422SobrienGCC is free software; you can redistribute it and/or modify it under 892422Sobrienthe terms of the GNU General Public License as published by the Free 992422SobrienSoftware Foundation; either version 2, or (at your option) any later 1092422Sobrienversion. 1192422Sobrien 1292422SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY 1392422SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or 1492422SobrienFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1592422Sobrienfor more details. 1692422Sobrien 1792422SobrienYou should have received a copy of the GNU General Public License 1892422Sobrienalong with GCC; see the file COPYING. If not, write to the Free 1992422SobrienSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 2092422Sobrien02110-1301, USA. */ 2192422Sobrien 2292422Sobrien#ifndef GCC_TREE_DUMP_H 2392422Sobrien#define GCC_TREE_DUMP_H 2492422Sobrien 2592422Sobrien#include "splay-tree.h" 2692422Sobrien#include "tree-pass.h" 2792422Sobrien 2892422Sobrientypedef struct dump_info *dump_info_p; 29107806Sobrien 30170331Srafan/* Flags used with queue functions. */ 31244988Sdelphij#define DUMP_NONE 0 32224731Sru#define DUMP_BINFO 1 3392422Sobrien 34244988Sdelphij/* Information about a node to be dumped. */ 35244988Sdelphij 36244988Sdelphijtypedef struct dump_node_info 37244988Sdelphij{ 3892422Sobrien /* The index for the node. */ 3992422Sobrien unsigned int index; 4092422Sobrien /* Nonzero if the node is a binfo. */ 41107806Sobrien unsigned int binfo_p : 1; 42221381Sru} *dump_node_info_p; 4392422Sobrien 44107806Sobrien/* A dump_queue is a link in the queue of things to be dumped. */ 45221381Sru 4692422Sobrientypedef struct dump_queue 47221381Sru{ 48221381Sru /* The queued tree node. */ 4992422Sobrien splay_tree_node node; 5092422Sobrien /* The next node in the queue. */ 5192422Sobrien struct dump_queue *next; 5292422Sobrien} *dump_queue_p; 5392422Sobrien 5492422Sobrien/* A dump_info gives information about how we should perform the dump 5592422Sobrien and about the current state of the dump. */ 5692422Sobrien 5792422Sobrienstruct dump_info 5892422Sobrien{ 5992422Sobrien /* The stream on which to dump the information. */ 6092422Sobrien FILE *stream; 6192422Sobrien /* The original node. */ 6292422Sobrien tree node; 6392422Sobrien /* User flags. */ 6492422Sobrien int flags; 6592422Sobrien /* The next unused node index. */ 6692422Sobrien unsigned int index; 6792422Sobrien /* The next column. */ 6892422Sobrien unsigned int column; 6992422Sobrien /* The first node in the queue of nodes to be written out. */ 7092422Sobrien dump_queue_p queue; 7192422Sobrien /* The last node in the queue. */ 7292422Sobrien dump_queue_p queue_end; 7392422Sobrien /* Free queue nodes. */ 7492422Sobrien dump_queue_p free_list; 7592422Sobrien /* The tree nodes which we have already written out. The 7692422Sobrien keys are the addresses of the nodes; the values are the integer 7792422Sobrien indices we assigned them. */ 7892422Sobrien splay_tree nodes; 7992422Sobrien}; 8092422Sobrien 8192422Sobrien/* Dump the CHILD and its children. */ 8292422Sobrien#define dump_child(field, child) \ 8392422Sobrien queue_and_dump_index (di, field, child, DUMP_NONE) 8492422Sobrien 8592422Sobrienextern void dump_pointer (dump_info_p, const char *, void *); 86170331Srafanextern void dump_int (dump_info_p, const char *, int); 87extern void dump_string (dump_info_p, const char *); 88extern void dump_string_field (dump_info_p, const char *, const char *); 89extern void dump_stmt (dump_info_p, tree); 90extern void queue_and_dump_index (dump_info_p, const char *, tree, int); 91extern void queue_and_dump_type (dump_info_p, tree); 92extern void dump_function (enum tree_dump_index, tree); 93extern void dump_function_to_file (tree, FILE *, int); 94extern void debug_function (tree, int); 95extern int dump_flag (dump_info_p, int, tree); 96 97extern unsigned int dump_register (const char *, const char *, const char *, 98 int, int); 99 100 101#endif /* ! GCC_TREE_DUMP_H */ 102