<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 11, 2007, at 9:52 AM, Chris Lattner wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><DIV><DIV>On Nov 10, 2007, at 11:07 PM, Christopher Lamb wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">I've been playing around with clang/LLVM looking at adding partial support for the draft technical report for embedded C extensions (TR18037, <A href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf"><FONT class="Apple-style-span" color="#001FE8">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf</FONT></A>), specifically named address spaces.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Named address spaces need to be tracked in LLVM in essentially all the same places that alignment is tracked,</DIV></DIV></BLOCKQUOTE><BR></DIV><DIV>Others addressed the other questions, one (surprising?) thing I'd recommend:</DIV><DIV><BR class="webkit-block-placeholder"></DIV><DIV>Unlike alignment and volatility, I think that the address space qualifier should be represented explicitly in the type system.  The reason for this is primarily that pointers to different address spaces are really very different sorts of beasties: for example they can be codegen'd to have different sizes.  <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Very true.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BLOCKQUOTE type="cite"><DIV>Any property that affects how the value is stored in registers needs to be in the type instead of on the load/store instruction.  Also, unlike volatile, it is not common to cast a pointer between two different address spaces. </DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Though perhaps infrequent, casting between address spaces is allowed based on rules that the target defines indicating which address spaces are subsets of others. Does supporting those casts require an explicit operation (ie intrinsic)?</DIV><BR><BLOCKQUOTE type="cite"><DIV>The good thing about this is that I think it will make it substantially easier to update the various llvm optimizations if you do this.<BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Bonus!</DIV><BR><BLOCKQUOTE type="cite"><DIV>The meat of project boils down to adding a new address space qualifier field to PointerType, making sure PointerType takes this field into account when it is being uniqued, and adding the address space qualifier to things like global variable.</DIV><DIV><BR class="webkit-block-placeholder"></DIV><DIV>Does this sound reasonable?</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>That sounds like it should be easier than adding the address space ID to all the instructions and SDNodes.</DIV></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'll give it a try and see what happens. I can see that adding it to the type system makes it easier on the optimizer, but I don't yet understand all the consequences for the code generator.</DIV><BR><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>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></BODY></HTML>