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]

Rename tree_ann to tree_ann_t


Hi,

For GVN-PRE we need the ability attach a value representative
to every tree, so we figured we could use tree_ann for that,
just like we have var_ann, stmt_ann, and ssa_name_ann.
But the generic tree_ann is a type name, where the other kinds
of tree annotations have a *_t suffix.  This patch renames
tree_ann to tree_ann_t, and adds a few functions to create and
access the generic tree_ann_t annotations.

It also makes us have a tree dump after splitting critical edges.

Bootstrapped on x86-64. OK?

Gr.
Steven

	* tree-cfg.c (pass_split_crit_edges): Name it "crited".  Dump
	the function after the pass.
	* tree-dfa.c (create_tree_ann): New function.
	(create_var_ann, create_stmt_ann, create_ssa_name_ann): Update
	casts to use tree_ann_t.
	* tree-flow-inline.c (tree_ann, create_tree_ann): New functions.
	(ann_type): Update for tree_ann_t name change.
	* tree-flow-inline (struct tree_ann_d): Likewise.
	(ann_type): Likewise.
	* tree-ssa-ccp.c (set_rhs): Likewise.
	* tree-tailcall.c (adjust_return_value): Likewise.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.2
diff -c -3 -p -r2.2 tree-cfg.c
*** tree-cfg.c	15 May 2004 23:07:51 -0000	2.2
--- tree-cfg.c	16 May 2004 10:09:24 -0000
*************** split_critical_edges (void)
*** 4481,4487 ****
  
  struct tree_opt_pass pass_split_crit_edges = 
  {
!   NULL,                          /* name */
    NULL,                          /* gate */
    split_critical_edges,          /* execute */
    NULL,                          /* sub */
--- 4481,4487 ----
  
  struct tree_opt_pass pass_split_crit_edges = 
  {
!   "crited",                      /* name */
    NULL,                          /* gate */
    split_critical_edges,          /* execute */
    NULL,                          /* sub */
*************** struct tree_opt_pass pass_split_crit_edg
*** 4492,4498 ****
    PROP_no_crit_edges,            /* properties_provided */
    0,                             /* properties_destroyed */
    0,                             /* todo_flags_start */
!   0,                             /* todo_flags_finish */
  };
  
  /* Emit return warnings.  */
--- 4492,4498 ----
    PROP_no_crit_edges,            /* properties_provided */
    0,                             /* properties_destroyed */
    0,                             /* todo_flags_start */
!   TODO_dump_func,                /* todo_flags_finish */
  };
  
  /* Emit return warnings.  */
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.4
diff -c -3 -p -r2.4 tree-dfa.c
*** tree-dfa.c	15 May 2004 23:07:51 -0000	2.4
--- tree-dfa.c	16 May 2004 10:09:24 -0000
*************** redirect_immediate_uses (tree old, tree 
*** 408,413 ****
--- 408,426 ----
  /*---------------------------------------------------------------------------
  			    Manage annotations
  ---------------------------------------------------------------------------*/
+ tree_ann_t
+ create_tree_ann (tree t)
+ {
+   tree_ann_t ann;
+   ann = ggc_alloc (sizeof (*ann));
+   memset ((void *) ann, 0, sizeof (*ann));
+ 
+   ann->common.type = TREE_ANN_COMMON;
+ 
+   t->common.ann = (tree_ann_t) ann;
+ 
+   return ann;
+ }
  /* Create a new annotation for a _DECL node T.  */
  
  var_ann_t
*************** create_var_ann (tree t)
*** 428,434 ****
  
    ann->common.type = VAR_ANN;
  
!   t->common.ann = (tree_ann) ann;
  
    return ann;
  }
--- 441,447 ----
  
    ann->common.type = VAR_ANN;
  
!   t->common.ann = (tree_ann_t) ann;
  
    return ann;
  }
*************** create_stmt_ann (tree t)
*** 456,462 ****
    /* Since we just created the annotation, mark the statement modified.  */
    ann->modified = true;
  
!   t->common.ann = (tree_ann) ann;
  
    return ann;
  }
--- 469,475 ----
    /* Since we just created the annotation, mark the statement modified.  */
    ann->modified = true;
  
!   t->common.ann = (tree_ann_t) ann;
  
    return ann;
  }
*************** create_ssa_name_ann (tree t)
*** 480,486 ****
    memset ((void *) ann, 0, sizeof (*ann));
  
    ann->common.type = SSA_NAME_ANN;
!   t->common.ann = (tree_ann) ann;
  
    return ann;
  }
--- 493,499 ----
    memset ((void *) ann, 0, sizeof (*ann));
  
    ann->common.type = SSA_NAME_ANN;
!   t->common.ann = (tree_ann_t) ann;
  
    return ann;
  }
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.1
diff -c -3 -p -r2.1 tree-flow-inline.h
*** tree-flow-inline.h	13 May 2004 06:39:48 -0000	2.1
--- tree-flow-inline.h	16 May 2004 10:09:24 -0000
*************** get_var_ann (tree var)
*** 46,51 ****
--- 46,65 ----
    return (ann) ? ann : create_var_ann (var);
  }
  
