[LLVMdev] Address Spaces for local memories

Christopher Lamb christopher.lamb at gmail.com
Mon Apr 21 19:53:06 PDT 2008


Guima,

For LLVM IR syntax see the Language reference manual:
http://llvm.org/docs/LangRef.html#globalvars
http://llvm.org/docs/LangRef.html#t_pointer

The target-specific C front-end is responsible for generating the  
correct LLVM IR with address space information in it, and there is a  
proposed extension to C (Embedded C extensions, search for that on  
the list archives and you should get some useful threads) which those  
front ends can use.

Some GCC targets support this, however llvm-gcc currently doesn't  
support those targets. The machinery to hook this up in llvm-gcc may  
be there, simply waiting to be hooked up for your target. Another  
option may be clang, the C-languages front end which is part of the  
LLVM project. Clang currently has support for the Embedded C address- 
spaces extension, but is not nearly as mature as llvm-gcc.

Contributions towards using and testing address spaces is very welcome!

Hope that gives you some places to start digging.
--
Christopher Lamb

On Apr 21, 2008, at 4:58 PM, Giuma Cordes wrote:

> Hello,
>
> I'm developing a C compiler for a  machine with different local  
> memories, for which I need to be able to specify in which specific  
> memory a global variable should be allocated,  and I also need to  
> generate different instructions for accessing different local  
> memories.
>
> I've seen in the LLVM 2.2 release notes that there is now support  
> for multiple address spaces, that seem to address my problem, but I  
> couldn't understand how to use them.
>
> Should I indeed use address spaces for my local memories requirements?
> If yes, can someone tell me how to specify address spaces in C for  
> global variables?
> Is it possible to specify that a given pointer (e.g. a function  
> argument or local pointer variable) points to a specific address  
> space and how?
> How do I then retrieve the address space information in the LLVM  
> IR, in particular when using pointers?
>
> Thanks,
>
> -- Giuma Cordes
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080421/f5e734c6/attachment.html>


More information about the llvm-dev mailing list