| 1 | 280 | jeremybenn | /* Tree-dumping functionality for intermediate representation.
 | 
      
         | 2 |  |  |    Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008, 2009
 | 
      
         | 3 |  |  |    Free Software Foundation, Inc.
 | 
      
         | 4 |  |  |    Written by Mark Mitchell <mark@codesourcery.com>
 | 
      
         | 5 |  |  |  
 | 
      
         | 6 |  |  | This file is part of GCC.
 | 
      
         | 7 |  |  |  
 | 
      
         | 8 |  |  | GCC is free software; you can redistribute it and/or modify it under
 | 
      
         | 9 |  |  | the terms of the GNU General Public License as published by the Free
 | 
      
         | 10 |  |  | Software Foundation; either version 3, or (at your option) any later
 | 
      
         | 11 |  |  | version.
 | 
      
         | 12 |  |  |  
 | 
      
         | 13 |  |  | GCC is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
      
         | 14 |  |  | WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
      
         | 15 |  |  | FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 | 
      
         | 16 |  |  | for more details.
 | 
      
         | 17 |  |  |  
 | 
      
         | 18 |  |  | You should have received a copy of the GNU General Public License
 | 
      
         | 19 |  |  | along with GCC; see the file COPYING3.  If not see
 | 
      
         | 20 |  |  | <http://www.gnu.org/licenses/>.  */
 | 
      
         | 21 |  |  |  
 | 
      
         | 22 |  |  | #ifndef GCC_TREE_DUMP_H
 | 
      
         | 23 |  |  | #define GCC_TREE_DUMP_H
 | 
      
         | 24 |  |  |  
 | 
      
         | 25 |  |  | #include "splay-tree.h"
 | 
      
         | 26 |  |  | #include "tree-pass.h"
 | 
      
         | 27 |  |  |  
 | 
      
         | 28 |  |  | typedef struct dump_info *dump_info_p;
 | 
      
         | 29 |  |  |  
 | 
      
         | 30 |  |  | /* Flags used with queue functions.  */
 | 
      
         | 31 |  |  | #define DUMP_NONE     0
 | 
      
         | 32 |  |  | #define DUMP_BINFO    1
 | 
      
         | 33 |  |  |  
 | 
      
         | 34 |  |  | /* Information about a node to be dumped.  */
 | 
      
         | 35 |  |  |  
 | 
      
         | 36 |  |  | typedef struct dump_node_info
 | 
      
         | 37 |  |  | {
 | 
      
         | 38 |  |  |   /* The index for the node.  */
 | 
      
         | 39 |  |  |   unsigned int index;
 | 
      
         | 40 |  |  |   /* Nonzero if the node is a binfo.  */
 | 
      
         | 41 |  |  |   unsigned int binfo_p : 1;
 | 
      
         | 42 |  |  | } *dump_node_info_p;
 | 
      
         | 43 |  |  |  
 | 
      
         | 44 |  |  | /* A dump_queue is a link in the queue of things to be dumped.  */
 | 
      
         | 45 |  |  |  
 | 
      
         | 46 |  |  | typedef struct dump_queue
 | 
      
         | 47 |  |  | {
 | 
      
         | 48 |  |  |   /* The queued tree node.  */
 | 
      
         | 49 |  |  |   splay_tree_node node;
 | 
      
         | 50 |  |  |   /* The next node in the queue.  */
 | 
      
         | 51 |  |  |   struct dump_queue *next;
 | 
      
         | 52 |  |  | } *dump_queue_p;
 | 
      
         | 53 |  |  |  
 | 
      
         | 54 |  |  | /* A dump_info gives information about how we should perform the dump
 | 
      
         | 55 |  |  |    and about the current state of the dump.  */
 | 
      
         | 56 |  |  |  
 | 
      
         | 57 |  |  | struct dump_info
 | 
      
         | 58 |  |  | {
 | 
      
         | 59 |  |  |   /* The stream on which to dump the information.  */
 | 
      
         | 60 |  |  |   FILE *stream;
 | 
      
         | 61 |  |  |   /* The original node.  */
 | 
      
         | 62 |  |  |   const_tree node;
 | 
      
         | 63 |  |  |   /* User flags.  */
 | 
      
         | 64 |  |  |   int flags;
 | 
      
         | 65 |  |  |   /* The next unused node index.  */
 | 
      
         | 66 |  |  |   unsigned int index;
 | 
      
         | 67 |  |  |   /* The next column.  */
 | 
      
         | 68 |  |  |   unsigned int column;
 | 
      
         | 69 |  |  |   /* The first node in the queue of nodes to be written out.  */
 | 
      
         | 70 |  |  |   dump_queue_p queue;
 | 
      
         | 71 |  |  |   /* The last node in the queue.  */
 | 
      
         | 72 |  |  |   dump_queue_p queue_end;
 | 
      
         | 73 |  |  |   /* Free queue nodes.  */
 | 
      
         | 74 |  |  |   dump_queue_p free_list;
 | 
      
         | 75 |  |  |   /* The tree nodes which we have already written out.  The
 | 
      
         | 76 |  |  |      keys are the addresses of the nodes; the values are the integer
 | 
      
         | 77 |  |  |      indices we assigned them.  */
 | 
      
         | 78 |  |  |   splay_tree nodes;
 | 
      
         | 79 |  |  | };
 | 
      
         | 80 |  |  |  
 | 
      
         | 81 |  |  | /* Dump the CHILD and its children.  */
 | 
      
         | 82 |  |  | #define dump_child(field, child) \
 | 
      
         | 83 |  |  |   queue_and_dump_index (di, field, child, DUMP_NONE)
 | 
      
         | 84 |  |  |  
 | 
      
         | 85 |  |  | extern void dump_pointer (dump_info_p, const char *, void *);
 | 
      
         | 86 |  |  | extern void dump_int (dump_info_p, const char *, int);
 | 
      
         | 87 |  |  | extern void dump_string (dump_info_p, const char *);
 | 
      
         | 88 |  |  | extern void dump_string_field (dump_info_p, const char *, const char *);
 | 
      
         | 89 |  |  | extern void dump_stmt (dump_info_p, const_tree);
 | 
      
         | 90 |  |  | extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int);
 | 
      
         | 91 |  |  | extern void queue_and_dump_type (dump_info_p, const_tree);
 | 
      
         | 92 |  |  | extern void dump_function (int, tree);
 | 
      
         | 93 |  |  | extern void dump_function_to_file (tree, FILE *, int);
 | 
      
         | 94 |  |  | extern void debug_function (tree, int);
 | 
      
         | 95 |  |  | extern int dump_flag (dump_info_p, int, const_tree);
 | 
      
         | 96 |  |  |  
 | 
      
         | 97 |  |  | extern unsigned int dump_register (const char *, const char *, const char *,
 | 
      
         | 98 |  |  |                                    int);
 | 
      
         | 99 |  |  |  
 | 
      
         | 100 |  |  |  
 | 
      
         | 101 |  |  | #endif /* ! GCC_TREE_DUMP_H */
 |