diff mbox

[pph] Rename token cache and identifiers streaming functions to reflect pph naming scheme (issue4636065)

Message ID 20110627203324.6600A1C1994@gchare.mtv.corp.google.com
State New
Headers show

Commit Message

Gab Charette June 27, 2011, 8:33 p.m. UTC
Renamed all functions to reflect pph naming schemes (pph_in/out_*).

Also reordered parameters so that the first parameter is always pph_stream*

Tested with bootstrap and pph regression testing.

2011-06-27  Gabriel Charette  <gchare@google.com>

	* pph-streamer-in.c (pph_get_type_from_index):
	Rename from pth_get_type_from_index. Update all users.
	(pph_in_number): Rename from pth_load_number.
	Update all users.
	(pph_in_token_value): Rename from pth_load_token_value. Change
	signature to 'pph_stream*, cp_token*' from 'cp_token*, pph_stream*'.
	Update all users.
	(pph_in_token): Rename from pth_load_token.
	Update all users.
	(pph_in_token_cache): Rename from pth_load_token_cache.
	Update all users.
	(pph_in_identifiers): Rename from pth_load_identifiers. Change
	signature to 'pph_stream*, cpp_idents_used*' from
	'cpp_idents_used*, pph_stream*'.
	from (cpp_idents_used*, pph_stream*).
	Update all users.
	* pph-streamer-out.c (pph_get_index_from_type):
	Rename from pth_get_index_from_type.
	Update all users.
	(pph_out_number): Rename from pth_write_number.
	Update all users.
	(pph_out_token_value): Rename from pth_save_token_value.
	Update all users.
	(pph_out_token): Rename from pth_save_token. Change signature to
	'pph_stream*, cp_token*' from 'cp_token*, pph_stream*'.
	Update all users.
	(pph_out_token_cache): Rename from pth_save_token_cache. Change
	signature to 'pph_stream*, cp_token_cache*'
	from 'cp_token_cache*, pph_stream*'.
	Update all users.
	(pph_out_identifiers): Rename from pth_save_identifiers. Change
	signature to 'pph_stream*, cpp_idents_used*' from
	'cpp_idents_used*, pph_stream*'.
	Update all users.


--
This patch is available for review at http://codereview.appspot.com/4636065
diff mbox

Patch

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 6743c3c..93b5685 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -246,7 +246,7 @@  pph_register_shared_data (pph_stream *stream, void *data, unsigned ix)
    return a type from integer_types or global_trees.  */
 
 static tree
