tree-dump.h 2.8 KB

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