[tree-ssa, RFC] SSA_NAMES and overload of chain field

Jan Hubicka jh@suse.cz
Fri Nov 28 22:54:00 GMT 2003


Hi,
the chain filed is special because GGC is aware of fact that the chain
is used as linked list:
union lang_tree_node
  GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
       chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *)TYPE_NEXT_VARIANT (&%h.generic) : (union lang_tree_node *)TREE_CHAIN (&%h.generic)")))

The use of the field in SSA_NAME_DEF_STMT breaks this expectation and
confuses GGC when multiple SSA_NAMES point to same DEF_STMT.

The attached patch fixes it by avoiding the overload of chain and ading
separate field for this, but I am open for further suggestions.

Bootstrapped/regtested i686-pc-gnu-linux in isolation
and additionally x86_64-linux in combination with two patches sent
earlier.
Honza

2003-11-28  Jan Hubicka  <jh@suse.cz>
	* tree.h (SSA_NAME_DEF_STMT): Use def_stmt field.
	(tree_ssa_name): def_stmt.
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.141
diff -c -3 -p -r1.342.2.141 tree.h
*** tree.h	27 Nov 2003 04:01:03 -0000	1.342.2.141
--- tree.h	28 Nov 2003 01:26:36 -0000
*************** struct tree_exp GTY(())
*** 1026,1032 ****
  /* Returns the statement which defines this reference.   Note that
     we use the same field when chaining SSA_NAME nodes together on
     the SSA_NAME freelist.  */
! #define SSA_NAME_DEF_STMT(NODE)	SSA_NAME_CHECK (NODE)->common.chain
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
--- 1026,1032 ----
  /* Returns the statement which defines this reference.   Note that
     we use the same field when chaining SSA_NAME nodes together on
     the SSA_NAME freelist.  */
! #define SSA_NAME_DEF_STMT(NODE)	SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
  
  /* Returns the SSA version number of this SSA name.  Note that in
     tree SSA, version numbers are not per variable and may be recycled.  */
*************** struct tree_ssa_name GTY(())
*** 1053,1058 ****
--- 1053,1061 ----
  
    /* SSA version number.  */
    unsigned int version;
+ 
+   /* The statement which defines this reference.  */
+   tree def_stmt;
  };
  
  /* In a PHI_NODE node.  */



More information about the Gcc-patches mailing list