tree-dump.h revision 169690
1194701Srpaulo/* Tree-dumping functionality for intermediate representation. 2194701Srpaulo Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 3194701Srpaulo Written by Mark Mitchell <mark@codesourcery.com> 4194701Srpaulo 5194701SrpauloThis file is part of GCC. 6194701Srpaulo 7194701SrpauloGCC is free software; you can redistribute it and/or modify it under 8194701Srpaulothe terms of the GNU General Public License as published by the Free 9194701SrpauloSoftware Foundation; either version 2, or (at your option) any later 10194701Srpauloversion. 11194701Srpaulo 12194701SrpauloGCC is distributed in the hope that it will be useful, but WITHOUT ANY 13194701SrpauloWARRANTY; without even the implied warranty of MERCHANTABILITY or 14194701SrpauloFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15194701Srpaulofor more details. 16194701Srpaulo 17194701SrpauloYou should have received a copy of the GNU General Public License 18194701Srpauloalong with GCC; see the file COPYING. If not, write to the Free 19194701SrpauloSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 20194701Srpaulo02110-1301, USA. */ 21194701Srpaulo 22194701Srpaulo#ifndef GCC_TREE_DUMP_H 23194701Srpaulo#define GCC_TREE_DUMP_H 24194701Srpaulo 25194701Srpaulo#include "splay-tree.h" 26194701Srpaulo#include "tree-pass.h" 27194701Srpaulo 28194701Srpaulotypedef struct dump_info *dump_info_p; 29194701Srpaulo 30194701Srpaulo/* Flags used with queue functions. */ 31194701Srpaulo#define DUMP_NONE 0 32194701Srpaulo#define DUMP_BINFO 1 33194701Srpaulo 34194701Srpaulo/* Information about a node to be dumped. */ 35194701Srpaulo 36194701Srpaulotypedef struct dump_node_info 37194701Srpaulo{ 38194701Srpaulo /* The index for the node. */ 39194701Srpaulo unsigned int index; 40194701Srpaulo /* Nonzero if the node is a binfo. */ 41194701Srpaulo unsigned int binfo_p : 1; 42194701Srpaulo} *dump_node_info_p; 43194701Srpaulo 44194701Srpaulo/* A dump_queue is a link in the queue of things to be dumped. */ 45194701Srpaulo 46194701Srpaulotypedef struct dump_queue 47194701Srpaulo{ 48194701Srpaulo /* The queued tree node. */ 49194701Srpaulo splay_tree_node node; 50194701Srpaulo /* The next node in the queue. */ 51194701Srpaulo struct dump_queue *next; 52194701Srpaulo} *dump_queue_p; 53194701Srpaulo 54194701Srpaulo/* A dump_info gives information about how we should perform the dump 55194701Srpaulo and about the current state of the dump. */ 56194701Srpaulo 57194701Srpaulostruct dump_info 58194701Srpaulo{ 59194701Srpaulo /* The stream on which to dump the information. */ 60194701Srpaulo FILE *stream; 61194701Srpaulo /* The original node. */ 62194701Srpaulo tree node; 63194701Srpaulo /* User flags. */ 64194701Srpaulo int flags; 65194701Srpaulo /* The next unused node index. */ 66194701Srpaulo unsigned int index; 67194701Srpaulo /* The next column. */ 68194701Srpaulo unsigned int column; 69194701Srpaulo /* The first node in the queue of nodes to be written out. */ 70194701Srpaulo dump_queue_p queue; 71194701Srpaulo /* The last node in the queue. */ 72194701Srpaulo dump_queue_p queue_end; 73194701Srpaulo /* Free queue nodes. */ 74194701Srpaulo dump_queue_p free_list; 75194701Srpaulo /* The tree nodes which we have already written out. The 76194701Srpaulo keys are the addresses of the nodes; the values are the integer 77194701Srpaulo indices we assigned them. */ 78194701Srpaulo splay_tree nodes; 79194701Srpaulo}; 80194701Srpaulo 81194701Srpaulo/* Dump the CHILD and its children. */ 82194701Srpaulo#define dump_child(field, child) \ 83194701Srpaulo queue_and_dump_index (di, field, child, DUMP_NONE) 84194701Srpaulo 85194701Srpauloextern void dump_pointer (dump_info_p, const char *, void *); 86194701Srpauloextern void dump_int (dump_info_p, const char *, int); 87194701Srpauloextern void dump_string (dump_info_p, const char *); 88194701Srpauloextern void dump_string_field (dump_info_p, const char *, const char *); 89194701Srpauloextern void dump_stmt (dump_info_p, tree); 90194701Srpauloextern void queue_and_dump_index (dump_info_p, const char *, tree, int); 91194701Srpauloextern void queue_and_dump_type (dump_info_p, tree); 92194701Srpauloextern void dump_function (enum tree_dump_index, tree); 93194701Srpauloextern void dump_function_to_file (tree, FILE *, int); 94194701Srpauloextern void debug_function (tree, int); 95194701Srpauloextern int dump_flag (dump_info_p, int, tree); 96194701Srpaulo 97194701Srpauloextern unsigned int dump_register (const char *, const char *, const char *, 98194701Srpaulo int, int); 99194701Srpaulo 100194701Srpaulo 101194701Srpaulo#endif /* ! GCC_TREE_DUMP_H */ 102194701Srpaulo