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]

Re: [PATCH] VECify record_layout_info.pending_statics


On Thu, Jun 17, 2010 at 8:51 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> As $SUBJECT suggests. ?More TREE_LIST removal, yada, yada.
>
> Tested on x86_64-unknown-linux-gnu. ?OK?

Ok.

Thanks,
Richard.

> -Nathan
>
> ? ? ? ?* tree.h (record_layout_info): Change type of pending_statics field
> ? ? ? ?to a VEC.
> ? ? ? ?* stor-layout.c (start_record_layout): Store NULL into
> ? ? ? ?pending_statics.
> ? ? ? ?(debug_rli): Adjust for new type of pending_statics field.
> ? ? ? ?(place_field): Likewise.
> ? ? ? ?(finish_record_layout): Likewise.
>
> --- a/gcc/stor-layout.c
> +++ b/gcc/stor-layout.c
> @@ -743,7 +743,7 @@ start_record_layout (tree t)
> ? rli->offset = size_zero_node;
> ? rli->bitpos = bitsize_zero_node;
> ? rli->prev_field = 0;
> - ?rli->pending_statics = 0;
> + ?rli->pending_statics = NULL;
> ? rli->packed_maybe_necessary = 0;
> ? rli->remaining_in_alignment = 0;
>
> @@ -827,10 +827,13 @@ debug_rli (record_layout_info rli)
> ? if (rli->packed_maybe_necessary)
> ? ? fprintf (stderr, "packed may be necessary\n");
>
> - ?if (rli->pending_statics)
> + ?if (!VEC_empty (tree, rli->pending_statics))
> ? ? {
> + ? ? ?unsigned ix;
> + ? ? ?tree t;
> ? ? ? fprintf (stderr, "pending statics:\n");
> - ? ? ?debug_tree (rli->pending_statics);
> + ? ? ?for (ix = 0; VEC_iterate (tree, rli->pending_statics, ix, t); ix++)
> + ? ? ? ?debug_tree (t);
> ? ? }
> ?}
>
> @@ -1041,8 +1044,7 @@ place_field (record_layout_info rli, tree field)
> ? ? ?it *after* the record is laid out. ?*/
> ? if (TREE_CODE (field) == VAR_DECL)
> ? ? {
> - ? ? ?rli->pending_statics = tree_cons (NULL_TREE, field,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rli->pending_statics);
> + ? ? ?VEC_safe_push (tree, gc, rli->pending_statics, field);
> ? ? ? return;
> ? ? }
>
> @@ -1718,15 +1720,15 @@ finish_record_layout (record_layout_info rli, int free_p)
>
> ? /* Lay out any static members. ?This is done now because their type
> ? ? ?may use the record's type. ?*/
> - ?while (rli->pending_statics)
> - ? ?{
> - ? ? ?layout_decl (TREE_VALUE (rli->pending_statics), 0);
> - ? ? ?rli->pending_statics = TREE_CHAIN (rli->pending_statics);
> - ? ?}
> + ?while (!VEC_empty (tree, rli->pending_statics))
> + ? ?layout_decl (VEC_pop (tree, rli->pending_statics), 0);
>
> ? /* Clean up. ?*/
> ? if (free_p)
> - ? ?free (rli);
> + ? ?{
> + ? ? ?VEC_free (tree, gc, rli->pending_statics);
> + ? ? ?free (rli);
> + ? ?}
> ?}
>
>
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -4325,7 +4325,7 @@ typedef struct record_layout_info_s
> ? tree prev_field;
> ? /* The static variables (i.e., class variables, as opposed to
> ? ? ?instance variables) encountered in T. ?*/
> - ?tree pending_statics;
> + ?VEC(tree,gc) *pending_statics;
> ? /* Bits remaining in the current alignment group */
> ? int remaining_in_alignment;
> ? /* True if we've seen a packed field that didn't have normal
>


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