public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rony Paul <ronypaul77@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Re: about named address space
Date: Mon, 06 Jun 2011 19:33:00 -0000	[thread overview]
Message-ID: <BANLkTinwY5-S9-2SRKGVE+T_VPh2uvo3Ew@mail.gmail.com> (raw)
In-Reply-To: <BANLkTim7Ne_+Kq863GnJfMG6CUvy8amqYw@mail.gmail.com>

On Mon, Jun 6, 2011 at 11:34 AM, Rony Paul <ronypaul77@gmail.com> wrote:
> On Fri, May 27, 2011 at 4:51 PM, Ian Lance Taylor <iant@google.com> wrote:
>> Rony Paul <ronypaul77@gmail.com> writes:
>>
>>> suppose I have the following piece of code in my program.
>>>
>>>   extern  int __ea x;
>>>   int y;
>>>   y = x;
>>>
>>> that means I am copying data from one address space to another.
>>> in that case will the method spu_addr_space_convert (rtx op, tree
>>> from_type, tree to_type);  be called by the compiler?
>>> in the spu.c file the defination of " spu_addr_space_convert " is
>>> given. but when and under which condition they will be called ?
>>
>> I'm pretty sure it won't be called.  That function converts a pointer to
>> one address space into a pointer to a different address space.  No such
>> conversion is happening here.
>>
>>> where
>>> is it defined?
>>
>> The function spu_addr_space_convert is the SPU-specific implementation
>> of the target hook TARGET_ADDR_SPACE_CONVERT which is documented in the
>> section on named address spaces.
>>
>> Ian
>>
>
>
> Then if I want to prevent these type of copying data from one address
> space to another (ie. I dont want to allow these type of copy
> operation in my application). where should I write code in GCC
> compiler?
>
> Actually I can define different address space, but still I cant store
> there data in different byte order. would you give me any idea about
> how to store data in different byte order in different address space?
>
> -Rony
>  please suggest me,
>

in c-type.c file there are some code like :
===========================================================
 asl = TYPE_ADDR_SPACE (ttl);
 asr = TYPE_ADDR_SPACE (ttr);
      if (!null_pointer_constant_p (rhs)
	  && asr != asl && !targetm.addr_space.subset_p (asr, asl))
	{
	  switch (errtype)
	    {
	    case ic_argpass:
	      error_at (location, "passing argument %d of %qE from pointer to "
			"non-enclosed address space", parmnum, rname);
	      break;
	    case ic_assign:
	      error_at (location, "assignment from pointer to "
			"non-enclosed address space");
	      break;
	    case ic_init:
	      error_at (location, "initialization from pointer to "
			"non-enclosed address space");
	      break;
	    case ic_return:
	      error_at (location, "return from pointer to "
			"non-enclosed address space");
	      break;
	    default:
	      gcc_unreachable ();
	    }
	  return error_mark_node;
	}
-==================================================================

and in my program if I write code like,
 __ea int * p = malloc_ea(sizeof(int));
   int * v;
   p=v;

this returns error message  "assignment from pointer to non-enclosed
address space"
so, this checking for pointer of the different address space is done
for pointer. now if I want to add this check for data variable also,
what should I do. I cant understand, would you please help me?

ie. I want to write code like

extern  int __ea x;
int y;

and it should give error message like
"assignment from variable to non-enclosed address space"


Thanks

  reply	other threads:[~2011-06-06 15:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17 16:44 Rony Paul
2011-05-20 19:40 ` Rony Paul
2011-05-21  7:15   ` Ian Lance Taylor
2011-05-24 11:56     ` Rony Paul
2011-05-24 20:25       ` Ian Lance Taylor
2011-05-28  8:47         ` Rony Paul
2011-05-28 23:32           ` Ian Lance Taylor
2011-06-06 10:44             ` Rony Paul
2011-06-06 19:33               ` Rony Paul [this message]
2011-06-06 19:51                 ` Ian Lance Taylor
     [not found] <BANLkTinKZYCvTij1-7-X8+-_Zo_e77Y=8Q@mail.gmail.com>
     [not found] ` <mcr7ha63553.fsf@coign.corp.google.com>
2011-05-04 15:45   ` Rony Paul
2011-05-04 17:35     ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2011-05-02  9:18 Rony Paul
2011-05-02 20:14 ` Ian Lance Taylor

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=BANLkTinwY5-S9-2SRKGVE+T_VPh2uvo3Ew@mail.gmail.com \
    --to=ronypaul77@gmail.com \
    --cc=gcc-help@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).