2000-11-10 11:29:34 -05:00
|
|
|
/* Tree-dumping functionality for intermediate representation.
|
|
|
|
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
|
|
|
Written by Mark Mitchell <mark@codesourcery.com>
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
2001-05-25 21:31:47 -04:00
|
|
|
#ifndef GCC_C_DUMP_H
|
|
|
|
#define GCC_C_DUMP_H
|
|
|
|
|
2000-11-10 11:29:34 -05:00
|
|
|
/* Flags used with queue functions. */
|
|
|
|
#define DUMP_NONE 0
|
|
|
|
#define DUMP_BINFO 1
|
|
|
|
|
|
|
|
/* Information about a node to be dumped. */
|
|
|
|
|
|
|
|
typedef struct dump_node_info
|
|
|
|
{
|
|
|
|
/* The index for the node. */
|
|
|
|
unsigned int index;
|
|
|
|
/* Nonzero if the node is a binfo. */
|
|
|
|
unsigned int binfo_p : 1;
|
|
|
|
} *dump_node_info_p;
|
|
|
|
|
|
|
|
/* A dump_queue is a link in the queue of things to be dumped. */
|
|
|
|
|
|
|
|
typedef struct dump_queue
|
|
|
|
{
|
|
|
|
/* The queued tree node. */
|
|
|
|
splay_tree_node node;
|
|
|
|
/* The next node in the queue. */
|
|
|
|
struct dump_queue *next;
|
|
|
|
} *dump_queue_p;
|
|
|
|
|
|
|
|
/* A dump_info gives information about how we should perform the dump
|
|
|
|
and about the current state of the dump. */
|
|
|
|
|
|
|
|
struct dump_info
|
|
|
|
{
|
|
|
|
/* The stream on which to dump the information. */
|
|
|
|
FILE *stream;
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 04:03:45 -04:00
|
|
|
/* The original node. */
|
|
|
|
tree node;
|
|
|
|
/* User flags. */
|
|
|
|
int flags;
|
2000-11-10 11:29:34 -05:00
|
|
|
/* The next unused node index. */
|
|
|
|
unsigned int index;
|
|
|
|
/* The next column. */
|
|
|
|
unsigned int column;
|
|
|
|
/* The first node in the queue of nodes to be written out. */
|
|
|
|
dump_queue_p queue;
|
|
|
|
/* The last node in the queue. */
|
|
|
|
dump_queue_p queue_end;
|
|
|
|
/* Free queue nodes. */
|
|
|
|
dump_queue_p free_list;
|
|
|
|
/* The tree nodes which we have already written out. The
|
|
|
|
keys are the addresses of the nodes; the values are the integer
|
|
|
|
indices we assigned them. */
|
|
|
|
splay_tree nodes;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Dump the CHILD and its children. */
|
|
|
|
#define dump_child(field, child) \
|
|
|
|
queue_and_dump_index (di, field, child, DUMP_NONE)
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 04:03:45 -04:00
|
|
|
extern void dump_pointer
|
|
|
|
PARAMS ((dump_info_p, const char *, void *));
|
2000-11-10 11:29:34 -05:00
|
|
|
extern void dump_int
|
|
|
|
PARAMS ((dump_info_p, const char *, int));
|
|
|
|
extern void dump_string
|
|
|
|
PARAMS ((dump_info_p, const char *));
|
|
|
|
extern void dump_stmt
|
|
|
|
PARAMS ((dump_info_p, tree));
|
|
|
|
extern void dump_next_stmt
|
|
|
|
PARAMS ((dump_info_p, tree));
|
|
|
|
extern void queue_and_dump_index
|
|
|
|
PARAMS ((dump_info_p, const char *, tree, int));
|
|
|
|
extern void queue_and_dump_type
|
|
|
|
PARAMS ((dump_info_p, tree));
|
2001-05-25 21:31:47 -04:00
|
|
|
|
|
|
|
#endif /* ! GCC_C_DUMP_H */
|