[PATCH] Add named address support to GCC 4.5

Chris Lattner clattner@apple.com
Fri Apr 17 16:58:00 GMT 2009


On Apr 13, 2009, at 8:21 AM, Michael Meissner wrote:

> This patch is a combination patch of all of the work done on the  
> branch
> named-addr-spaces-branch to add the ability for backends to named  
> address space
> which are documented in section 5 of the ISO/IEC technical report  
> #18037:
>
> 	Programming Languages - C - Extensions to support embedded processors
>
> This patch allows the backend to add new qualifier keywords that can  
> put
> objects into different address spaces.  The notion of address space  
> is carried
> throughout the compiler, so that the backend can decide to generate  
> different
> code based on the address space used.  Pointers to different named  
> address
> spaces can be different sizes than normal pointers, and the backend  
> can specify
> when pointers to two different named address spaces are compatible  
> or not.
>
> In the spu backend, there is a single named address space (__ea)  
> which points
> into the host processor's memory space, instead of the onboard  
> memory space,
> and a caching mechanism is used to move items in the larger host  
> address space
> to the local address space.

Out of curiosity, what is the motivation for making these actual  
keywords?  Clang has support for address spaces as well, and clients  
that use them just install a predefine that expands to an attribute.   
For example, cellspu could install:

#define __ea __attribute__((address_space(1)))

Which enables, stuff like:

int __ea *P;

etc.  Since __ea is in a protected namespace, there should be no  
problem making it a macro.

-Chris



More information about the Gcc-patches mailing list