From patchwork Mon Jun 27 20:33:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 102272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 47F65B6F68 for ; Tue, 28 Jun 2011 06:33:46 +1000 (EST) Received: (qmail 4440 invoked by alias); 27 Jun 2011 20:33:44 -0000 Received: (qmail 4423 invoked by uid 22791); 27 Jun 2011 20:33:42 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Jun 2011 20:33:27 +0000 Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id p5RKXQ6T021909; Mon, 27 Jun 2011 13:33:26 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by wpaz37.hot.corp.google.com with ESMTP id p5RKXO1V021470; Mon, 27 Jun 2011 13:33:24 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id 6600A1C1994; Mon, 27 Jun 2011 13:33:24 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Rename token cache and identifiers streaming functions to reflect pph naming scheme (issue4636065) Message-Id: <20110627203324.6600A1C1994@gchare.mtv.corp.google.com> Date: Mon, 27 Jun 2011 13:33:24 -0700 (PDT) From: gchare@google.com (Gabriel Charette) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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 --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;