[PATCH] Merge the two type comparison caches

Richard Guenther rguenther@suse.de
Fri Jul 23 14:00:00 GMT 2010


This should reduce memory footprint somewhat.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2010-07-23  Richard Guenther  <rguenther@suse.de>

	* lto-symtab.c (lto_symtab_merge): Use gtc_mode enum
	values.
	(lto_symtab_merge_decls_2): Likewise.
	* tree-ssa.c (useless_type_conversion_p): Likewise.
	* lto-streamer-in.c (input_gimple_stmt): Likewise.
	* gimple.c (gtc_visited2, gtc_ob2): Remove.
	(struct type_pair_d): Make same_p an array indexed by mode.
	Update comment.
	(lookup_type_pair): Update initialization.
	(struct sccs): Adjust same_p type.
	(gimple_types_compatible_p_1, gtc_visit, gimple_types_compatible_p):
	Adjust.
	(print_gimple_types_stats): Likewise.
	* gimple.h (enum gtc_mode): New.
	(gimple_types_compatible_p): Adjust prototype.

Index: gcc/lto-symtab.c
===================================================================
*** gcc/lto-symtab.c	(revision 162450)
--- gcc/lto-symtab.c	(working copy)
*************** lto_symtab_merge (lto_symtab_entry_t pre
*** 349,355 ****
    if (TREE_CODE (decl) == FUNCTION_DECL)
      {
        if (!gimple_types_compatible_p (TREE_TYPE (prevailing_decl),
! 				      TREE_TYPE (decl), false))
  	/* If we don't have a merged type yet...sigh.  The linker
  	   wouldn't complain if the types were mismatched, so we
  	   probably shouldn't either.  Just use the type from
--- 349,355 ----
    if (TREE_CODE (decl) == FUNCTION_DECL)
      {
        if (!gimple_types_compatible_p (TREE_TYPE (prevailing_decl),
! 				      TREE_TYPE (decl), GTC_DIAG))
  	/* If we don't have a merged type yet...sigh.  The linker
  	   wouldn't complain if the types were mismatched, so we
  	   probably shouldn't either.  Just use the type from
*************** lto_symtab_merge (lto_symtab_entry_t pre
*** 382,388 ****
       fixup process didn't yet run.  */
    prevailing_type = gimple_register_type (prevailing_type);
    type = gimple_register_type (type);
!   if (!gimple_types_compatible_p (prevailing_type, type, false))
      {
        if (COMPLETE_TYPE_P (type))
  	return false;
--- 382,388 ----
       fixup process didn't yet run.  */
    prevailing_type = gimple_register_type (prevailing_type);
    type = gimple_register_type (type);
!   if (!gimple_types_compatible_p (prevailing_type, type, GTC_DIAG))
      {
        if (COMPLETE_TYPE_P (type))
  	return false;
*************** lto_symtab_merge (lto_symtab_entry_t pre
*** 408,414 ****
  	    return false;
  
  	  if (!gimple_types_compatible_p (gimple_register_type (tem1),
! 					  gimple_register_type (tem2), false))
  	    return false;
  	}
  
--- 408,415 ----
  	    return false;
  
  	  if (!gimple_types_compatible_p (gimple_register_type (tem1),
! 					  gimple_register_type (tem2),
! 					  GTC_DIAG))
  	    return false;
  	}
  
*************** lto_symtab_merge_decls_2 (void **slot)
*** 603,609 ****
    for (i = 0; VEC_iterate (tree, mismatches, i, decl); ++i)
      {
        if (!gimple_types_compatible_p (TREE_TYPE (prevailing->decl),
! 				      TREE_TYPE (decl), false))
  	diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
  				   "type of %qD does not match original "
  				   "declaration", decl);
--- 604,610 ----
    for (i = 0; VEC_iterate (tree, mismatches, i, decl); ++i)
      {
        if (!gimple_types_compatible_p (TREE_TYPE (prevailing->decl),
! 				      TREE_TYPE (decl), GTC_DIAG))
  	diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
  				   "type of %qD does not match original "
  				   "declaration", decl);
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c	(revision 162450)
--- gcc/tree-ssa.c	(working copy)
*************** useless_type_conversion_p (tree outer_ty
*** 1427,1433 ****
    else if (AGGREGATE_TYPE_P (inner_type)
  	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
      return (in_lto_p
! 	    && gimple_types_compatible_p (outer_type, inner_type, false));
  
    return false;
  }
--- 1427,1433 ----
    else if (AGGREGATE_TYPE_P (inner_type)
  	   && TREE_CODE (inner_type) == TREE_CODE (outer_type))
      return (in_lto_p
! 	    && gimple_types_compatible_p (outer_type, inner_type, GTC_DIAG));
  
    return false;
  }
Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c	(revision 162450)
--- gcc/gimple.c	(working copy)
*************** static struct pointer_map_t *type_hash_c
*** 47,54 ****
  /* Global type comparison cache.  */
  static htab_t gtc_visited;
  static struct obstack gtc_ob;
- static htab_t gtc_visited2;
- static struct obstack gtc_ob2;
  
  /* All the tuples have their operand vector (if present) at the very bottom
     of the structure.  Therefore, the offset required to find the
--- 47,52 ----
*************** static hashval_t gimple_type_hash (const
*** 3157,3176 ****
  
  /* Structure used to maintain a cache of some type pairs compared by
     gimple_types_compatible_p when comparing aggregate types.  There are
!    four possible values for SAME_P:
  
     	-2: The pair (T1, T2) has just been inserted in the table.
- 	-1: The pair (T1, T2) is currently being compared.
  	 0: T1 and T2 are different types.
  	 1: T1 and T2 are the same type.
  
!    This table is only used when comparing aggregate types to avoid
!    infinite recursion due to self-referential types.  */
  struct type_pair_d
  {
    unsigned int uid1;
    unsigned int uid2;
!   int same_p;
  };
  typedef struct type_pair_d *type_pair_t;
  
--- 3155,3174 ----
  
  /* Structure used to maintain a cache of some type pairs compared by
     gimple_types_compatible_p when comparing aggregate types.  There are
!    three possible values for SAME_P:
  
     	-2: The pair (T1, T2) has just been inserted in the table.
  	 0: T1 and T2 are different types.
  	 1: T1 and T2 are the same type.
  
!    The two elements in the SAME_P array are indexed by the comparison
!    mode gtc_mode.  */
! 
  struct type_pair_d
  {
    unsigned int uid1;
    unsigned int uid2;
!   signed char same_p[2];
  };
  typedef struct type_pair_d *type_pair_t;
  
*************** lookup_type_pair (tree t1, tree t2, htab
*** 3227,3233 ****
        p = XOBNEW (ob_p, struct type_pair_d);
        p->uid1 = TYPE_UID (t1);
        p->uid2 = TYPE_UID (t2);
!       p->same_p = -2;
        *slot = (void *) p;
      }
  
--- 3225,3232 ----
        p = XOBNEW (ob_p, struct type_pair_d);
        p->uid1 = TYPE_UID (t1);
        p->uid2 = TYPE_UID (t2);
!       p->same_p[0] = -2;
!       p->same_p[1] = -2;
        *slot = (void *) p;
      }
  
*************** struct sccs
*** 3246,3252 ****
    bool on_sccstack;
    union {
      hashval_t hash;
!     int same_p;
    } u;
  };
  
--- 3245,3251 ----
    bool on_sccstack;
    union {
      hashval_t hash;
!     signed char same_p;
    } u;
  };
  
