public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bingfeng Mei" <bmei@broadcom.com>
To: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Derive more alias information from named address space
Date: Fri, 16 Sep 2011 16:11:00 -0000	[thread overview]
Message-ID: <7FB04A5C213E9943A72EE127DB74F0ADD15FCB0108@SJEXCHCCR02.corp.ad.broadcom.com> (raw)

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

             reply	other threads:[~2011-09-16 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 16:11 Bingfeng Mei [this message]
2011-09-19 11:56 ` Ulrich Weigand
2011-09-19 11:58   ` Bingfeng Mei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7FB04A5C213E9943A72EE127DB74F0ADD15FCB0108@SJEXCHCCR02.corp.ad.broadcom.com \
    --to=bmei@broadcom.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).