Move several static inline functions from pph-streamer.h to pph-streamer-{out,in}.c. This is part 2 of several patches, and minimizes diffs.
Index: gcc/cp/ChangeLog.pph 2011-10-07 Lawrence Crowl <cr...@google.com> * pph-streamer.h (pph_in_chain): Moved to pph-streamer-in.c as extern. (pph_read_mergeable_tree): Make static in pph-streamer-in.c. (pph_read_mergeable_chain): Likewise (pph_in_mergeable_tree): Moved to pph-streamer-in.c as static. (pph_in_mergeable_chain): Likewise. (pph_in_bitpack): Likewise. (pph_in_chain): Likewise. (pph_out_location): Moved to pph-streamer-out.c extern. (pph_out_tree): Likewise. (pph_out_tree_1): Moved to pph-streamer-out.c as static. (pph_out_mergeable_tree): Likewise. (pph_tree_code_to_tag): Comment unused. (pph_tag_to_tree_code): Likewise. Index: gcc/cp/pph-streamer-in.c =================================================================== --- gcc/cp/pph-streamer-in.c (revision 179673) +++ gcc/cp/pph-streamer-in.c (working copy) @@ -208,6 +208,17 @@ pph_in_string (pph_stream *stream) } +/* Read a bitpack from STREAM. */ +static struct bitpack_d +pph_in_bitpack (pph_stream *stream) +{ + struct bitpack_d bp = streamer_read_bitpack (stream->encoder.r.ib); + if (flag_pph_tracer >= 4) + pph_trace_bitpack (stream, &bp); + return bp; +} + + /* Read and return a record marker from STREAM. On return, *TAG_P will contain the tag for the data type stored in this record. */ enum pph_record_marker @@ -608,6 +619,29 @@ pph_in_label_binding (pph_stream *stream } +/* Read a chain of ASTs from STREAM. */ +static tree +pph_in_chain (pph_stream *stream) +{ + tree t = streamer_read_chain (stream->encoder.r.ib, + stream->encoder.r.data_in); + if (flag_pph_tracer >= 2) + pph_trace_chain (stream, t); + return t; +} + + +static void pph_read_mergeable_chain (pph_stream *stream, tree* chain); + + +/* Read and merge a chain of ASTs from STREAM into an existing CHAIN. */ +static inline void +pph_in_mergeable_chain (pph_stream *stream, tree* chain) +{ + pph_read_mergeable_chain (stream, chain); +} + + /* Read and return an instance of cp_binding_level from STREAM. TO_REGISTER is used when the caller wants to read a binding level, but register a different binding level in the streaming cache. @@ -2389,15 +2423,27 @@ pph_in_tree (pph_stream *stream) return t; } + /* Read a mergeable tree from STREAM into CHAIN. */ -tree +static tree pph_read_mergeable_tree (pph_stream *stream, tree *chain) { return pph_read_any_tree (stream, chain); } +/* Load an AST in an ENCLOSING_NAMESPACE from STREAM. + Return the corresponding tree. */ +static void +pph_in_mergeable_tree (pph_stream *stream, tree *chain) +{ + tree t = pph_read_mergeable_tree (stream, chain); + if (flag_pph_tracer >= 3) + pph_trace_tree (stream, t); +} + + /* Read a chain of tree nodes from STREAM. */ void Index: gcc/cp/pph-streamer-out.c =================================================================== --- gcc/cp/pph-streamer-out.c (revision 179673) +++ gcc/cp/pph-streamer-out.c (working copy) @@ -204,6 +204,17 @@ pph_write_location (struct output_block } +/* Write location LOC of length to STREAM. */ + +void +pph_out_location (pph_stream *stream, location_t loc) +{ + if (flag_pph_tracer >= 4) + pph_trace_location (stream, loc); + pph_write_location (stream->encoder.w.ob, loc); +} + + /* Write a chain of ASTs to STREAM starting with FIRST. */ static void pph_out_chain (pph_stream *stream, tree first) @@ -609,6 +620,37 @@ pph_out_token_cache (pph_stream *f, cp_t pph_out_token (f, tok); } + +/* Output AST T to STREAM. If -fpph-tracer is set to TLEVEL or + higher, T is sent to pph_trace_tree. */ +static void +pph_out_tree_1 (pph_stream *stream, tree t, int tlevel) +{ + if (flag_pph_tracer >= tlevel) + pph_trace_tree (stream, t); + pph_write_tree (stream->encoder.w.ob, t, false); +} + +/* Output AST T to STREAM. Trigger tracing at -fpph-tracer=2. */ +void +pph_out_tree (pph_stream *stream, tree t) +{ + pph_out_tree_1 (stream, t, 2); +} + +static void pph_write_mergeable_tree (pph_stream *stream, tree expr); + +/* Output AST T from ENCLOSING_NAMESPACE to STREAM. + Trigger tracing at -fpph-tracer=2. */ +static void +pph_out_mergeable_tree (pph_stream *stream, tree t) +{ + if (flag_pph_tracer >= 2) + pph_trace_tree (stream, t); + pph_write_mergeable_tree (stream, t); +} + + /* Write all the fields in lang_decl_base instance LDB to OB. */ static void Index: gcc/cp/pph-streamer.h =================================================================== --- gcc/cp/pph-streamer.h (revision 179673) +++ gcc/cp/pph-streamer.h (working copy) @@ -336,7 +336,9 @@ unsigned pph_get_signature (tree, size_t void pph_flush_buffers (pph_stream *); void pph_init_write (pph_stream *); void pph_write_tree (struct output_block *, tree, bool); +#if 0 void pph_write_mergeable_tree (pph_stream *, tree); +#endif void pph_write_mergeable_chain (pph_stream *, tree); void pph_add_decl_to_symtab (tree, enum pph_symtab_action, bool, bool); void pph_add_include (pph_stream *); @@ -352,8 +354,10 @@ struct binding_table_s *pph_in_binding_t /* In pph-streamer-in.c. */ void pph_init_read (pph_stream *); tree pph_read_tree (struct lto_input_block *, struct data_in *); +#if 0 tree pph_read_mergeable_tree (pph_stream *, tree *); void pph_read_mergeable_chain (pph_stream *, tree *); +#endif location_t pph_read_location (struct lto_input_block *, struct data_in *); void pph_read_file (const char *); void pph_reader_finish (void); @@ -440,6 +444,7 @@ pph_cache_find (pph_stream *stream, enum } +#if 0 /* Output AST T to STREAM. If -fpph-tracer is set to TLEVEL or higher, T is sent to pph_trace_tree. */ static inline void @@ -466,6 +471,9 @@ pph_out_mergeable_tree (pph_stream *stre pph_trace_tree (stream, t); pph_write_mergeable_tree (stream, t); } +#else +extern void pph_out_tree (pph_stream *stream, tree t); +#endif #if 0 /* Write an unsigned int VALUE to STREAM. */ @@ -534,6 +542,7 @@ pph_out_string_with_length (pph_stream * extern void pph_out_uint (pph_stream *stream, unsigned int value); #endif +#if 0 /* Write location LOC of length to STREAM. */ static inline void pph_out_location (pph_stream *stream, location_t loc) @@ -542,6 +551,9 @@ pph_out_location (pph_stream *stream, lo pph_trace_location (stream, loc); pph_write_location (stream->encoder.w.ob, loc); } +#else +extern void pph_out_location (pph_stream *stream, location_t loc); +#endif #if 0 /* Write a chain of ASTs to STREAM starting with FIRST. */ @@ -661,6 +673,7 @@ extern location_t pph_in_location (pph_s extern tree pph_in_tree (pph_stream *stream); #endif +#if 0 /* Load an AST in an ENCLOSING_NAMESPACE from STREAM. Return the corresponding tree. */ static inline void @@ -698,6 +711,7 @@ pph_in_bitpack (pph_stream *stream) pph_trace_bitpack (stream, &bp); return bp; } +#endif #if 0 /* Write record MARKER for data type TAG to STREAM. */ @@ -785,6 +799,7 @@ pph_tag_is_tree_code (enum pph_tag tag) } /* Return the PPH tag associated with tree node T. */ +/* FIXME pph: apparently unused, except just below. */ static inline enum pph_tag pph_tree_code_to_tag (tree t) { @@ -792,6 +807,7 @@ pph_tree_code_to_tag (tree t) } /* Return the tree code associated with PPH tag TAG. */ +/* FIXME pph: apparently unused. */ static inline enum tree_code pph_tag_to_tree_code (enum pph_tag tag) { -- This patch is available for review at http://codereview.appspot.com/5250042