*************** gimple_compatible_complete_and_incomplet
*** 3366,3372 ****
  }
  
  static bool
! gimple_types_compatible_p_1 (tree, tree, bool, VEC(type_pair_t, heap) **,
  			     struct pointer_map_t *, struct obstack *);
  
  /* DFS visit the edge from the callers type pair with state *STATE to
--- 3365,3372 ----
  }
  
  static bool
! gimple_types_compatible_p_1 (tree, tree, enum gtc_mode, type_pair_t,
! 			     VEC(type_pair_t, heap) **,
  			     struct pointer_map_t *, struct obstack *);
  
  /* DFS visit the edge from the callers type pair with state *STATE to
*************** gimple_types_compatible_p_1 (tree, tree,
*** 3376,3382 ****
     SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done.  */
  
  static bool
! gtc_visit (tree t1, tree t2, bool for_merging_p,
  	   struct sccs *state,
  	   VEC(type_pair_t, heap) **sccstack,
  	   struct pointer_map_t *sccstate,
--- 3376,3382 ----
     SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done.  */
  
  static bool
! gtc_visit (tree t1, tree t2, enum gtc_mode mode,
  	   struct sccs *state,
  	   VEC(type_pair_t, heap) **sccstack,
  	   struct pointer_map_t *sccstate,
*************** gtc_visit (tree t1, tree t2, bool for_me
*** 3456,3488 ****
      return false;
  
    /* Allocate a new cache entry for this comparison.  */
!   p = lookup_type_pair (t1, t2,
! 			for_merging_p ? &gtc_visited : &gtc_visited2,
! 			for_merging_p ? &gtc_ob : &gtc_ob2);
!   if (p->same_p == 0 || p->same_p == 1)
      {
        /* We have already decided whether T1 and T2 are the
  	 same, return the cached result.  */
!       return p->same_p == 1;
      }
  
-   gcc_assert (p->same_p == -2);
- 
    if ((slot = pointer_map_contains (sccstate, p)) != NULL)
      cstate = (struct sccs *)*slot;
    if (!cstate)
      {
        bool res;
        /* Not yet visited.  DFS recurse.  */
!       res = gimple_types_compatible_p_1 (t1, t2, for_merging_p,
  					 sccstack, sccstate, sccstate_obstack);
        if (!cstate)
  	cstate = (struct sccs *)* pointer_map_contains (sccstate, p);
        state->low = MIN (state->low, cstate->low);
        /* If the type is no longer on the SCC stack and thus is not part
! 	 of the parents SCC mix in its hash value.  Otherwise we will
! 	 ignore the type for hashing purposes and return the unaltered
! 	 hash value.  */
        if (!cstate->on_sccstack)
  	return res;
      }
--- 3456,3483 ----
      return false;
  
    /* Allocate a new cache entry for this comparison.  */
!   p = lookup_type_pair (t1, t2, &gtc_visited, &gtc_ob);
!   if (p->same_p[mode] == 0 || p->same_p[mode] == 1)
      {
        /* We have already decided whether T1 and T2 are the
  	 same, return the cached result.  */
!       return p->same_p[mode] == 1;
      }
  
    if ((slot = pointer_map_contains (sccstate, p)) != NULL)
      cstate = (struct sccs *)*slot;
    if (!cstate)
      {
        bool res;
        /* Not yet visited.  DFS recurse.  */
!       res = gimple_types_compatible_p_1 (t1, t2, mode, p,
  					 sccstack, sccstate, sccstate_obstack);
        if (!cstate)
  	cstate = (struct sccs *)* pointer_map_contains (sccstate, p);
        state->low = MIN (state->low, cstate->low);
        /* If the type is no longer on the SCC stack and thus is not part
! 	 of the parents SCC, return its state.  Otherwise we will
! 	 ignore this pair and assume equality.  */
        if (!cstate->on_sccstack)
  	return res;
      }
*************** gtc_visit (tree t1, tree t2, bool for_me
*** 3498,3516 ****
     SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done.  */
  
  static bool
! gimple_types_compatible_p_1 (tree t1, tree t2, bool for_merging_p,
  			     VEC(type_pair_t, heap) **sccstack,
  			     struct pointer_map_t *sccstate,
  			     struct obstack *sccstate_obstack)
  {
-   type_pair_t p;
    struct sccs *state;
  
!   /* Allocate a new cache entry for this comparison.  */
!   p = lookup_type_pair (t1, t2,
! 			for_merging_p ? &gtc_visited : &gtc_visited2,
! 			for_merging_p ? &gtc_ob : &gtc_ob2);
!   gcc_assert (p->same_p == -2);
  
    state = XOBNEW (sccstate_obstack, struct sccs);
    *pointer_map_insert (sccstate, p) = state;
--- 3493,3507 ----
     SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done.  */
  
  static bool
! gimple_types_compatible_p_1 (tree t1, tree t2, enum gtc_mode mode,
! 			     type_pair_t p,
  			     VEC(type_pair_t, heap) **sccstack,
  			     struct pointer_map_t *sccstate,
  			     struct obstack *sccstate_obstack)
  {
    struct sccs *state;
  
!   gcc_assert (p->same_p[mode] == -2);
  
    state = XOBNEW (sccstate_obstack, struct sccs);
    *pointer_map_insert (sccstate, p) = state;
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3529,3535 ****
      {
      case VECTOR_TYPE:
      case COMPLEX_TYPE:
!       if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), for_merging_p,
  		      state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
        goto same_types;
--- 3520,3526 ----
      {
      case VECTOR_TYPE:
      case COMPLEX_TYPE:
!       if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), mode,
  		      state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
        goto same_types;
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3537,3543 ****
      case ARRAY_TYPE:
        /* Array types are the same if the element types are the same and
  	 the number of elements are the same.  */
!       if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), for_merging_p,
  		      state, sccstack, sccstate, sccstate_obstack)
  	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
  	  || TYPE_NONALIASED_COMPONENT (t1) != TYPE_NONALIASED_COMPONENT (t2))
--- 3528,3534 ----
      case ARRAY_TYPE:
        /* Array types are the same if the element types are the same and
  	 the number of elements are the same.  */
!       if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), mode,
  		      state, sccstack, sccstate, sccstate_obstack)
  	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
  	  || TYPE_NONALIASED_COMPONENT (t1) != TYPE_NONALIASED_COMPONENT (t2))
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3587,3594 ****
      case METHOD_TYPE:
        /* Method types should belong to the same class.  */
        if (!gtc_visit (TYPE_METHOD_BASETYPE (t1), TYPE_METHOD_BASETYPE (t2),
! 		      for_merging_p,
! 		      state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
  
        /* Fallthru  */
--- 3578,3584 ----
      case METHOD_TYPE:
        /* Method types should belong to the same class.  */
        if (!gtc_visit (TYPE_METHOD_BASETYPE (t1), TYPE_METHOD_BASETYPE (t2),
! 		      mode, state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
  
        /* Fallthru  */
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3596,3605 ****
      case FUNCTION_TYPE:
        /* Function types are the same if the return type and arguments types
  	 are the same.  */
!       if ((for_merging_p
  	   || !gimple_compatible_complete_and_incomplete_subtype_p
  	         (TREE_TYPE (t1), TREE_TYPE (t2)))
! 	  && !gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), for_merging_p,
  			 state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
  
--- 3586,3595 ----
      case FUNCTION_TYPE:
        /* Function types are the same if the return type and arguments types
  	 are the same.  */
!       if ((mode != GTC_DIAG
  	   || !gimple_compatible_complete_and_incomplete_subtype_p
  	         (TREE_TYPE (t1), TREE_TYPE (t2)))
! 	  && !gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), mode,
  			 state, sccstack, sccstate, sccstate_obstack))
  	goto different_types;
  
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3616,3626 ****
  	       parms1 && parms2;
  	       parms1 = TREE_CHAIN (parms1), parms2 = TREE_CHAIN (parms2))
  	    {
! 	      if ((for_merging_p
  		   || !gimple_compatible_complete_and_incomplete_subtype_p
  		         (TREE_VALUE (parms1), TREE_VALUE (parms2)))
! 		  && !gtc_visit (TREE_VALUE (parms1), TREE_VALUE (parms2),
! 				 for_merging_p,
  				 state, sccstack, sccstate, sccstate_obstack))
  		goto different_types;
  	    }
--- 3606,3615 ----
  	       parms1 && parms2;
  	       parms1 = TREE_CHAIN (parms1), parms2 = TREE_CHAIN (parms2))
  	    {
! 	      if ((mode == GTC_MERGE
  		   || !gimple_compatible_complete_and_incomplete_subtype_p
  		         (TREE_VALUE (parms1), TREE_VALUE (parms2)))
! 		  && !gtc_visit (TREE_VALUE (parms1), TREE_VALUE (parms2), mode,
  				 state, sccstack, sccstate, sccstate_obstack))
  		goto different_types;
  	    }
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3633,3642 ****
  
      case OFFSET_TYPE:
        {
! 	if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), for_merging_p,
  			state, sccstack, sccstate, sccstate_obstack)
  	    || !gtc_visit (TYPE_OFFSET_BASETYPE (t1),
! 			   TYPE_OFFSET_BASETYPE (t2), for_merging_p,
  			   state, sccstack, sccstate, sccstate_obstack))
  	  goto different_types;
  