-pth_get_type_from_index (unsigned type_idx, unsigned type_kind)
+pph_get_type_from_index (unsigned type_idx, unsigned type_kind)
 {
   if (type_kind == CPP_N_INTEGER)
     return integer_types[type_idx];
@@ -266,7 +266,7 @@  pth_get_type_from_index (unsigned type_idx, unsigned type_kind)
 /* Load a numeric value from file F.  Return the corresponding tree.  */
 
 static tree
-pth_load_number (pph_stream *f)
+pph_in_number (pph_stream *f)
 {
   unsigned type_idx, type_kind;
   tree type, val;
@@ -274,7 +274,7 @@  pth_load_number (pph_stream *f)
   type_idx = pph_in_uint (f);
   type_kind = pph_in_uint (f);
 
-  type = pth_get_type_from_index (type_idx, type_kind);
+  type = pph_get_type_from_index (type_idx, type_kind);
 
   if (type_kind == CPP_N_INTEGER)
     {
@@ -296,8 +296,8 @@  pth_load_number (pph_stream *f)
     }
   else if (type_kind == CPP_N_IMAGINARY)
     {
-      tree r = pth_load_number (f);
-      tree i = pth_load_number (f);
+      tree r = pph_in_number (f);
+      tree i = pph_in_number (f);
       val = build_complex (NULL_TREE, r, i);
     }
   else
@@ -310,7 +310,7 @@  pth_load_number (pph_stream *f)
 /* Load the tree value associated with TOKEN to file F.  */
 
 static void
-pth_load_token_value (cp_token *token, pph_stream *f)
+pph_in_token_value (pph_stream *f, cp_token *token)
 {
   const char *str;
 
@@ -334,7 +334,7 @@  pth_load_token_value (cp_token *token, pph_stream *f)
       case CPP_CHAR16:
       case CPP_CHAR32:
       case CPP_NUMBER:
-	token->u.value = pth_load_number (f);
+	token->u.value = pph_in_number (f);
 	break;
 
       case CPP_STRING:
@@ -359,7 +359,7 @@  pth_load_token_value (cp_token *token, pph_stream *f)
 /* Read and return a token from STREAM.  */
 
 static cp_token *
-pth_load_token (pph_stream *stream)
+pph_in_token (pph_stream *stream)
 {
   cp_token *token = ggc_alloc_cleared_cp_token ();
 
@@ -373,8 +373,8 @@  pth_load_token (pph_stream *stream)
      confusing the rest of the compiler for now.  */
   token->location = input_location;
 
-  /* FIXME pph: verify that pth_load_token_value works with no tokens.  */
-  pth_load_token_value (token, stream);
+  /* FIXME pph: verify that pph_in_token_value works with no tokens.  */
+  pph_in_token_value (stream, token);
 
   return token;
 }
@@ -383,7 +383,7 @@  pth_load_token (pph_stream *stream)
 /* Read and return a cp_token_cache instance from STREAM.  */
 
 static cp_token_cache *
-pth_load_token_cache (pph_stream *stream)
+pph_in_token_cache (pph_stream *stream)
 {
   unsigned i, num;
   cp_token *first, *last;
@@ -391,7 +391,7 @@  pth_load_token_cache (pph_stream *stream)
   num = pph_in_uint (stream);
   for (last = first = NULL, i = 0; i < num; i++)
     {
-      last = pth_load_token (stream);
+      last = pph_in_token (stream);
       if (first == NULL)
 	first = last;
     }
@@ -761,7 +761,7 @@  pph_in_ld_fn (pph_stream *stream, struct lang_decl_fn *ldf)
     gcc_unreachable ();
 
   if (ldf->pending_inline_p == 1)
-    ldf->u.pending_inline_info = pth_load_token_cache (stream);
+    ldf->u.pending_inline_info = pph_in_token_cache (stream);
   else if (ldf->pending_inline_p == 0)
     ldf->u.saved_language_function = pph_in_language_function (stream);
 }
@@ -1222,7 +1222,7 @@  report_validation_error (const char *filename,
 /* Load the IDENTIFERS for a hunk from a STREAM.  */
 
 static void
-pth_load_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
+pph_in_identifiers (pph_stream *stream, cpp_idents_used *identifiers)
 {
   unsigned int j;
   unsigned int max_ident_len, max_value_len, num_entries;
@@ -1302,7 +1302,7 @@  pph_read_file_contents (pph_stream *stream)
   const char *cur_def;
   cpp_idents_used idents_used;
 
-  pth_load_identifiers (&idents_used, stream);
+  pph_in_identifiers (stream, &idents_used);
 
   /* FIXME pph: This validation is weak.  */
   verified = cpp_lt_verify_1 (parse_in, &idents_used, &bad_use, &cur_def, true);
@@ -1529,7 +1529,7 @@  pph_read_tree (struct lto_input_block *ib ATTRIBUTE_UNUSED,
 
     case DEFAULT_ARG:
       pph_in_tree_common (stream, expr);
-      DEFARG_TOKENS (expr) = pth_load_token_cache (stream);
+      DEFARG_TOKENS (expr) = pph_in_token_cache (stream);
       DEFARG_INSTANTIATIONS (expr) = pph_in_tree_vec (stream);
       break;
 
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index 2811207..045f68a 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -237,7 +237,7 @@  pph_out_start_record (pph_stream *stream, void *data)
    CPP_N_FLOATING, etc) is saved in CATEGORY_P.  */
 
 static void
-pth_get_index_from_type (tree type, unsigned *type_ix_p, unsigned *category_p)
+pph_get_index_from_type (tree type, unsigned *type_ix_p, unsigned *category_p)
 {
   void **val_p;
   static struct pointer_map_t *type_cache = NULL;
@@ -301,11 +301,11 @@  pth_get_index_from_type (tree type, unsigned *type_ix_p, unsigned *category_p)
 /* Save the number VAL to file F.  */
 
 static void
-pth_write_number (pph_stream *f, tree val)
+pph_out_number (pph_stream *f, tree val)
 {
   unsigned type_idx, type_kind;
 
-  pth_get_index_from_type (TREE_TYPE (val), &type_idx, &type_kind);
+  pph_get_index_from_type (TREE_TYPE (val), &type_idx, &type_kind);
 
   pph_out_uint (f, type_idx);
   pph_out_uint (f, type_kind);
@@ -330,8 +330,8 @@  pth_write_number (pph_stream *f, tree val)
     }
   else if (type_kind == CPP_N_IMAGINARY)
     {
-      pth_write_number (f, TREE_REALPART (val));
-      pth_write_number (f, TREE_IMAGPART (val));
+      pph_out_number (f, TREE_REALPART (val));
+      pph_out_number (f, TREE_IMAGPART (val));
     }
   else
     gcc_unreachable ();
@@ -341,7 +341,7 @@  pth_write_number (pph_stream *f, tree val)
 /* Save the tree associated with TOKEN to file F.  */
 
 static void
-pth_save_token_value (pph_stream *f, cp_token *token)
+pph_out_token_value (pph_stream *f, cp_token *token)
 {
   const char *str;
   unsigned len;
@@ -371,7 +371,7 @@  pth_save_token_value (pph_stream *f, cp_token *token)
       case CPP_CHAR16:
       case CPP_CHAR32:
       case CPP_NUMBER:
-	pth_write_number (f, val);
+	pph_out_number (f, val);
 	break;
 
       case CPP_STRING:
@@ -398,7 +398,7 @@  pth_save_token_value (pph_stream *f, cp_token *token)
 /* Save TOKEN on file F.  Return the number of bytes written on F.  */
 
 static void
-pth_save_token (cp_token *token, pph_stream *f)
+pph_out_token (pph_stream *f, cp_token *token)
 {
   /* Do not write out the final field in TOKEN.  It contains
      pointers that need to be pickled separately.
@@ -406,14 +406,14 @@  pth_save_token (cp_token *token, pph_stream *f)
      FIXME pph - Need to also emit the location_t table so we can
      reconstruct it when reading the PTH state.  */
   pph_out_bytes (f, token, sizeof (cp_token) - sizeof (void *));
-  pth_save_token_value (f, token);
+  pph_out_token_value (f, token);
 }
 
 
 /* Save all the tokens in CACHE to PPH stream F.  */
 
 static void
-pth_save_token_cache (cp_token_cache *cache, pph_stream *f)
+pph_out_token_cache (pph_stream *f, cp_token_cache *cache)
 {
   unsigned i, num;
   cp_token *tok;
@@ -429,7 +429,7 @@  pth_save_token_cache (cp_token_cache *cache, pph_stream *f)
 
   pph_out_uint (f, num);
   for (i = 0, tok = cache->first; i < num; tok++, i++)
-    pth_save_token (tok, f);
+    pph_out_token (f, tok);
 }
 
 /* Write all the fields in lang_decl_base instance LDB to OB.  */
@@ -789,7 +789,7 @@  pph_out_ld_fn (pph_stream *stream, struct lang_decl_fn *ldf,
     gcc_unreachable ();
 
   if (ldf->pending_inline_p == 1)
-    pth_save_token_cache (ldf->u.pending_inline_info, stream);
+    pph_out_token_cache (stream, ldf->u.pending_inline_info);
   else if (ldf->pending_inline_p == 0)
     pph_out_language_function (stream, ldf->u.saved_language_function,
 					ref_p);
@@ -1144,7 +1144,7 @@  pph_out_scope_chain (pph_stream *stream, struct saved_scope *ss, bool ref_p)
 /* Save the IDENTIFIERS to the STREAM.  */
 
 static void
-pth_save_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
+pph_out_identifiers (pph_stream *stream, cpp_idents_used *identifiers)
 {
   unsigned int num_entries, active_entries, id;
 
@@ -1196,7 +1196,7 @@  pth_save_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
 static void
 pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used)
 { 
-  pth_save_identifiers (idents_used, stream);
+  pph_out_identifiers (stream, idents_used);
   pph_out_scope_chain (stream, scope_chain, false);
   if (flag_pph_dump_tree)
     pph_dump_namespace (pph_logfile, global_namespace);
@@ -1424,7 +1424,7 @@  pph_write_tree (struct output_block *ob, tree expr, bool ref_p)
 
     case DEFAULT_ARG:
       pph_out_tree_common (stream, expr, ref_p);
-      pth_save_token_cache (DEFARG_TOKENS (expr), stream);
+      pph_out_token_cache (stream, DEFARG_TOKENS (expr));
       pph_out_tree_vec (stream, DEFARG_INSTANTIATIONS (expr), ref_p);
       break;