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