* Derive more alias information from named address space
@ 2011-09-16 16:11 Bingfeng Mei
2011-09-19 11:56 ` Ulrich Weigand
0 siblings, 1 reply; 3+ messages in thread
From: Bingfeng Mei @ 2011-09-16 16:11 UTC (permalink / raw)
To: gcc
Hi,
I am trying to implement named address space for our target.
In alias.c, I found the following piece of code several times.
/* If we have MEMs refering to different address spaces (which can
potentially overlap), we cannot easily tell from the addresses
whether the references overlap. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
return 1;
I think we can do better with the existing target hook:
- Target Hook: bool TARGET_ADDR_SPACE_SUBSET_P (addr_space_t superset, addr_space_t subset)
If A is not subset of B and B is not subset of A, we can conclude
they are either disjoint or overlapped. According to standard draft
(section 3.1.3),
"For any two address spaces, either the address spaces must be
disjoint, they must be equivalent, or one must be a subset of
the other. Other forms of overlapping are not permitted."
Therefore, A & B could only be disjoint, i.e., not aliased to each other.
We should be able to write:
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
{
if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem), MEM_ADDR_SPACE (x))
&& !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x), MEM_ADDR_SPACE (mem)))
return 0;
else
return 1;
}
Is this correct?
Thanks,
Bingfeng Mei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Derive more alias information from named address space
2011-09-16 16:11 Derive more alias information from named address space Bingfeng Mei
@ 2011-09-19 11:56 ` Ulrich Weigand
2011-09-19 11:58 ` Bingfeng Mei
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2011-09-19 11:56 UTC (permalink / raw)
To: Bingfeng Mei; +Cc: gcc
Bingfeng Mei wrote:
> Therefore, A & B could only be disjoint, i.e., not aliased to each other.
> We should be able to write:
>
> if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
> {
> if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem), MEM_ADDR_SPACE (x))
> && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x), MEM_ADDR_SPACE (mem)))
> return 0;
> else
> return 1;
> }
>
> Is this correct?
Yes, this looks correct to me ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Derive more alias information from named address space
2011-09-19 11:56 ` Ulrich Weigand
@ 2011-09-19 11:58 ` Bingfeng Mei
0 siblings, 0 replies; 3+ messages in thread
From: Bingfeng Mei @ 2011-09-19 11:58 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gcc
Thanks. I will prepare a patch.
Bingfeng
> -----Original Message-----
> From: Ulrich Weigand [mailto:uweigand@de.ibm.com]
> Sent: 19 September 2011 12:56
> To: Bingfeng Mei
> Cc: gcc@gcc.gnu.org
> Subject: Re: Derive more alias information from named address space
>
> Bingfeng Mei wrote:
>
> > Therefore, A & B could only be disjoint, i.e., not aliased to each
> other.
> > We should be able to write:
> >
> > if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
> > {
> > if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem),
> MEM_ADDR_SPACE (x))
> > && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x),
> MEM_ADDR_SPACE (mem)))
> > return 0;
> > else
> > return 1;
> > }
> >
> > Is this correct?
>
> Yes, this looks correct to me ...
>
> Bye,
> Ulrich
>
> --
> Dr. Ulrich Weigand
> GNU Toolchain for Linux on System z and Cell BE
> Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-19 11:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16 16:11 Derive more alias information from named address space Bingfeng Mei
2011-09-19 11:56 ` Ulrich Weigand
2011-09-19 11:58 ` Bingfeng Mei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).