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] PR 26830 -- initialization of flags


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zdenek Dvorak wrote on 05/03/06 18:07:

> 	PR tree-optimization/26830
> 	* tree-into-ssa.c (struct ssa_name_info): Add age field.
> 	(info_for_ssa_name, current_info_for_ssa_name_age,
> 	blocks_with_initialized_flags): New variables.
> 	(get_ssa_name_ann): Use info_for_ssa_name instead of SSA_NAME_AUX.
> 	(clear_ssa_name_info, initialize_flags_in_bb): New functions.
> 	(mark_def_sites, rewrite_stmt
> 	(insert_phi_nodes_for, mark_use_interesting, prepare_block_for_update,
> 	prepare_def_site_for): Call initialize_flags_in_bb.
> 	(rewrite_update_init_block, rewrite_update_stmt): Only process
> 	blocks with statements to rewrite.
> 	(delete_update_ssa): Do not clear SSA_NAME_AUX.
> 	(update_ssa): Initialize and free blocks_with_initialized_flags.  Do not
> 	clear flags on statements.
> 
Good idea.  Thanks.

> + 
> +   /* Age of this record (so that info_for_ssa_name table can be cleared
> +      quicky); if AGE < CURRENT_INFO_FOR_SSA_NAME_AGE, then the fields
> +      are assumed to be null.  */
> +   unsigned age;
>   };
>   
As Richard G. suggested, move field 'age' right before 'current_def' to
take advantage of the padding given by the first bitfield in 64bit targets.

> + /* The information associated with names.  */
> + typedef struct ssa_name_info *ssa_name_info_p;
> + DEF_VEC_P (ssa_name_info_p);
> + DEF_VEC_ALLOC_P (ssa_name_info_p, heap);
> + 
> + static VEC(ssa_name_info_p, heap) *info_for_ssa_name;
> + static unsigned current_info_for_ssa_name_age;
> + 
> + /* Bitmap of blocks for that REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
> +    flags were initialized.  */
> + 
> + static bitmap blocks_with_initialized_flags;
>   
No need to use another bitmap of blocks.  Let's rename this to
'blocks_to_update' and update all uses of the 'blocks' bitmap that is
currently being sent around from update_ssa:

/* Set of blocks that need to be updated by update_ssa.  */
static bitmap blocks_to_update;

The semantics on this set are the same.  The first time a block is added
to this set, we mark all its statements with initialize_flags_in_bb.

> !   if (!SSA_NAME_AUX (name))
> !     SSA_NAME_AUX (name) = xcalloc (1, sizeof (struct ssa_name_info));
>   
Please also remove SSA_NAME_AUX and the corresponding field in SSA names.


> + static void
> + initialize_flags_in_bb (basic_block bb)
> + {
> +   tree phi, stmt;
> +   block_stmt_iterator bsi;
> + 
> +   if (!blocks_with_initialized_flags
>
Make sure we only call this when updating SSA:
	gcc_assert (blocks_to_update);

> *************** insert_phi_nodes_for (tree var, bitmap p
> *** 850,855 ****
> --- 930,936 ----
>   			    0, bb_index, bi)
>       {
>         bb = BASIC_BLOCK (bb_index);
> +       initialize_flags_in_bb (bb);
>   
if (update_p)
  initialize_flags_in_bb (bb);


>         if (update_p && TREE_CODE (var) == SSA_NAME)
>   	{
> *************** rewrite_stmt (struct dom_walk_data *walk
> *** 1059,1064 ****
> --- 1140,1146 ----
>   
>     /* If mark_def_sites decided that we don't need to rewrite this
>        statement, ignore it.  */
> +   gcc_assert (!blocks_with_initialized_flags);
>     if (!REWRITE_THIS_STMT (stmt) && !REGISTER_DEFS_IN_THIS_STMT (stmt))
>       return;
>   
> *************** rewrite_update_init_block (struct dom_wa
> *** 1346,1351 ****
> --- 1428,1436 ----
>        register it as a new definition for its corresponding name.  Also
>        register definitions for names whose underlying symbols are
>        marked for renaming.  */
> +   if (!bitmap_bit_p (blocks_with_initialized_flags, bb->index))
> +     return;
> + 
>
Move earlier, right before the loop that sets 'is_abnormal_phi'.

> *************** rewrite_update_stmt (struct dom_walk_dat
> *** 1484,1489 ****
> --- 1569,1576 ----
>     ann = stmt_ann (stmt);
>   
>     /* Only update marked statements.  */
> +   if (!bitmap_bit_p (blocks_with_initialized_flags, bb->index))
> +     return;
>
Vertical spacing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEW1JfUTa2oAUaiwQRAkrNAKCa5HdYnUetopc814Q99OXTzsapGwCgpbDC
ToOYac6rCSDgHI1/saTjg4Y=
=nQX3
-----END PGP SIGNATURE-----


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