public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Supporting multiple pointer sizes in GCC
@ 2011-03-25 12:33 Jayant R. Sonar
  2011-03-25 17:39 ` DJ Delorie
  0 siblings, 1 reply; 8+ messages in thread
From: Jayant R. Sonar @ 2011-03-25 12:33 UTC (permalink / raw)
  To: gcc

Hello,

Is it possible to support multiple pointer sizes (e.g. 16bit, 32bit)
which can co-exist in single compilation unit?

I want to add this support in backend code of a target architecture 
for C and C++ languages.

I referred an old discussion about same topic on following URL:
http://gcc.gnu.org/ml/gcc/2006-08/msg00067.html

However, even after going through this discussion I am still not very
clear about this.

Whether it is supported in GCC now?
Is there any other architecture which has this feature already 
implemented?

Regards,
Jayant Sonar


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-25 12:33 Supporting multiple pointer sizes in GCC Jayant R. Sonar
@ 2011-03-25 17:39 ` DJ Delorie
  2011-03-25 17:53   ` Paul Koning
  0 siblings, 1 reply; 8+ messages in thread
From: DJ Delorie @ 2011-03-25 17:39 UTC (permalink / raw)
  To: Jayant R. Sonar; +Cc: gcc


"Jayant R. Sonar" <Jayant.Sonar@kpitcummins.com> writes:
> Is it possible to support multiple pointer sizes (e.g. 16bit, 32bit)
> which can co-exist in single compilation unit?
> Whether it is supported in GCC now?
> Is there any other architecture which has this feature already 
> implemented?

Yes, there are three that I know of - mips64, s390 (tpf), and m32c.

Although, these days, you might be better served by looking into the
named-address-space stuff instead.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-25 17:39 ` DJ Delorie
@ 2011-03-25 17:53   ` Paul Koning
  2011-03-25 18:51     ` DJ Delorie
  2011-03-28 12:27     ` Jayant R. Sonar
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Koning @ 2011-03-25 17:53 UTC (permalink / raw)
  To: DJ Delorie; +Cc: Jayant R. Sonar, gcc


On Mar 25, 2011, at 1:37 PM, DJ Delorie wrote:

> 
> "Jayant R. Sonar" <Jayant.Sonar@kpitcummins.com> writes:
>> Is it possible to support multiple pointer sizes (e.g. 16bit, 32bit)
>> which can co-exist in single compilation unit?
>> Whether it is supported in GCC now?
>> Is there any other architecture which has this feature already 
>> implemented?
> 
> Yes, there are three that I know of - mips64, s390 (tpf), and m32c.

?  MIPS has two pointer sizes, but a given compilation (gcc invocation) uses only one of them, it comes from the chosen ABI.

	paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-25 17:53   ` Paul Koning
@ 2011-03-25 18:51     ` DJ Delorie
  2011-03-28 12:27     ` Jayant R. Sonar
  1 sibling, 0 replies; 8+ messages in thread
From: DJ Delorie @ 2011-03-25 18:51 UTC (permalink / raw)
  To: Paul Koning; +Cc: gcc


> ?  MIPS has two pointer sizes, but a given compilation (gcc
> invocation) uses only one of them, it comes from the chosen ABI.

You can still override it with __attribute__((mode(SI))) or
__attribute__((mode(DI))) for some configurations.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Supporting multiple pointer sizes in GCC
  2011-03-25 17:53   ` Paul Koning
  2011-03-25 18:51     ` DJ Delorie
@ 2011-03-28 12:27     ` Jayant R. Sonar
  2011-03-30 13:37       ` Claudiu Zissulescu
  1 sibling, 1 reply; 8+ messages in thread
From: Jayant R. Sonar @ 2011-03-28 12:27 UTC (permalink / raw)
  To: Paul Koning, DJ Delorie; +Cc: gcc

>?  MIPS has two pointer sizes, but a given compilation (gcc 
> invocation) uses only one of them, it comes from the chosen ABI.

Yes, it looks like MIPS have got 2 ABIs - 32bit and 64bit. The choice
of the ABI is controlled through a command line option '-march=arch'. 
Therefore in MIPS it doesn't look possible to have 2 pointers of 
different sizes existing simultaneously inside a single executable.

Whereas, what I am looking forward to do is adding some target 
specific data attributes, say data16 and data32. In a simple test case 
I should be able to declare two different pointer variables using these
attributes as following:

char * ptrABC __attribute__ (data16);
char * ptrXYZ __attribute__ (data32);

The size of ptrABC should be 16bits and that of ptrXYZ should 
be 32bits.

Will it be possible to do something like this in GCC?

Regards,
Jayant
 

-----Original Message-----
From: Paul Koning [mailto:paul_koning@dell.com] 
Sent: Friday, March 25, 2011 11:20 PM
To: DJ Delorie
Cc: Jayant R. Sonar; gcc@gcc.gnu.org
Subject: Re: Supporting multiple pointer sizes in GCC


On Mar 25, 2011, at 1:37 PM, DJ Delorie wrote:

> 
> "Jayant R. Sonar" <Jayant.Sonar@kpitcummins.com> writes:
>> Is it possible to support multiple pointer sizes (e.g. 16bit, 32bit)
>> which can co-exist in single compilation unit?
>> Whether it is supported in GCC now?
>> Is there any other architecture which has this feature already 
>> implemented?
> 
> Yes, there are three that I know of - mips64, s390 (tpf), and m32c.

