<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Guima,</div><div><br></div><div>For LLVM IR syntax see the Language reference manual:</div><div><a href="http://llvm.org/docs/LangRef.html#globalvars">http://llvm.org/docs/LangRef.html#globalvars</a></div><div><a href="http://llvm.org/docs/LangRef.html#t_pointer">http://llvm.org/docs/LangRef.html#t_pointer</a></div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Contributions towards using and testing address spaces is very welcome!</div><div><br></div><div>Hope that gives you some places to start digging.</div><div><div>--</div><div>Christopher Lamb</div></div><br><div><div>On Apr 21, 2008, at 4:58 PM, Giuma Cordes wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello,<br><br>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.<br> <br>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.<br><br>Should I indeed use address spaces for my local memories requirements?<br>If yes, can someone tell me how to specify address spaces in C for global variables?<br> 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?<br>How do I then retrieve the address space information in the LLVM IR, in particular when using pointers?<br> <br>Thanks,<br><br>-- Giuma Cordes<br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">LLVM Developers mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <span class="Apple-converted-space"> </span><a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div> </blockquote></div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span> </div><br></body></html>