--- 3622,3631 ----
  
      case OFFSET_TYPE:
        {
! 	if (!gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), mode,
  			state, sccstack, sccstate, sccstate_obstack)
  	    || !gtc_visit (TYPE_OFFSET_BASETYPE (t1),
! 			   TYPE_OFFSET_BASETYPE (t2), mode,
  			   state, sccstack, sccstate, sccstate_obstack))
  	  goto different_types;
  
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3653,3666 ****
  
  	/* If one pointer points to an incomplete type variant of
  	   the other pointed-to type they are the same.  */
! 	if (!for_merging_p
  	    && gimple_compatible_complete_and_incomplete_subtype_p
  	         (TREE_TYPE (t1), TREE_TYPE (t2)))
  	  goto same_types;
  
  	/* Otherwise, pointer and reference types are the same if the
  	   pointed-to types are the same.  */
! 	if (gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), for_merging_p,
  		       state, sccstack, sccstate, sccstate_obstack))
  	  goto same_types;
  
--- 3642,3655 ----
  
  	/* If one pointer points to an incomplete type variant of
  	   the other pointed-to type they are the same.  */
! 	if (mode == GTC_DIAG
  	    && gimple_compatible_complete_and_incomplete_subtype_p
  	         (TREE_TYPE (t1), TREE_TYPE (t2)))
  	  goto same_types;
  
  	/* Otherwise, pointer and reference types are the same if the
  	   pointed-to types are the same.  */