+ 
+ static inline tree_ann_t
+ tree_ann (tree t)
+ {
+   return (tree_ann_t) t->common.ann;
+ }
+ 
+ static inline tree_ann_t
+ get_tree_ann (tree t)
+ {
+   tree_ann_t ann = tree_ann (t);
+   return (ann) ? ann : create_tree_ann (t);
+ }
+ 
  static inline stmt_ann_t
  stmt_ann (tree t)
  {
*************** get_ssa_name_ann (tree var)
*** 87,93 ****
  
  
  static inline enum tree_ann_type
! ann_type (tree_ann ann)
  {
    return ann->common.type;
  }
--- 101,107 ----
  
  
  static inline enum tree_ann_type
! ann_type (tree_ann_t ann)
  {
    return ann->common.type;
  }
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow.h,v
retrieving revision 2.3
diff -c -3 -p -r2.3 tree-flow.h
*** tree-flow.h	14 May 2004 15:27:36 -0000	2.3
--- tree-flow.h	16 May 2004 10:09:24 -0000
*************** struct ssa_name_ann_d GTY(())
*** 280,286 ****
  };
  
  
! union tree_ann_d GTY((desc ("ann_type ((tree_ann)&%h)")))
  {
    struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
    struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
--- 280,286 ----
  };
  
  
! union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
  {
    struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
    struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
*************** union tree_ann_d GTY((desc ("ann_type ((
*** 288,305 ****
    struct ssa_name_ann_d GTY((tag ("SSA_NAME_ANN"))) ssa_name;
  };
  
! typedef union tree_ann_d *tree_ann;
  typedef struct var_ann_d *var_ann_t;
  typedef struct stmt_ann_d *stmt_ann_t;
  typedef struct ssa_name_ann_d *ssa_name_ann_t;
  
  static inline var_ann_t var_ann (tree);
  static inline var_ann_t get_var_ann (tree);
  static inline stmt_ann_t stmt_ann (tree);
  static inline stmt_ann_t get_stmt_ann (tree);
  static inline ssa_name_ann_t ssa_name_ann (tree);
  static inline ssa_name_ann_t get_ssa_name_ann (tree);
! static inline enum tree_ann_type ann_type (tree_ann);
  static inline basic_block bb_for_stmt (tree);
  extern void set_bb_for_stmt (tree, basic_block);
  static inline void modify_stmt (tree);
--- 288,307 ----
    struct ssa_name_ann_d GTY((tag ("SSA_NAME_ANN"))) ssa_name;
  };
  
! typedef union tree_ann_d *tree_ann_t;
  typedef struct var_ann_d *var_ann_t;
  typedef struct stmt_ann_d *stmt_ann_t;
  typedef struct ssa_name_ann_d *ssa_name_ann_t;
  
+ static inline tree_ann_t tree_ann (tree);
+ static inline tree_ann_t get_tree_ann (tree);
  static inline var_ann_t var_ann (tree);
  static inline var_ann_t get_var_ann (tree);
  static inline stmt_ann_t stmt_ann (tree);
  static inline stmt_ann_t get_stmt_ann (tree);
  static inline ssa_name_ann_t ssa_name_ann (tree);
  static inline ssa_name_ann_t get_ssa_name_ann (tree);
! static inline enum tree_ann_type ann_type (tree_ann_t);
  static inline basic_block bb_for_stmt (tree);
  extern void set_bb_for_stmt (tree, basic_block);
  static inline void modify_stmt (tree);
*************** extern void extract_true_false_edges_fro
*** 485,490 ****
--- 487,493 ----
  extern void dump_generic_bb (FILE *, basic_block, int, int);
  
  /* In tree-dfa.c  */
+ extern tree_ann_t create_tree_ann (tree);
  extern var_ann_t create_var_ann (tree);
  extern stmt_ann_t create_stmt_ann (tree);
  extern ssa_name_ann_t create_ssa_name_ann (tree);
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 2.2
diff -c -3 -p -r2.2 tree-ssa-ccp.c
*** tree-ssa-ccp.c	14 May 2004 02:29:23 -0000	2.2
--- tree-ssa-ccp.c	16 May 2004 10:09:25 -0000
*************** set_rhs (tree *stmt_p, tree expr)
*** 2019,2025 ****
  	 effects, then replace *STMT_P with an empty statement.  */
        stmt_ann_t ann = stmt_ann (stmt);
        *stmt_p = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt ();
!       (*stmt_p)->common.ann = (tree_ann) ann;
  
        if (TREE_SIDE_EFFECTS (expr))
  	{
--- 2019,2025 ----
  	 effects, then replace *STMT_P with an empty statement.  */
        stmt_ann_t ann = stmt_ann (stmt);
        *stmt_p = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt ();
!       (*stmt_p)->common.ann = (tree_ann_t) ann;
  
        if (TREE_SIDE_EFFECTS (expr))
  	{
Index: tree-tailcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v
retrieving revision 2.3
diff -c -3 -p -r2.3 tree-tailcall.c
*** tree-tailcall.c	15 May 2004 09:39:29 -0000	2.3
--- tree-tailcall.c	16 May 2004 10:09:25 -0000
*************** adjust_return_value (basic_block bb, tre
*** 593,599 ****
  
    if (TREE_CODE (ret_var) == MODIFY_EXPR)
      {
!       ret_var->common.ann = (tree_ann) stmt_ann (ret_stmt);
        bsi_replace (&bsi, ret_var, true);
        SSA_NAME_DEF_STMT (TREE_OPERAND (ret_var, 0)) = ret_var;
        ret_var = TREE_OPERAND (ret_var, 0);
--- 593,599 ----
  
    if (TREE_CODE (ret_var) == MODIFY_EXPR)
      {
!       ret_var->common.ann = (tree_ann_t) stmt_ann (ret_stmt);
        bsi_replace (&bsi, ret_var, true);
        SSA_NAME_DEF_STMT (TREE_OPERAND (ret_var, 0)) = ret_var;
        ret_var = TREE_OPERAND (ret_var, 0);


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