From b7442fb5553f2ea9d738e5f2a1177c655baa442d Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 5 Jun 2001 08:03:45 +0000 Subject: 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 --- gcc/cp/optimize.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'gcc/cp/optimize.c') diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 8676dd8..aee64f5 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -100,6 +100,7 @@ static void remap_block PARAMS ((tree, tree, inline_data *)); static void copy_scope_stmt PARAMS ((tree *, int *, inline_data *)); static tree calls_setjmp_r PARAMS ((tree *, int *, void *)); static void update_cloned_parm PARAMS ((tree, tree)); +static void dump_function PARAMS ((enum tree_dump_index, tree)); /* The approximate number of instructions per statement. This number need not be particularly accurate; it is used only to make @@ -933,12 +934,14 @@ expand_calls_inline (tp, id) walk_tree (tp, expand_call_inline, id, id->tree_pruner); } -/* Optimize the body of FN. */ +/* Optimize the body of FN. */ void optimize_function (fn) tree fn; { + dump_function (TDI_original, fn); + /* While in this function, we may choose to go off and compile another function. For example, we might instantiate a function in the hopes of inlining it. Normally, that wouldn't trigger any @@ -1010,6 +1013,8 @@ optimize_function (fn) /* Undo the call to ggc_push_context above. */ --function_depth; + + dump_function (TDI_optimized, fn); } /* Called from calls_setjmp_p via walk_tree. */ @@ -1225,3 +1230,26 @@ maybe_clone_body (fn) /* We don't need to process the original function any further. */ return 1; } + +/* Dump FUNCTION_DECL FN as tree dump PHASE. */ + +static void +dump_function (phase, fn) + enum tree_dump_index phase; + tree fn; +{ + FILE *stream; + int flags; + + stream = dump_begin (phase, &flags); + if (stream) + { + fprintf (stream, "\n;; Function %s", + decl_as_string (fn, TFF_DECL_SPECIFIERS)); + fprintf (stream, " (%s)", decl_as_string (DECL_ASSEMBLER_NAME (fn), 0)); + fprintf (stream, "\n\n"); + + dump_node (fn, TDF_SLIM | flags, stream); + dump_end (phase, stream); + } +} -- cgit v1.1