! 	if (gtc_visit (TREE_TYPE (t1), TREE_TYPE (t2), mode,
  		       state, sccstack, sccstate, sccstate_obstack))
  	  goto same_types;
  
*************** gimple_types_compatible_p_1 (tree t1, tr
*** 3756,3762 ****
  	    if (DECL_NAME (f1) != DECL_NAME (f2)
  		|| DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
  		|| !gimple_compare_field_offset (f1, f2)
! 		|| !gtc_visit (TREE_TYPE (f1), TREE_TYPE (f2), for_merging_p,
  			       state, sccstack, sccstate, sccstate_obstack))
  	      goto different_types;
  	  }
--- 3745,3751 ----
  	    if (DECL_NAME (f1) != DECL_NAME (f2)
  		|| DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
  		|| !gimple_compare_field_offset (f1, f2)
! 		|| !gtc_visit (TREE_TYPE (f1), TREE_TYPE (f2), mode,
  			       state, sccstack, sccstate, sccstate_obstack))
  	      goto different_types;
  	  }
*************** pop:
*** 3795,3801 ****
  	  x = VEC_pop (type_pair_t, *sccstack);
  	  cstate = (struct sccs *)*pointer_map_contains (sccstate, x);
  	  cstate->on_sccstack = false;
! 	  x->same_p = cstate->u.same_p;
  	}
        while (x != p);
      }
