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]

new alias sets from the backend


The following patch is to centralize the distribution of alias
set numbers.  This allows the backend and middleend to allocate
new numbers to things known not to overlap with anything that
could have been touched by the front end.

Its first use is in the Alpha prologue/epilogue register save
and restore code.  On other systems, we've marked these memory
references RTX_UNCHANGING_P, which makes me nervous, because
they aren't.  I'd also gotten a post-reload abort for storing
into a bit of memory that was supposed to be constant.

The other thing I have in mind to use it for is varargs.  The
main sticking point there is that user code is given a pointer
(a REG) instead of a MEM.  Which makes me wonder if we can do
something about tagging pointers with their alias set, allowing
the information to propogate around as they are manipulated.
Is this a sensible thing to even be considering?  Or does the
arithmetic invalidate the alias set we might have had before?

In any case, this patch is quite simple, so I went ahead and
put it in so that I could reduce the accumulated Alpha backlog.


r~


	* tree.c (new_alias_set): New function.
	* tree.h (new_alias_set): Declare it.
	* c-common.c (c_get_alias_set): Use it.

Index: gcc/tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.c,v
retrieving revision 1.44
diff -c -p -d -r1.44 tree.c
*** tree.c	1998/08/26 08:11:42	1.44
--- tree.c	1998/09/21 01:43:36
*************** expr_check (node, ignored, file, line, n
*** 5061,5067 ****
  /* Return the alias set for T, which may be either a type or an
     expression.  */
  
! int get_alias_set (t)
       tree t;
  {
    if (!flag_strict_aliasing || !lang_get_alias_set)
--- 5061,5068 ----
  /* Return the alias set for T, which may be either a type or an
     expression.  */
  
! int
! get_alias_set (t)
       tree t;
  {
    if (!flag_strict_aliasing || !lang_get_alias_set)
*************** int get_alias_set (t)
*** 5070,5073 ****
--- 5071,5083 ----
      return 0;
    else
      return (*lang_get_alias_set) (t);
+ }
+ 
+ /* Return a brand-new alias set.  */
+ 
+ int
+ new_alias_set ()
+ {
+   static int last_alias_set;
+   return ++last_alias_set;
  }
Index: gcc/tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tree.h,v
retrieving revision 1.53
diff -c -p -d -r1.53 tree.h
*** tree.h	1998/09/15 19:19:02	1.53
--- tree.h	1998/09/21 01:43:36
*************** extern tree get_set_constructor_bits		PR
*** 1865,1870 ****
--- 1865,1871 ----
  extern tree get_set_constructor_bytes		PROTO((tree,
  						       unsigned char *, int));
  extern int get_alias_set                        PROTO((tree));
+ extern int new_alias_set			PROTO((void));
  extern int (*lang_get_alias_set)                PROTO((tree));
  
  /* In stmt.c */
Index: gcc/c-common.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/c-common.c,v
retrieving revision 1.31
diff -c -p -d -r1.31 c-common.c
*** c-common.c	1998/09/02 09:59:54	1.31
--- c-common.c	1998/09/21 01:43:43
*************** int
*** 2984,2990 ****
  c_get_alias_set (t)
       tree t;
  {
-   static int next_set = 0;
    tree type;
  
    if (t == error_mark_node)
--- 2984,2989 ----
*************** c_get_alias_set (t)
*** 3060,3065 ****
  
    /* TYPE is something we haven't seen before.  Put it in a new alias
       set.  */
!   TYPE_ALIAS_SET (type) = ++next_set;
    return TYPE_ALIAS_SET (type);
  }
--- 3059,3064 ----
  
    /* TYPE is something we haven't seen before.  Put it in a new alias
       set.  */
!   TYPE_ALIAS_SET (type) = new_alias_set ();
    return TYPE_ALIAS_SET (type);
  }


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