More alias fiddling

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Mon Jun 5 04:01:00 GMT 2000


This removes now-unneeded calls to record_component_aliases and
uses the alias set of a component if it is addressable.  The latter
fixs the new C test and the old Fortran test.

Mon Jun  5 06:46:28 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* alias.c (get_alias_set): If compnent is addressable, use alias
	set of component.
	* c-decl.c (init_decl_processing): Don't call record_component_aliases.
	(grokdeclarator): Likewise.
	* c-typeck.c (common_type): Likewise.
	* cp/decl.c (init_decl_processing): Don't call
	record_component_aliases.
	* cp/tree.c (build_cplus_array_type_1): Likewise.

*** alias.c	2000/06/04 05:51:12	1.88
--- alias.c	2000/06/05 10:24:50
*************** get_alias_set (t)
*** 345,353 ****
    tree orig_t;
    HOST_WIDE_INT set;
-   HOST_WIDE_INT bitsize, bitpos;
-   tree offset;
-   enum machine_mode mode;
-   int volatilep, unsignedp;
-   unsigned int alignment;
  
    /* If we're not doing any alias analysis, just assume everything
--- 345,348 ----
*************** get_alias_set (t)
*** 377,386 ****
  	return set;
  
!       /* If this is a reference, go inside it and use the underlying
!          object.  */
!       if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r')
! 	t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode,
! 				 &unsignedp, &volatilep, &alignment);
  
        if (TREE_CODE (t) == INDIRECT_REF)
  	{
--- 372,407 ----
  	return set;
  
!       /* Now loop the same way as get_inner_reference and get the alias
! 	 set to use.  Pick up the outermost object that we could have
! 	 a pointer to.  */
!       while (1)
! 	{
! 	  /* Unnamed bitfields are not an addressable object.  */
! 	  if (TREE_CODE (t) == BIT_FIELD_REF)
! 	    ;
! 	  else if (TREE_CODE (t) == COMPONENT_REF)
! 	    {
! 	      if (! DECL_NONADDRESSABLE_P (TREE_OPERAND (t, 1)))
! 		/* Stop at an adressable decl.  */
! 		break;
! 	    }
! 	  else if (TREE_CODE (t) == ARRAY_REF)
! 	    {
! 	      if (! TYPE_NONALIASED_COMPONENT
! 		  (TREE_TYPE (TREE_OPERAND (t, 0))))
! 		/* Stop at an addresssable array element.  */
! 		break;
! 	    }
! 	  else if (TREE_CODE (t) != NON_LVALUE_EXPR
! 		   && ! ((TREE_CODE (t) == NOP_EXPR
! 		      || TREE_CODE (t) == CONVERT_EXPR)
! 		     && (TYPE_MODE (TREE_TYPE (t))
! 			 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (t, 0))))))
! 	    /* Stop if not one of above and not mode-preserving conversion. */
! 	    break;
  
+ 	  t = TREE_OPERAND (t, 0);
+ 	}
+ 		   
        if (TREE_CODE (t) == INDIRECT_REF)
  	{
*** c-decl.c	2000/06/03 01:57:44	1.117
--- c-decl.c	2000/06/05 10:25:17
*************** init_decl_processing ()
*** 3024,3031 ****
      = build_array_type (wchar_type_node, array_domain_type);
  
-   record_component_aliases (char_array_type_node);
-   record_component_aliases (int_array_type_node);
-   record_component_aliases (wchar_array_type_node);
- 
    void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
  
--- 3024,3027 ----
*************** grokdeclarator (declarator, declspecs, d
*** 4406,4410 ****
  	  if (type_quals)
  	    type = c_build_qualified_type (type, type_quals);
- 	  record_component_aliases (type);
  
  #if 0	/* don't clear these; leave them set so that the array type
--- 4402,4405 ----
*************** grokdeclarator (declarator, declspecs, d
*** 4579,4583 ****
      {
        type = build_array_type (TREE_TYPE (type), 0);
-       record_component_aliases (type);
        if (size_varies)
  	C_TYPE_VARIABLE_SIZE (type) = 1;
--- 4574,4577 ----
*************** grokdeclarator (declarator, declspecs, d
*** 4692,4696 ****
  							     type_quals),
  				     TYPE_DOMAIN (type));
- 	    record_component_aliases (type);
  #if 0 /* Leave the field const or volatile as well.  */
  	    type_quals = TYPE_UNQUALIFIED;
--- 4686,4689 ----
*************** grokdeclarator (declarator, declspecs, d
*** 4775,4779 ****
  							     type_quals),
  				     TYPE_DOMAIN (type));
- 	    record_component_aliases (type);
  #if 0 /* Leave the variable const or volatile as well.  */
  	    type_quals = TYPE_UNQUALIFIED;
--- 4768,4771 ----
*** c-typeck.c	2000/05/31 18:36:02	1.67
--- c-typeck.c	2000/06/05 10:25:40
*************** common_type (t1, t2)
*** 314,318 ****
  	/* Merge the element types, and have a size if either arg has one.  */
  	t1 = build_array_type (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2));
- 	record_component_aliases (t1);
  	return build_type_attribute_variant (t1, attributes);
        }
--- 314,317 ----
*** cp/decl.c	2000/06/04 21:12:26	1.625
--- cp/decl.c	2000/06/05 10:26:57
*************** init_decl_processing ()
*** 6479,6485 ****
      = build_array_type (integer_type_node, array_domain_type);
  
-   record_component_aliases (char_array_type_node);
-   record_component_aliases (int_array_type_node);
- 
    if (flag_new_abi)
      delta_type_node = ptrdiff_type_node;
--- 6479,6482 ----
*************** init_decl_processing ()
*** 6545,6549 ****
    wchar_array_type_node
      = build_array_type (wchar_type_node, array_domain_type);
-   record_component_aliases (wchar_array_type_node);
  
    if (flag_vtable_thunks)
--- 6542,6545 ----
*** cp/tree.c	2000/05/31 18:37:31	1.201
--- cp/tree.c	2000/06/05 10:27:08
*************** build_cplus_array_type_1 (elt_type, inde
*** 501,508 ****
      }
    else
!     {
!       t = build_array_type (elt_type, index_type);
!       record_component_aliases (t);
!     }
  
    /* Push these needs up so that initialization takes place
--- 501,505 ----
      }
    else
!     t = build_array_type (elt_type, index_type);
  
    /* Push these needs up so that initialization takes place


More information about the Gcc-patches mailing list