?  MIPS has two pointer sizes, but a given compilation (gcc invocation) uses only one of them, it comes from the chosen ABI.

	paul


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-28 12:27     ` Jayant R. Sonar
@ 2011-03-30 13:37       ` Claudiu Zissulescu
  2011-03-31 13:45         ` Paulo J. Matos
  0 siblings, 1 reply; 8+ messages in thread
From: Claudiu Zissulescu @ 2011-03-30 13:37 UTC (permalink / raw)
  To: Jayant R. Sonar; +Cc: Paul Koning, DJ Delorie, gcc

Hi,

I would try using the named address space for your issue (see
TARGET_ADDR_SPACE_POINTER_MODE). Please check the SPU target for an
implementation example.

Regards,
Claudiu


On Mon, Mar 28, 2011 at 2:14 PM, Jayant R. Sonar
<Jayant.Sonar@kpitcummins.com> wrote:
>>?  MIPS has two pointer sizes, but a given compilation (gcc
>> invocation) uses only one of them, it comes from the chosen ABI.
>
> Yes, it looks like MIPS have got 2 ABIs - 32bit and 64bit. The choice
> of the ABI is controlled through a command line option '-march=arch'.
> Therefore in MIPS it doesn't look possible to have 2 pointers of
> different sizes existing simultaneously inside a single executable.
>
> Whereas, what I am looking forward to do is adding some target
> specific data attributes, say data16 and data32. In a simple test case
> I should be able to declare two different pointer variables using these
> attributes as following:
>
> char * ptrABC __attribute__ (data16);
> char * ptrXYZ __attribute__ (data32);
>
> The size of ptrABC should be 16bits and that of ptrXYZ should
> be 32bits.
>
> Will it be possible to do something like this in GCC?
>
> Regards,
> Jayant
>
>
> -----Original Message-----
> From: Paul Koning [mailto:paul_koning@dell.com]
> Sent: Friday, March 25, 2011 11:20 PM
> To: DJ Delorie
> Cc: Jayant R. Sonar; gcc@gcc.gnu.org
> Subject: Re: Supporting multiple pointer sizes in GCC
>
>
> On Mar 25, 2011, at 1:37 PM, DJ Delorie wrote:
>
>>
>> "Jayant R. Sonar" <Jayant.Sonar@kpitcummins.com> writes:
>>> Is it possible to support multiple pointer sizes (e.g. 16bit, 32bit)
>>> which can co-exist in single compilation unit?
>>> Whether it is supported in GCC now?
>>> Is there any other architecture which has this feature already
>>> implemented?
>>
>> Yes, there are three that I know of - mips64, s390 (tpf), and m32c.
>
> ?  MIPS has two pointer sizes, but a given compilation (gcc invocation) uses only one of them, it comes from the chosen ABI.
>
>        paul
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-30 13:37       ` Claudiu Zissulescu
@ 2011-03-31 13:45         ` Paulo J. Matos
  2011-04-21 22:21           ` Michael Meissner
  0 siblings, 1 reply; 8+ messages in thread
From: Paulo J. Matos @ 2011-03-31 13:45 UTC (permalink / raw)
  To: gcc

On 30/03/11 08:57, Claudiu Zissulescu wrote:
> Hi,
>
> I would try using the named address space for your issue (see
> TARGET_ADDR_SPACE_POINTER_MODE). Please check the SPU target for an
> implementation example.
>

Hummm, I haven't noticed this hook before. Could this be used to 
implement cases where function pointers have a different size than data 
pointers (as in harvard archs). It looks like it but can someone confirm?

Cheers,

--
PMatos

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Supporting multiple pointer sizes in GCC
  2011-03-31 13:45         ` Paulo J. Matos
@ 2011-04-21 22:21           ` Michael Meissner
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Meissner @ 2011-04-21 22:21 UTC (permalink / raw)
  To: Paulo J. Matos; +Cc: gcc

On Thu, Mar 31, 2011 at 01:32:24PM +0100, Paulo J. Matos wrote:
> On 30/03/11 08:57, Claudiu Zissulescu wrote:
> >Hi,
> >
> >I would try using the named address space for your issue (see
> >TARGET_ADDR_SPACE_POINTER_MODE). Please check the SPU target for an
> >implementation example.
> >
> 
> Hummm, I haven't noticed this hook before. Could this be used to
> implement cases where function pointers have a different size than
> data pointers (as in harvard archs). It looks like it but can
> someone confirm?

The SPU uses named address space to deal with local memory that the processor
deals with normally, and global memory that the host powerpc can see, and it is
moved in/out of the local memory.  In -mea64 mode, the external memory is
64-bits, so it has two different sizes of pointer.  The backend controls
whether one named address is a subset of another, and whether you can convert
between the named address spaces.  The technical report (N1169) of the ISO C
committee that the address space support is based on does not allow for
function pointers to be different sizes, just the data pointers.

The 2009 GCC summit proceedings has my paper describing adding the named
address space support to the compiler.  Note I have moved groups within IBM,
and no longer work on the SPU compiler, so I haven't touched the named address
space support since the early part of 2009.
http://gcc.gnu.org/wiki/HomePage?action=AttachFile&do=view&target=2009-GCC-Summit-Proceedings.pdf

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com	fax +1 (978) 399-6899

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-04-21 22:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 12:33 Supporting multiple pointer sizes in GCC Jayant R. Sonar
2011-03-25 17:39 ` DJ Delorie
2011-03-25 17:53   ` Paul Koning
2011-03-25 18:51     ` DJ Delorie
2011-03-28 12:27     ` Jayant R. Sonar
2011-03-30 13:37       ` Claudiu Zissulescu
2011-03-31 13:45         ` Paulo J. Matos
2011-04-21 22:21           ` Michael Meissner

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).