This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pph] Debug Cleanup (issue4380046)


Move use of flag_pph_debug to the new flag_pph_decls_debug for the
declaration dependence analysis.  This code should be dead, but we'll
preserve until we know for sure.

Split pph_output_tree into pph_output_tree and pph_output_tree_aux.
The former is the primary external interface, and pph_output_tree_aux
is the internal (recursive) auxillary, which is used for function
bodies.

Add a unsigned integer parameter to -fpph-tracer with the semantics
1=external 2=trees/chains 3=auxillary(statments) 4=strings/ints.

Index: gcc/c-family/ChangeLog.pph

2011-04-08  Lawrence Crowl  <crowl@google.com>

	* c.opt (fpph-decls-debug): Add.
	(fpph-tracer): Add unsigned integer parameter.
		

Index: gcc/cp/ChangeLog.pph

2011-04-08  Lawrence Crowl  <crowl@google.com>

        * pph.c (*): Change use of flag_pph_debug to flag_pph_decls_debug
	for declaration dependence analysis.
	(pth_finish): Simplify inconsistency reporting.
	* name-lookup.c (add_decl_to_level): Change use of flag_pph_debug to
	flag_pph_decls_debug for declaration dependence analysis.
	* parser.c (cp_parser_elaborated_type_specifier): Change use of
	flag_pph_debug to flag_pph_decls_debug for declaration dependence
	analysis.
	* pph-streamer.h (pph_output_tree_aux): New.
	(*): Compare flag_pph_tracer against value.
	(pph_output_*): Ensure trace happens before write.
	(pph_output_string_with_length): Add trace for null case.
	


Index: gcc/c-family/c.opt
===================================================================
*** gcc/c-family/c.opt	(revision 172203)
--- gcc/c-family/c.opt	(working copy)
*************** fpph-decls=
*** 933,938 ****
--- 933,942 ----
  C++ Joined RejectNegative UInteger Var(flag_pph_decls)
  -fpph-decls=N   Enable declaration identifier output at level N from PPH support
  
+ fpph-decls-debug=
+ C++ Joined RejectNegative UInteger Var(flag_pph_decls_debug)
+ -fpph-decls=N   Enable declaration identifier output at level N from PPH support
+ 
  fpph-hdr=
  C++ ObjC++ Joined MissingArgError(missing filename after %qs)
  -fpph-hdr=<base-name>   A mapping from <base-name>.h to <base-name>.pph
*************** fpph-stats
*** 949,956 ****
  C++ Var(flag_pph_stats)
  -fpph-stats	Enable statistics gathering for PPH
  
! fpph-tracer
! C++ Var(flag_pph_tracer)
  -fpph-tracer	Enable tracing of PPH streaming operations
  
  fpreprocessed
--- 953,960 ----
  C++ Var(flag_pph_stats)
  -fpph-stats	Enable statistics gathering for PPH
  
! fpph-tracer=
! C++ Joined RejectNegative UInteger Var(flag_pph_tracer)
  -fpph-tracer	Enable tracing of PPH streaming operations
  
  fpreprocessed
Index: gcc/cp/pph.c
===================================================================
*** gcc/cp/pph.c	(revision 172204)
--- gcc/cp/pph.c	(working copy)
*************** pth_finish (void)
*** 2172,2182 ****
       due to lack of location information in PTH images.  FIXME pph:
       Unneeded after we start saving proper location information.  */
    if (flag_pph_debug >= 1)
