On Fri, May 20, 2011 at 17:09, Lawrence Crowl <cr...@google.com> wrote:
> Split C++ test x1funcstatic.cc into a C test and a C++ test.
> Stream out and in various C++ tree members.
>
> Index: gcc/testsuite/ChangeLog.pph
>
> 2011-05-20  Lawrence Crowl  <cr...@google.com>
>
>        * x1funcstatic.h: Rename to c1funcstatic.h, as contents are C only.
>        * x1funcstatic.c: Use c1funcstatic.h instead of x1funcstatic.h.
>        * c1funcstatic.c: Add to test C functionality.
>
> Index: gcc/cp/ChangeLog.pph
>
> 2011-05-20  Lawrence Crowl <cr...@google.com>
>
>        * pph-streamer-in.c (pph_stream_read_qual_use_vec): Add.
>        (pph_stream_read_tree_vec_none): Add.
>        (pph_stream_read_tree): Add read of various C++ fields.
>        * pph-streamer-out.c (pph_stream_write_qual_use_vec): Add.
>        (pph_stream_write_tree_vec_none): Add.
>        (pph_stream_write_tree): Add write of various C++ fields.

Thanks.

As we chatted off list, you can now get rid off of the TREE_BINFO
handling code.  That's already handled in the gimple streamer.

> +    }
> +  else if (TREE_CODE (expr) == TREE_LIST)
> +    ; /* FIXME pph: already handled?  */

Yes, TREE_LIST is handled already.

> +  else if (flag_pph_debug >= 2)
> +    fprintf (pph_logfile, "PPH: unimplemented read of %s\n",
> +             tree_code_name[TREE_CODE (expr)]);

This will print everything.  This hook is called from tree_on every
node, regardless of whether it was handled or not.

> @@ -788,6 +825,9 @@ pph_stream_write_tree (struct output_blo
>   if (DECL_P (expr))
>     {
>       pph_output_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
> +      /* FIXME pph:
> +      pph_output_tree_or_ref_1 (stream, DECL_NAME (expr), ref_p, 3);
> +      */

DECL_NAME is already handled in the gimple streamer.

>
>       if (TREE_CODE (expr) == FUNCTION_DECL
>          || TREE_CODE (expr) == NAMESPACE_DECL
> @@ -828,6 +868,57 @@ pph_stream_write_tree (struct output_blo
>           pph_output_tree_or_ref_1 (stream, TYPE_BINFO (expr), ref_p, 3);
>         }
>     }
> +  else if (TREE_CODE (expr) == OVERLOAD)
> +    {
> +      pph_output_tree_or_ref_1 (stream, OVL_CURRENT (expr), ref_p, 3);
> +    }
> +  else if (TREE_CODE (expr) == IDENTIFIER_NODE)
> +    {
> +      struct lang_identifier *id = LANG_IDENTIFIER_CAST(expr);
> +      pph_output_tree_or_ref_1 (stream, TREE_TYPE (expr), ref_p, 3);
> +      pph_output_string_with_length (stream, IDENTIFIER_POINTER (expr),
> +                                             IDENTIFIER_LENGTH (expr));
> +      pph_stream_write_cxx_binding (stream, id->namespace_bindings, ref_p);
> +      pph_stream_write_cxx_binding (stream, id->bindings, ref_p);
> +      pph_output_tree_or_ref_1 (stream, id->class_template_info, ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, id->label_value, ref_p, 3);

factor out?  (similarly on the reading side.

> +    }
> +  else if (TREE_CODE (expr) == BASELINK)
> +    {
> +      pph_output_tree_or_ref_1 (stream, BASELINK_BINFO (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BASELINK_FUNCTIONS (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BASELINK_ACCESS_BINFO (expr), ref_p, 
> 3);
> +    }

Likewise.

> +  else if (TREE_CODE (expr) == TREE_BINFO)
> +    {
> +      pph_output_tree_or_ref_1 (stream, BINFO_OFFSET (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BINFO_VTABLE (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BINFO_VIRTUALS (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BINFO_VPTR_FIELD (expr), ref_p, 3);
> +      pph_stream_write_tree_vec (stream, BINFO_BASE_ACCESSES (expr), ref_p);
> +      pph_output_tree_or_ref_1 (stream, BINFO_INHERITANCE_CHAIN (expr),
> +                                        ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BINFO_SUBVTT_INDEX (expr), ref_p, 3);
> +      pph_output_tree_or_ref_1 (stream, BINFO_VPTR_INDEX (expr), ref_p, 3);
> +      pph_stream_write_tree_vec_none (stream, BINFO_BASE_BINFOS (expr), 
> ref_p);
> +    }
> +  else if (TREE_CODE (expr) == TEMPLATE_DECL)
> +    {
> +      pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_RESULT (expr), ref_p, 
> 3);
> +      pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_PARMS (expr), ref_p, 
> 3);
> +      pph_output_tree_or_ref_1 (stream, DECL_CONTEXT (expr), ref_p, 3);
> +      /* FIXME pph: what of bit DECL_MEMBER_TEMPLATE_P (expr) */

Just write it out as an unsigned char.

> +    }
> +  else if (TREE_CODE (expr) == TEMPLATE_INFO)
> +    {
> +      pph_stream_write_qual_use_vec (stream,
> +          TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr), ref_p);
> +    }
> +  else if (TREE_CODE (expr) == TREE_LIST)
> +    ; /* FIXME pph: already handled?  */

Yes, already handled.


Diego.

Reply via email to