Named Address Spaces

Hello,

I am a student trying to find out if LLVM can be used for the Embedded C
architecture that I will be developing tools for at work. In LLVM 2.2
Christopher Lamb contributed support for Multiple Address Spaces into the
LLVM IR, and I was wondering if llvm-gcc is able to use this
functionallity. If so, what syntax is used to assign address spaces, and
what files are needed for the address spaces to be defined in the backend.
If not, how do users capitalize on this functionallity?

Thank you for your time,

- Gobi

Hi Gobi,

I am a student trying to find out if LLVM can be used for the Embedded C
architecture that I will be developing tools for at work. In LLVM 2.2
Christopher Lamb contributed support for Multiple Address Spaces into the
LLVM IR, and I was wondering if llvm-gcc is able to use this
functionallity. If so, what syntax is used to assign address spaces, and

You should look at the addrspace attribute. IIRC, the syntax is as follows:

__attribute__(( addrspace(10) )) int foo;

This should allocate foo in address space 10 (though I'm not 100% sure about
the syntax and don't have examples at hand).

what files are needed for the address spaces to be defined in the backend.
If not, how do users capitalize on this functionallity?

clang and LLVM IRC only support numbered address spaces, no names. There is no
need to define anything to get address spaces in the IR. You should probably
do something to make a backend actually use the address space information,
though I don't know what, where, or if there are any backends using this info
already. Perhaps others can comment?

Gr.

Matthijs

though I don't know what, where, or if there are any backends using this info
already. Perhaps others can comment?

We plan to use the address space info in backend to support the "rom"
address space for our target in near future.

- Sanjiv

We plan to use the address space info in backend to support the "rom"
address space for our target in near future.

This will likely relate to what I am doing, however, my manager and I are
currently trying to plan the entire toolchain, and key aspects involve both
propogating debug information and verifying variables using named address
spaces.

Debug info is represented with explicit metadata in the llvm IR, its representation of addr spaces would be orthogonal to how codegen and optimizers hack on it.

-Chris