No functional changes. This patch adds a common tree writing function (pph_output_tree_ref_1) with an additional argument specifying what tracing level to use to trigger a tracer call.
Calls to pph_output_tree_or_ref() use a default tracing of 2. For callers that want to use different tracing levels, they need to call pph_output_tree_ref_1 directly. Tested on x86_64. Committed to pph. cp/ChangeLog.pph 2011-04-26 Diego Novillo <dnovi...@google.com> * pph-streamer.h (pph_output_tree_or_ref_1): New. (pph_output_tree_lst): Remove. Change all callers to call pph_output_tree_1 with a tracing level of 2. (pph_output_tree_aux): Remove. Change all callers to call pph_output_tree_1 with a tracing level of 3. (pph_output_tree_or_ref): Call pph_output_tree_or_ref_1 with a tracing level of 2. diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index 38c7bbe..a5670c3 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -244,9 +252,9 @@ pph_stream_write_ld_min (pph_stream *stream, struct lang_decl_min *ldm, gcc_assert (ldm->base.selector == 0); - pph_output_tree_or_ref (stream, ldm->template_info, ref_p); + pph_output_tree_or_ref_1 (stream, ldm->template_info, ref_p, 1); if (ldm->base.u2sel == 0) - pph_output_tree_or_ref (stream, ldm->u2.access, ref_p); + pph_output_tree_or_ref_1 (stream, ldm->u2.access, ref_p, 1); else if (ldm->base.u2sel == 1) pph_output_uint (stream, ldm->u2.discriminator); else @@ -787,11 +795,11 @@ pph_stream_write_tree (struct output_block *ob, tree expr, bool ref_p) pph_stream_write_lang_specific (stream, expr, ref_p); if (TREE_CODE (expr) == FUNCTION_DECL) - pph_output_tree_aux (stream, DECL_SAVED_TREE (expr), ref_p); + pph_output_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p, 3); } if (TREE_CODE (expr) == TYPE_DECL) - pph_output_tree_aux (stream, DECL_ORIGINAL_TYPE (expr), ref_p); + pph_output_tree_or_ref_1 (stream, DECL_ORIGINAL_TYPE (expr), ref_p, 3); } else if (TREE_CODE (expr) == STATEMENT_LIST) { @@ -806,7 +814,7 @@ pph_stream_write_tree (struct output_block *ob, tree expr, bool ref_p) /* Write the statements. */ for (i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i)) - pph_output_tree_aux (stream, tsi_stmt (i), ref_p); + pph_output_tree_or_ref_1 (stream, tsi_stmt (i), ref_p, 3); } else if (TYPE_P (expr)) pph_stream_write_lang_type (stream, expr, ref_p); @@ -855,7 +863,7 @@ pph_output_chain_filtered (pph_stream *stream, tree first, bool ref_p, saved_chain = TREE_CHAIN (t); TREE_CHAIN (t) = NULL_TREE; - pph_output_tree_lst (stream, t, ref_p); + pph_output_tree_or_ref_1 (stream, t, ref_p, 2); TREE_CHAIN (t) = saved_chain; } diff --git a/gcc/cp/pph-streamer.h b/gcc/cp/pph-streamer.h index e0040b2..5c5c2b9 100644 --- a/gcc/cp/pph-streamer.h +++ b/gcc/cp/pph-streamer.h @@ -138,33 +138,23 @@ pph_output_tree (pph_stream *stream, tree t, bool ref_p) lto_output_tree (stream->ob, t, ref_p); } -/* Output AST T to STREAM. If REF_P is true, output all the leaves of T - as references. This function is an list auxillary routine. */ -static inline void -pph_output_tree_lst (pph_stream *stream, tree t, bool ref_p) -{ - if (flag_pph_tracer >= 2) - pph_stream_trace_tree (stream, t, ref_p); - lto_output_tree (stream->ob, t, ref_p); -} - -/* Output AST T to STREAM. If REF_P is true, output all the leaves of T - as references. This function is an internal auxillary routine. */ +/* Output AST T to STREAM. If REF_P is true, output a reference to T. + If -fpph-tracer is set to TLEVEL or higher, T is sent to + pph_stream_trace_tree. */ static inline void -pph_output_tree_aux (pph_stream *stream, tree t, bool ref_p) +pph_output_tree_or_ref_1 (pph_stream *stream, tree t, bool ref_p, int tlevel) { - if (flag_pph_tracer >= 3) + if (flag_pph_tracer >= tlevel) pph_stream_trace_tree (stream, t, ref_p); - lto_output_tree (stream->ob, t, ref_p); + lto_output_tree_or_ref (stream->ob, t, ref_p); } -/* Output AST T to STREAM. If REF_P is true, output a reference to T. */ +/* Output AST T to STREAM. If REF_P is true, output a reference to T. + Trigger tracing at -fpph-tracer=2. */ static inline void pph_output_tree_or_ref (pph_stream *stream, tree t, bool ref_p) { - if (flag_pph_tracer >= 2) - pph_stream_trace_tree (stream, t, ref_p); - lto_output_tree_or_ref (stream->ob, t, ref_p); + pph_output_tree_or_ref_1 (stream, t, ref_p, 2); } /* Write an unsigned int VALUE to STREAM. */ -- This patch is available for review at http://codereview.appspot.com/4432071