Would alias analysis help WRT builtin memmove -> builtin memcpy ?
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Wed Mar 29 16:13:00 GMT 2000
> From: Jeffrey A Law <law@cygnus.com>
>
> In message < 200003292334.SAA02200@caip.rutgers.edu >you write:
> > Right, but then shouldn't it have returned set 0, not 11?
>
> Depends on the code :-) I believe if you had casted the arg to a void *
> then you would have got an alias set zero. Actually, wait, you have two
> pointers, not two MEMs -- how are you checking alias sets in that case
> since the alias set is a property of the MEM, not the address.
I wasn't doing any casting, but the prototype of memmove may have done
that for me.
Anway, here is what I am talking about. Assume the following is in a
new expand_builtin_memmove() routine, where `arglist' is the tree
chain of parameters passed to the expanded memmove call:
+ tree dst = TREE_VALUE (arglist);
+ tree src = TREE_VALUE (TREE_CHAIN (arglist));
+ tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+ const int dst_set = get_alias_set (dst);
+ const int src_set = get_alias_set (src);
+ const int len_set = get_alias_set (len);
+
+ fprintf (stderr, "src=%d, dst=%d, len=%d\n",
+ src_set, dst_set, len_set);
+
+ if (src_set <= 0 || dst_set <= 0 || src_set == dst_set)
+ return 0;
+ else
+ return expand_builtin_memcpy (arglist);
Given a call to memmove(int[], char[], size_t) I was getting 11, 11, 9
for the alias sets. Maybe I'm not using the type based aliasing
correctly. (Docs somewhere?) In any case, I'm now interested in the
base ptr aliasing code.
> So, no, I don't see a way to do easily what you want since our aliasing
> code is designed to work on MEMs, not addresses.
>
> You might be able to generate a MEM with the unknown alias set (-1 I think)
> and pass that to the aliasing routines. Not really sure.
> jeff
Okay, what routine?
I couldn't figure out what the relevant exported interface to the base
ptr aliasing I should try. Randomly looking in alias.c wasn't very
productive.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc
mailing list