!     {
!       if (flag_pph_debug > 1)
! 	fprintf (stderr, "*** WARNING: Not saving PTH images because PPH "
! 		 "is enabled\n");
!     }
    else
      {
        pth_state *state;
--- 2172,2179 ----
       due to lack of location information in PTH images.  FIXME pph:
       Unneeded after we start saving proper location information.  */
    if (flag_pph_debug >= 1)
!     fprintf (stderr, "*** WARNING: Not saving PTH images because PPH "
! 	     "is enabled\n");
    else
      {
        pth_state *state;
*************** pth_finish (void)
*** 2194,2200 ****
  static void
  pph_log_exposed (cp_parser *parser, const char *end)
  {
!   if (flag_pph_debug >= 2)
      {
        cp_token *pos = cp_lexer_token_position (parser->lexer, false);
        fprintf (pph_logfile, "PPH: %s exposed declaration at ", end);
--- 2191,2197 ----
  static void
  pph_log_exposed (cp_parser *parser, const char *end)
  {
!   if (flag_pph_decls_debug >= 2)
      {
        cp_token *pos = cp_lexer_token_position (parser->lexer, false);
        fprintf (pph_logfile, "PPH: %s exposed declaration at ", end);
*************** pph_free_catcher_memory (void)
*** 2259,2269 ****
  cp_token *
  pph_start_exposed (cp_parser *parser)
  {
!   if (flag_pph_debug >= 2)
      {
        timevar_push (TV_PPH_MANAGE);
  
!       if (flag_pph_debug >= 4)
          fprintf (pph_logfile, "\n--------------------------------------------------------------------------\n");
        pph_log_exposed (parser, "start");
        pph_allocate_catcher_memory ();
--- 2256,2266 ----
  cp_token *
  pph_start_exposed (cp_parser *parser)
  {
!   if (flag_pph_decls_debug >= 2)
      {
        timevar_push (TV_PPH_MANAGE);
  
!       if (flag_pph_decls_debug >= 4)
          fprintf (pph_logfile, "\n--------------------------------------------------------------------------\n");
        pph_log_exposed (parser, "start");
        pph_allocate_catcher_memory ();
*************** pph_copy_decls_outof_cache (VEC(tree, he
*** 2474,2480 ****
  void
  pph_stop_exposed (cp_parser *parser, cp_token *first_token)
  {
!   if (flag_pph_debug >= 2 && !VEC_empty (tree, pph_tree_catcher))
      {
        cp_token *last_token;
  
--- 2471,2477 ----
  void
  pph_stop_exposed (cp_parser *parser, cp_token *first_token)
  {
!   if (flag_pph_decls_debug >= 2 && !VEC_empty (tree, pph_tree_catcher))
      {
        cp_token *last_token;
  
*************** pph_stop_exposed (cp_parser *parser, cp_
*** 2486,2492 ****
        pph_copy_decls_outof_cache (pph_tree_catcher);
        PPH_STATS_INCR (cached_refs, VEC_length(tree, pph_name_lookups));
        pph_free_catcher_memory ();
!       if (flag_pph_debug >= 4)
          pph_log_exposed (parser, "stop");
  
        timevar_pop (TV_PPH_MANAGE);
--- 2483,2489 ----
        pph_copy_decls_outof_cache (pph_tree_catcher);
        PPH_STATS_INCR (cached_refs, VEC_length(tree, pph_name_lookups));
        pph_free_catcher_memory ();
!       if (flag_pph_decls_debug >= 4)
          pph_log_exposed (parser, "stop");
  
        timevar_pop (TV_PPH_MANAGE);
*************** is_namespace (tree container)
*** 2727,2733 ****
  static tree
  pph_null_exposed (const char *reason)
  {
!   if (flag_pph_debug >= 3)
      fprintf (pph_logfile, "%s\n", reason);
    return NULL;
  }
--- 2724,2730 ----
  static tree
  pph_null_exposed (const char *reason)
  {
!   if (flag_pph_decls_debug >= 3)
      fprintf (pph_logfile, "%s\n", reason);
    return NULL;
  }
*************** pph_live_exposed (tree t, bool body)
*** 2738,2744 ****
    if (PPH_ARTIFICIAL (t))
      return pph_null_exposed ("Artificial symbols are not exposed.");
  
!   if (flag_pph_debug >= 3)
      {
        if (t == NULL)
          fprintf (pph_logfile, "(null)");
--- 2735,2741 ----
    if (PPH_ARTIFICIAL (t))
      return pph_null_exposed ("Artificial symbols are not exposed.");
  
!   if (flag_pph_decls_debug >= 3)
      {
        if (t == NULL)
          fprintf (pph_logfile, "(null)");
*************** pph_find_exposed_for (tree t, bool *body
*** 2764,2770 ****
            PPH_STATS_INCR (bad_lookups, 1);
            return pph_null_exposed ("NULLOID"); /* FIXME pph */
          }
!       if (flag_pph_debug >= 3)
          {
            fprintf (pph_logfile, "      exposed for ");
            pph_debug_tree (t, false);
--- 2761,2767 ----
            PPH_STATS_INCR (bad_lookups, 1);
            return pph_null_exposed ("NULLOID"); /* FIXME pph */
          }
!       if (flag_pph_decls_debug >= 3)
          {
            fprintf (pph_logfile, "      exposed for ");
            pph_debug_tree (t, false);
*************** pph_find_exposed_for (tree t, bool *body
*** 2871,2877 ****
                if (generic != 2)
                  {
                    t = DECL_TEMPLATE_RESULT (t);
!                   if (flag_pph_debug >= 3)
                      fprintf (pph_logfile, "template redirected\n");
                    goto reclassify;
                  }
--- 2868,2874 ----
                if (generic != 2)
                  {
                    t = DECL_TEMPLATE_RESULT (t);
!                   if (flag_pph_decls_debug >= 3)
                      fprintf (pph_logfile, "template redirected\n");
                    goto reclassify;
                  }
*************** pph_find_exposed_for (tree t, bool *body
*** 2919,2925 ****
                break;
              }
          }
!       if (flag_pph_debug >= 3)
          {
            pph_debug_tree (container, *body);
            fprintf (pph_logfile, "\n");
--- 2916,2922 ----
                break;
              }
          }
!       if (flag_pph_decls_debug >= 3)
          {
            pph_debug_tree (container, *body);
            fprintf (pph_logfile, "\n");
*************** pph_locate_name_lookups_in (VEC(cp_token
*** 3069,3075 ****
                /* Avoid double-counting lookups by removing the lookup
                   location after a class member declaration has found it.
                   To make that work, we must remove all redundant entries.  */
!               if (flag_pph_debug >= 4)
                  {
                    fprintf (pph_logfile, "      lookup in %p for ",
                             (void*)lookup_locations);
--- 3066,3072 ----
                /* Avoid double-counting lookups by removing the lookup
                   location after a class member declaration has found it.
                   To make that work, we must remove all redundant entries.  */
!               if (flag_pph_decls_debug >= 4)
                  {
                    fprintf (pph_logfile, "      lookup in %p for ",
                             (void*)lookup_locations);
*************** pph_locate_name_lookups_in (VEC(cp_token
*** 3086,3092 ****
                /* We have just shifted down all later entries,
                   and need to counteract the upcoming index increment.  */
                j--;
!               if (flag_pph_debug >= 4)
                  {
                    fprintf (pph_logfile, " to %d\n",
                             VEC_length (cp_token, lookup_locations));
--- 3083,3089 ----
                /* We have just shifted down all later entries,
                   and need to counteract the upcoming index increment.  */
                j--;
!               if (flag_pph_decls_debug >= 4)
                  {
                    fprintf (pph_logfile, " to %d\n",
                             VEC_length (cp_token, lookup_locations));
*************** pph_print_token_range (VEC(tree,heap) *v
*** 3125,3131 ****
    unsigned i;
    tree t;
  
!   if (flag_pph_debug >= 4)
      {
        fprintf (pph_logfile, "PPH: hunk location ");
        pph_debug_location (pph_logfile, VEC_index (cp_token, vtok, 0)->location);
--- 3122,3128 ----
    unsigned i;
    tree t;
  
!   if (flag_pph_decls_debug >= 4)
      {
        fprintf (pph_logfile, "PPH: hunk location ");
        pph_debug_location (pph_logfile, VEC_index (cp_token, vtok, 0)->location);
*************** pph_print_dependence (bool user_body, bo
*** 3153,3159 ****
    static bool prior_used_body = false;
    static tree prior_t = NULL;
    static tree prior_d = NULL;
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_base ");
        pph_debug_tree (t, user_body);
--- 3150,3156 ----
    static bool prior_used_body = false;
    static tree prior_t = NULL;
    static tree prior_d = NULL;
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_base ");
        pph_debug_tree (t, user_body);
*************** pph_print_depend_template (tree tmpl_inf
*** 3194,3200 ****
  {
    tree tmpl_decl;
    tree tmpl_ptrn;
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_template ");
        pph_debug_tree (t, true);
--- 3191,3197 ----
  {
    tree tmpl_decl;
    tree tmpl_ptrn;
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_template ");
        pph_debug_tree (t, true);
*************** pph_print_depend_template (tree tmpl_inf
*** 3220,3226 ****
  static void
  pph_print_depend_decl (tree user, tree used)
  {
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_decl ");
        pph_debug_tree (user, false);
--- 3217,3223 ----
  static void
  pph_print_depend_decl (tree user, tree used)
  {
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_decl ");
        pph_debug_tree (user, false);
*************** static void
*** 3246,3252 ****
  pph_print_depend_type (tree decl, tree type)
  {
    tree type_decl;
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_type ");
        pph_debug_tree (decl, false);
--- 3243,3249 ----
  pph_print_depend_type (tree decl, tree type)
  {
    tree type_decl;
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    pd_type ");
        pph_debug_tree (decl, false);
*************** pph_print_depend_type_type (tree t)
*** 3267,3273 ****
    tree t_type;
    tree field;
  
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on typedecl type ");
        pph_debug_tree (t, false);
--- 3264,3270 ----
    tree t_type;
    tree field;
  
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on typedecl type ");
        pph_debug_tree (t, false);
*************** pph_print_depend_type_type (tree t)
*** 3278,3284 ****
    field = TYPE_FIELDS (t_type); 
    for (; field; field = TREE_CHAIN(field))
      {
!       if (flag_pph_debug >= 2)
          {
            fprintf (pph_logfile, "    field ");
            pph_debug_tree (field, false);
--- 3275,3281 ----
    field = TYPE_FIELDS (t_type); 
    for (; field; field = TREE_CHAIN(field))
      {
!       if (flag_pph_decls_debug >= 2)
          {
            fprintf (pph_logfile, "    field ");
            pph_debug_tree (field, false);
*************** pph_print_depend_type_type (tree t)
*** 3286,3292 ****
        if (TREE_CODE (field) == FIELD_DECL)
          {
            tree f_type = TREE_TYPE (field);
!           if (flag_pph_debug >= 2)
              {
                fprintf (pph_logfile, " of type ");
                pph_debug_type (f_type, false);
--- 3283,3289 ----
        if (TREE_CODE (field) == FIELD_DECL)
          {
            tree f_type = TREE_TYPE (field);
!           if (flag_pph_decls_debug >= 2)
              {
                fprintf (pph_logfile, " of type ");
                pph_debug_type (f_type, false);
*************** pph_print_depend_type_type (tree t)
*** 3300,3306 ****
        else if (TREE_CODE (field) == TYPE_DECL)
          {
          tree f_type = TREE_TYPE (field);
!         if (flag_pph_debug >= 2)
            {
              fprintf (pph_logfile, " of type ");
              pph_debug_type (f_type, false);
--- 3297,3303 ----
        else if (TREE_CODE (field) == TYPE_DECL)
          {
          tree f_type = TREE_TYPE (field);
!         if (flag_pph_decls_debug >= 2)
            {
              fprintf (pph_logfile, " of type ");
              pph_debug_type (f_type, false);
*************** pph_print_depend_type_type (tree t)
*** 3310,3316 ****
          }
      }
  
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    end of fields\n");
      }
--- 3307,3313 ----
          }
      }
  
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    end of fields\n");
      }
*************** pph_print_depend_func_type (tree t)
*** 3325,3331 ****
    tree args;
    tree func_type;
  
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on function type ");
        pph_debug_tree (t, false);
--- 3322,3328 ----
    tree args;
    tree func_type;
  
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on function type ");
        pph_debug_tree (t, false);
*************** pph_print_depend_func_type (tree t)
*** 3352,3358 ****
  static void
  pph_print_depend_var_type (tree t)
  {
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on var/field type ");
        pph_debug_tree (t, false);
--- 3349,3355 ----
  static void
  pph_print_depend_var_type (tree t)
  {
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    depending on var/field type ");
        pph_debug_tree (t, false);
*************** pph_get_decl_exposure (tree t)
*** 3376,3382 ****
    int generic = 0;
    enum tree_code code = TREE_CODE (t);
  
!   if (flag_pph_debug >= 2)
      {
        fprintf (pph_logfile, "    get_exposure for ");
        pph_debug_tree (t, false);
--- 3373,3379 ----
    int generic = 0;
    enum tree_code code = TREE_CODE (t);
  
!   if (flag_pph_decls_debug >= 2)
      {
        fprintf (pph_logfile, "    get_exposure for ");
        pph_debug_tree (t, false);
*************** pph_get_decl_exposure (tree t)
*** 3467,3473 ****
      }
    else if (code == FUNCTION_DECL)
      {
!       if (flag_pph_debug >= 2)
          {
            fprintf (pph_logfile, "    depending on function ");
            pph_debug_tree (t, false);
--- 3464,3470 ----
      }
    else if (code == FUNCTION_DECL)
      {
!       if (flag_pph_decls_debug >= 2)
          {
            fprintf (pph_logfile, "    depending on function ");
            pph_debug_tree (t, false);
*************** pph_print_declaration_head (tree t, bool
*** 3585,3596 ****
        /* From the name dependencies, determine symbol dependencies
  	 by correlating the location of the looked-up symbols with
  	 the tokens in HEAD_TOKENS and BODY_TOKENS.  */
!       if (flag_pph_debug >= 2)
          fprintf (pph_logfile, "  begin normal dependences\n");
        pph_locate_name_lookups_in (head_tokens, &sym_head_deps, &sym_body_deps);
        pph_print_dependences (false, false, t, sym_head_deps);
        pph_print_dependences (true, false, t, sym_body_deps);
!       if (flag_pph_debug >= 2)
          fprintf (pph_logfile, "  end normal dependences\n");
      }
  }
--- 3582,3593 ----
        /* From the name dependencies, determine symbol dependencies
  	 by correlating the location of the looked-up symbols with
  	 the tokens in HEAD_TOKENS and BODY_TOKENS.  */
!       if (flag_pph_decls_debug >= 2)
          fprintf (pph_logfile, "  begin normal dependences\n");
        pph_locate_name_lookups_in (head_tokens, &sym_head_deps, &sym_body_deps);
        pph_print_dependences (false, false, t, sym_head_deps);
        pph_print_dependences (true, false, t, sym_body_deps);
!       if (flag_pph_decls_debug >= 2)
          fprintf (pph_logfile, "  end normal dependences\n");
      }
  }
*************** pph_print_declaration_body (tree t, bool
*** 3638,3649 ****
  
    pph_print_dependence (true, false, t, t); /* body depends on its head */
  
!   if (flag_pph_debug >= 2)
      fprintf (pph_logfile, "  begin normal dependences\n");
    pph_locate_name_lookups_in (body_tokens, &sym_head_deps, &sym_body_deps);
    pph_print_dependences (true, false, t, sym_head_deps);
    pph_print_dependences (true, false, t, sym_body_deps);
!   if (flag_pph_debug >= 2)
      fprintf (pph_logfile, "  end normal dependences\n");
  }
  
--- 3635,3646 ----
  
    pph_print_dependence (true, false, t, t); /* body depends on its head */
  
!   if (flag_pph_decls_debug >= 2)
      fprintf (pph_logfile, "  begin normal dependences\n");
    pph_locate_name_lookups_in (body_tokens, &sym_head_deps, &sym_body_deps);
    pph_print_dependences (true, false, t, sym_head_deps);
    pph_print_dependences (true, false, t, sym_body_deps);
!   if (flag_pph_decls_debug >= 2)
      fprintf (pph_logfile, "  end normal dependences\n");
  }
  
*************** pph_print_declaration (tree t, enum decl
*** 3947,3953 ****
      pph_print_declaration_body (t, artificial, exposure,
                                  n_body_tokens, n_body_invis, body_tokens);
  
!   if (flag_pph_debug >= 4)
      {
        fprintf (pph_logfile, "    Declarator head tokens: ");
        cp_lexer_debug_tokens ((VEC(cp_token, gc) *)head_tokens);
--- 3944,3950 ----
      pph_print_declaration_body (t, artificial, exposure,
                                  n_body_tokens, n_body_invis, body_tokens);
  
!   if (flag_pph_decls_debug >= 4)
      {
        fprintf (pph_logfile, "    Declarator head tokens: ");
        cp_lexer_debug_tokens ((VEC(cp_token, gc) *)head_tokens);
*************** pph_finish (void)
*** 4151,4156 ****
--- 4148,4156 ----
    if (flag_pph_stats)
      pph_print_stats ();
  
+   if (flag_pph_debug >= 1)
+     fprintf (pph_logfile, "PPH: Finishing.\n");
+ 
    if (flag_pph_logfile)
      fclose (pph_logfile);
  }
Index: gcc/cp/parser.c
===================================================================
*** gcc/cp/parser.c	(revision 172203)
--- gcc/cp/parser.c	(working copy)
*************** cp_parser_elaborated_type_specifier (cp_
*** 13189,13195 ****
  						    /*declarator=*/NULL))
  	    return error_mark_node;
  	  type = xref_tag (tag_type, identifier, ts, template_p);
!           if (flag_pph_debug >= 4)
              fprintf (pph_logfile, "PPH: creating tag %p %s in hunk #\n",
                       (void*)identifier, IDENTIFIER_POINTER (identifier));
  	}
--- 13189,13195 ----
  						    /*declarator=*/NULL))
  	    return error_mark_node;
  	  type = xref_tag (tag_type, identifier, ts, template_p);
!           if (flag_pph_decls_debug >= 4)
              fprintf (pph_logfile, "PPH: creating tag %p %s in hunk #\n",
                       (void*)identifier, IDENTIFIER_POINTER (identifier));
  	}
Index: gcc/cp/pph-streamer-out.c
===================================================================
*** gcc/cp/pph-streamer-out.c	(revision 172203)
--- gcc/cp/pph-streamer-out.c	(working copy)
*************** pph_stream_write_tree (struct output_blo
*** 592,598 ****
  	  pph_stream_write_lang_specific_data (stream, expr, ref_p);
  
  	  if (TREE_CODE (expr) == FUNCTION_DECL)
! 	    pph_output_tree (stream, DECL_SAVED_TREE (expr), ref_p);
  	}
      }
    else if (TREE_CODE (expr) == STATEMENT_LIST)
--- 592,598 ----
  	  pph_stream_write_lang_specific_data (stream, expr, ref_p);
  
  	  if (TREE_CODE (expr) == FUNCTION_DECL)
! 	    pph_output_tree_aux (stream, DECL_SAVED_TREE (expr), ref_p);
  	}
      }
    else if (TREE_CODE (expr) == STATEMENT_LIST)
*************** pph_stream_write_tree (struct output_blo
*** 608,613 ****
  
        /* Write the statements.  */
        for (i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i))
! 	pph_output_tree (stream, tsi_stmt (i), ref_p);
      }
  }
--- 608,613 ----
  
        /* 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);
      }
  }
Index: gcc/cp/pph-streamer.h
===================================================================
*** gcc/cp/pph-streamer.h	(revision 172203)
--- gcc/cp/pph-streamer.h	(working copy)
*************** struct cp_token_cache *pth_load_token_ca
*** 119,129 ****
  /* Inline functions.  */
  
  /* Output AST T to STREAM.  If REF_P is true, output all the leaves of T
!    as references.  */
  static inline void
  pph_output_tree (pph_stream *stream, tree t, bool ref_p)
  {
!   if (flag_pph_tracer)
      pph_stream_trace_tree (stream, t);
    lto_output_tree (stream->ob, t, ref_p);
  }
--- 119,139 ----
  /* Inline functions.  */
  
  /* Output AST T to STREAM.  If REF_P is true, output all the leaves of T
!    as references.  This function is the primary interface.  */
  static inline void
  pph_output_tree (pph_stream *stream, tree t, bool ref_p)
  {
!   if (flag_pph_tracer >= 1)
!     pph_stream_trace_tree (stream, t);
!   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.  */
! static inline void
! pph_output_tree_aux (pph_stream *stream, tree t, bool ref_p)
! {
!   if (flag_pph_tracer >= 3)
      pph_stream_trace_tree (stream, t);
    lto_output_tree (stream->ob, t, ref_p);
  }
*************** pph_output_tree (pph_stream *stream, tre
*** 132,138 ****
  static inline void
  pph_output_tree_or_ref (pph_stream *stream, tree t, bool ref_p)
  {
!   if (flag_pph_tracer)
      pph_stream_trace_tree (stream, t);
    lto_output_tree_or_ref (stream->ob, t, ref_p);
  }
--- 142,148 ----
  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);
    lto_output_tree_or_ref (stream->ob, t, ref_p);
  }
*************** pph_output_tree_or_ref (pph_stream *stre
*** 141,147 ****
  static inline void
  pph_output_uint (pph_stream *stream, unsigned int value)
  {
!   if (flag_pph_tracer)
      pph_stream_trace_uint (stream, value);
    lto_output_sleb128_stream (stream->ob->main_stream, value);
  }
--- 151,157 ----
  static inline void
  pph_output_uint (pph_stream *stream, unsigned int value)
  {
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_uint (stream, value);
    lto_output_sleb128_stream (stream->ob->main_stream, value);
  }
*************** pph_output_uint (pph_stream *stream, uns
*** 150,156 ****
  static inline void
  pph_output_uchar (pph_stream *stream, unsigned char value)
  {
!   if (flag_pph_tracer)
      pph_stream_trace_uint (stream, value);
    lto_output_1_stream (stream->ob->main_stream, value);
  }
--- 160,166 ----
  static inline void
  pph_output_uchar (pph_stream *stream, unsigned char value)
  {
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_uint (stream, value);
    lto_output_1_stream (stream->ob->main_stream, value);
  }
*************** pph_output_uchar (pph_stream *stream, un
*** 159,165 ****
  static inline void
  pph_output_bytes (pph_stream *stream, const void *p, size_t n)
  {
!   if (flag_pph_tracer)
      pph_stream_trace_bytes (stream, p, n);
    lto_output_data_stream (stream->ob->main_stream, p, n);
  }
--- 169,175 ----
  static inline void
  pph_output_bytes (pph_stream *stream, const void *p, size_t n)
  {
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_bytes (stream, p, n);
    lto_output_data_stream (stream->ob->main_stream, p, n);
  }
*************** pph_output_bytes (pph_stream *stream, co
*** 168,176 ****
  static inline void
  pph_output_string (pph_stream *stream, const char *str)
  {
!   lto_output_string (stream->ob, stream->ob->main_stream, str);
!   if (flag_pph_tracer)
      pph_stream_trace_string (stream, str);
  }
  
  /* Write string STR of length LEN to STREAM.  */
--- 178,186 ----
  static inline void
  pph_output_string (pph_stream *stream, const char *str)
  {
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_string (stream, str);
+   lto_output_string (stream->ob, stream->ob->main_stream, str);
  }
  
  /* Write string STR of length LEN to STREAM.  */
*************** pph_output_string_with_length (pph_strea
*** 180,194 ****
  {
    if (str)
      {
        lto_output_string_with_length (stream->ob, stream->ob->main_stream,
  				     str, len + 1);
-       if (flag_pph_tracer)
- 	pph_stream_trace_string_with_length (stream, str, len);
      }
    else
      {
        /* lto_output_string_with_length does not handle NULL strings,
  	 but lto_output_string does.  */
        pph_output_string (stream, NULL);
      }
  }
--- 190,206 ----
  {
    if (str)
      {
+       if (flag_pph_tracer >= 4)
+ 	pph_stream_trace_string_with_length (stream, str, len);
        lto_output_string_with_length (stream->ob, stream->ob->main_stream,
  				     str, len + 1);
      }
    else
      {
        /* lto_output_string_with_length does not handle NULL strings,
  	 but lto_output_string does.  */
+       if (flag_pph_tracer >= 4)
+ 	pph_stream_trace_string (stream, str);
        pph_output_string (stream, NULL);
      }
  }
*************** pph_output_string_with_length (pph_strea
*** 198,206 ****
  static inline void
  pph_output_chain (pph_stream *stream, tree first, bool ref_p)
  {
!   lto_output_chain (stream->ob, first, ref_p);
!   if (flag_pph_tracer)
      pph_stream_trace_chain (stream, first);
  }
  
  /* Write a bitpack BP to STREAM.  */
--- 210,218 ----
  static inline void
  pph_output_chain (pph_stream *stream, tree first, bool ref_p)
  {
!   if (flag_pph_tracer >= 3)
      pph_stream_trace_chain (stream, first);
+   lto_output_chain (stream->ob, first, ref_p);
  }
  
  /* Write a bitpack BP to STREAM.  */
*************** static inline void
*** 208,214 ****
  pph_output_bitpack (pph_stream *stream, struct bitpack_d *bp)
  {
    gcc_assert (stream->ob->main_stream == bp->stream);
!   if (flag_pph_tracer)
      pph_stream_trace_bitpack (stream, bp);
    lto_output_bitpack (bp);
  }
--- 220,226 ----
  pph_output_bitpack (pph_stream *stream, struct bitpack_d *bp)
  {
    gcc_assert (stream->ob->main_stream == bp->stream);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_bitpack (stream, bp);
    lto_output_bitpack (bp);
  }
*************** pph_input_uint (pph_stream *stream)
*** 219,225 ****
  {
    HOST_WIDE_INT unsigned n = lto_input_uleb128 (stream->ib);
    gcc_assert (n == (unsigned) n);
!   if (flag_pph_tracer)
      pph_stream_trace_uint (stream, n);
    return (unsigned) n;
  }
--- 231,237 ----
  {
    HOST_WIDE_INT unsigned n = lto_input_uleb128 (stream->ib);
    gcc_assert (n == (unsigned) n);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_uint (stream, n);
    return (unsigned) n;
  }
*************** static inline unsigned char
*** 229,235 ****
  pph_input_uchar (pph_stream *stream)
  {
    unsigned char n = lto_input_1_unsigned (stream->ib);
!   if (flag_pph_tracer)
      pph_stream_trace_uint (stream, n);
    return n;
  }
--- 241,247 ----
  pph_input_uchar (pph_stream *stream)
  {
    unsigned char n = lto_input_1_unsigned (stream->ib);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_uint (stream, n);
    return n;
  }
*************** static inline void
*** 240,246 ****
  pph_input_bytes (pph_stream *stream, void *p, size_t n)
  {
    lto_input_data_block (stream->ib, p, n);
!   if (flag_pph_tracer)
      pph_stream_trace_bytes (stream, p, n);
  }
  
--- 252,258 ----
  pph_input_bytes (pph_stream *stream, void *p, size_t n)
  {
    lto_input_data_block (stream->ib, p, n);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_bytes (stream, p, n);
  }
  
*************** static inline const char *
*** 252,258 ****
  pph_input_string (pph_stream *stream)
  {
    const char *s = lto_input_string (stream->data_in, stream->ib);
!   if (flag_pph_tracer)
      pph_stream_trace_string (stream, s);
    return s;
  }
--- 264,270 ----
  pph_input_string (pph_stream *stream)
  {
    const char *s = lto_input_string (stream->data_in, stream->ib);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_string (stream, s);
    return s;
  }
*************** static inline tree
*** 262,268 ****
  pph_input_tree (pph_stream *stream)
  {
    tree t = lto_input_tree (stream->ib, stream->data_in);
!   if (flag_pph_tracer)
      pph_stream_trace_tree (stream, t);
    return t;
  }
--- 274,280 ----
  pph_input_tree (pph_stream *stream)
  {
    tree t = lto_input_tree (stream->ib, stream->data_in);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_tree (stream, t);
    return t;
  }
*************** static inline tree
*** 272,278 ****
  pph_input_chain (pph_stream *stream)
  {
    tree t = lto_input_chain (stream->ib, stream->data_in);
!   if (flag_pph_tracer)
      pph_stream_trace_chain (stream, t);
    return t;
  }
--- 284,290 ----
  pph_input_chain (pph_stream *stream)
  {
    tree t = lto_input_chain (stream->ib, stream->data_in);
!   if (flag_pph_tracer >= 2)
      pph_stream_trace_chain (stream, t);
    return t;
  }
*************** static inline struct bitpack_d
*** 282,288 ****
  pph_input_bitpack (pph_stream *stream)
  {
    struct bitpack_d bp = lto_input_bitpack (stream->ib);
!   if (flag_pph_tracer)
      pph_stream_trace_bitpack (stream, &bp);
    return bp;
  }
--- 294,300 ----
  pph_input_bitpack (pph_stream *stream)
  {
    struct bitpack_d bp = lto_input_bitpack (stream->ib);
!   if (flag_pph_tracer >= 4)
      pph_stream_trace_bitpack (stream, &bp);
    return bp;
  }
Index: gcc/cp/name-lookup.c
===================================================================
*** gcc/cp/name-lookup.c	(revision 172203)
--- gcc/cp/name-lookup.c	(working copy)
*************** add_decl_to_level (tree decl, cxx_scope 
*** 576,582 ****
  		&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
            {
  	    VEC_safe_push (tree, gc, b->static_decls, decl);
!             if (flag_pph_debug >= 3)
                {
                  fprintf (stderr, "Adding %p to static_decls:\n", (void*)decl);
                  print_generic_expr (stderr, decl, 0);
--- 576,582 ----
  		&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
            {
  	    VEC_safe_push (tree, gc, b->static_decls, decl);
!             if (flag_pph_decls_debug >= 3)
                {
                  fprintf (stderr, "Adding %p to static_decls:\n", (void*)decl);
                  print_generic_expr (stderr, decl, 0);

--
This patch is available for review at http://codereview.appspot.com/4380046


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]