@@ -584,10 +584,10 @@ extern const char *pch_file;
extern const char *pph_out_file;
-/* Query if we have any map from INCLUDE to PPH file. */
+/* Return true if we have any map from INCLUDE to PPH file. */
extern bool
-query_have_pph_map (void);
+pph_reader_enabled_p (void);
/* Query for a mapping from an INCLUDE to a PPH file.
Return the filename, without ownership.
@@ -129,13 +129,13 @@ static void c_finish_options (void);
#endif
/* Mappings from include directive to PPH file. */
+static strstrmap_t *include_pph_mapping;
-strstrmap_t *include_pph_mapping;
-/* Query if we have any map from INCLUDE to PPH file. */
+/* Return true if we have any map from INCLUDE to PPH file. */
bool
-query_have_pph_map (void)
+pph_reader_enabled_p (void)
{
return include_pph_mapping != NULL;
}
@@ -342,7 +342,7 @@ cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) $(REAL_H) \
cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \
gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \
c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR.H) \
- $(CXX_PPH_H)
+ $(CXX_PPH_H) $(CXX_PPH_STREAMER_H)
cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \
$(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H)
cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -5906,7 +5906,7 @@ cp_rest_of_decl_compilation (tree decl, int top_level, int at_end)
rest_of_decl_compilation (decl, top_level, at_end);
/* If we are generating a PPH image, add DECL to its symbol table. */
- if (pph_out_file)
+ if (pph_writer_enabled_p ())
pph_add_decl_to_symtab (decl, PPH_SYMTAB_DECLARE, top_level, at_end);
}
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "cpplib.h"
#include "pph.h"
+#include "pph-streamer.h"
#include "tree.h"
#include "cp-tree.h"
#include "intl.h"
@@ -1669,7 +1669,7 @@ pph_read_file_1 (pph_stream *stream)
/* If we are generating an image, the PPH contents we just read from
STREAM will need to be read again the next time we want to read
the image we are now generating. */
- if (pph_out_file && !pph_reading_includes)
+ if (pph_writer_enabled_p () && !pph_reading_includes)
pph_add_include (stream);
}
@@ -281,6 +281,21 @@ extern void pph_in_spec_entry_tables (pph_stream *stream);
/* Inline functions. */
+/* Return true if we are generating a PPH image. */
+static inline bool
+pph_writer_enabled_p (void)
+{
+ return pph_out_file != NULL;
+}
+
+/* Return true if PPH has been enabled. */
+static inline bool
+pph_enabled_p (void)
+{
+ return pph_writer_enabled_p () || pph_reader_enabled_p ();
+}
+
+
/* Output array A of cardinality C of ASTs to STREAM. */
/* FIXME pph: hold for alternate routine. */
#if 0
@@ -186,7 +186,7 @@ pph_init (void)
gcc_assert (table == NULL);
/* If we are generating a PPH file, initialize the writer. */
- if (pph_out_file != NULL)
+ if (pph_writer_enabled_p ())
pph_writer_init ();
pph_init_preloaded_cache ();
@@ -56,13 +56,6 @@ typedef struct cp_token_hunk *cp_token_hunk_ptr;
DEF_VEC_P (cp_token_hunk_ptr);
DEF_VEC_ALLOC_P (cp_token_hunk_ptr,gc);
-/* Return true if PPH has been enabled. */
-static inline bool
-pph_enabled_p (void)
-{
- return pph_out_file != NULL || query_have_pph_map ();
-}
-
/* Global state. FIXME pph, get rid of these. */
/* Log file where PPH analysis is written to. Controlled by
@@ -3571,7 +3571,7 @@ bool
expand_or_defer_fn_1 (tree fn)
{
/* If we are generating a PPH image, add FN to its symbol table. */
- if (pph_out_file)
+ if (pph_writer_enabled_p ())
pph_add_decl_to_symtab (fn, PPH_SYMTAB_EXPAND, false, at_eof);
/* When the parser calls us after finishing the body of a template