--- 3784,3790 ----
  	  x = VEC_pop (type_pair_t, *sccstack);
  	  cstate = (struct sccs *)*pointer_map_contains (sccstate, x);
  	  cstate->on_sccstack = false;
! 	  x->same_p[mode] = cstate->u.same_p;
  	}
        while (x != p);
      }
*************** pop:
*** 3808,3814 ****
     are considered different, otherwise they are considered compatible.  */
  
  bool
! gimple_types_compatible_p (tree t1, tree t2, bool for_merging_p)
  {
    VEC(type_pair_t, heap) *sccstack = NULL;
    struct pointer_map_t *sccstate;
--- 3797,3803 ----
     are considered different, otherwise they are considered compatible.  */
  
  bool
! gimple_types_compatible_p (tree t1, tree t2, enum gtc_mode mode)
  {
    VEC(type_pair_t, heap) *sccstack = NULL;
    struct pointer_map_t *sccstate;
*************** gimple_types_compatible_p (tree t1, tree
*** 3889,3909 ****
  
    /* If we've visited this type pair before (in the case of aggregates
       with self-referential types), and we made a decision, return it.  */
!   p = lookup_type_pair (t1, t2,
! 			for_merging_p ? &gtc_visited : &gtc_visited2,
! 			for_merging_p ? &gtc_ob : &gtc_ob2);
!   if (p->same_p == 0 || p->same_p == 1)
      {
        /* We have already decided whether T1 and T2 are the
  	 same, return the cached result.  */
!       return p->same_p == 1;
      }
  
    /* Now set up the SCC machinery for the comparison.  */
    gtc_next_dfs_num = 1;
    sccstate = pointer_map_create ();
    gcc_obstack_init (&sccstate_obstack);
!   res = gimple_types_compatible_p_1 (t1, t2, for_merging_p,
  				     &sccstack, sccstate, &sccstate_obstack);
    VEC_free (type_pair_t, heap, sccstack);
    pointer_map_destroy (sccstate);
--- 3878,3896 ----
  
    /* If we've visited this type pair before (in the case of aggregates
       with self-referential types), and we made a decision, return it.  */
!   p = lookup_type_pair (t1, t2, &gtc_visited, &gtc_ob);
!   if (p->same_p[mode] == 0 || p->same_p[mode] == 1)
      {
        /* We have already decided whether T1 and T2 are the
  	 same, return the cached result.  */
!       return p->same_p[mode] == 1;
      }
  
    /* Now set up the SCC machinery for the comparison.  */
    gtc_next_dfs_num = 1;
    sccstate = pointer_map_create ();
    gcc_obstack_init (&sccstate_obstack);
!   res = gimple_types_compatible_p_1 (t1, t2, mode, p,
  				     &sccstack, sccstate, &sccstate_obstack);
    VEC_free (type_pair_t, heap, sccstack);
    pointer_map_destroy (sccstate);
*************** gimple_type_eq (const void *p1, const vo
*** 4210,4216 ****
    const_tree t1 = (const_tree) p1;
    const_tree t2 = (const_tree) p2;
    return gimple_types_compatible_p (CONST_CAST_TREE (t1),
! 				    CONST_CAST_TREE (t2), true);
  }
  
  
--- 4197,4203 ----
    const_tree t1 = (const_tree) p1;
    const_tree t2 = (const_tree) p2;
    return gimple_types_compatible_p (CONST_CAST_TREE (t1),
! 				    CONST_CAST_TREE (t2), GTC_MERGE);
  }
  
  
*************** print_gimple_types_stats (void)
*** 4323,4329 ****
    else
      fprintf (stderr, "GIMPLE type table is empty\n");
    if (gtc_visited)
!     fprintf (stderr, "GIMPLE type merging comparison table: size %ld, %ld "
  	     "elements, %ld searches, %ld collisions (ratio: %f)\n",
  	     (long) htab_size (gtc_visited),
  	     (long) htab_elements (gtc_visited),
--- 4310,4316 ----
    else
      fprintf (stderr, "GIMPLE type table is empty\n");
    if (gtc_visited)
!     fprintf (stderr, "GIMPLE type comparison table: size %ld, %ld "
  	     "elements, %ld searches, %ld collisions (ratio: %f)\n",
  	     (long) htab_size (gtc_visited),
  	     (long) htab_elements (gtc_visited),
*************** print_gimple_types_stats (void)
*** 4331,4346 ****
  	     (long) gtc_visited->collisions,
  	     htab_collisions (gtc_visited));
    else
-     fprintf (stderr, "GIMPLE type merging comparison table is empty\n");
-   if (gtc_visited2)
-     fprintf (stderr, "GIMPLE type comparison table: size %ld, %ld "
- 	     "elements, %ld searches, %ld collisions (ratio: %f)\n",
- 	     (long) htab_size (gtc_visited2),
- 	     (long) htab_elements (gtc_visited2),
- 	     (long) gtc_visited2->searches,
- 	     (long) gtc_visited2->collisions,
- 	     htab_collisions (gtc_visited2));
-   else
      fprintf (stderr, "GIMPLE type comparison table is empty\n");
  }
  
--- 4318,4323 ----
*************** free_gimple_type_tables (void)
*** 4369,4380 ****
        obstack_free (&gtc_ob, NULL);
        gtc_visited = NULL;
      }
-   if (gtc_visited2)
-     {
-       htab_delete (gtc_visited2);
-       obstack_free (&gtc_ob2, NULL);
-       gtc_visited2 = NULL;
-     }
  }
  
  
--- 4346,4351 ----
Index: gcc/gimple.h
===================================================================
*** gcc/gimple.h	(revision 162450)
--- gcc/gimple.h	(working copy)
*************** extern tree get_call_expr_in (tree t);
*** 956,962 ****
  extern void recalculate_side_effects (tree);
  extern bool gimple_compare_field_offset (tree, tree);
  extern tree gimple_register_type (tree);
! extern bool gimple_types_compatible_p (tree, tree, bool);
  extern void print_gimple_types_stats (void);
  extern void free_gimple_type_tables (void);
  extern tree gimple_unsigned_type (tree);
--- 956,963 ----
  extern void recalculate_side_effects (tree);
  extern bool gimple_compare_field_offset (tree, tree);
  extern tree gimple_register_type (tree);
! enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 };
! extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode);
  extern void print_gimple_types_stats (void);
  extern void free_gimple_type_tables (void);
  extern tree gimple_unsigned_type (tree);



More information about the Gcc-patches mailing list