<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 13, 2017, at 12:25 PM, Chris Lovett via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Well I have a great test case if someone wants to help show me where/how to fix this in MC.  </div></div></blockquote>Hi Chris</div><div><br class=""></div><div>Looks like its probably almost all there.  In AsmPrinter.cpp emitGlobalConstantDataSequential we do:</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><br class=""></div><div>if (CDS->isString())</div><div>    return AP.OutStreamer->EmitBytes(CDS->getAsString());</div></blockquote><div class=""><br class=""></div>After that, either all the time, or perhaps if the array isn’t a small number of integers/floats, you can emit it as a byte sequence with:<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>AP.OutStreamer->EmitBinaryData(CDS->getAsString());</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete<br class=""><div class=""><div><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Sep 11, 2017 at 8:24 PM, Chris Lattner <span dir="ltr" class=""><<a href="mailto:clattner@nondot.org" target="_blank" class="">clattner@nondot.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class="">On Sep 10, 2017, at 1:34 AM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>> wrote:<br class=""></span><div class=""><span class=""><blockquote type="cite" class=""><br class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class="">IMO, there is a relatively easy solution for this.  Introduce a new subclass of ConstantData which represents a blob of data that gets emitted to the .o file, stored in a reasonable native format.  I think it would be fine to limit this to only representing arrays of primitive types (e.g. array of float, array of bytes, etc) since this keeps the API to the type simple (the type models an array, so it should have array element members only), and things that want to get the elements of the array out can have them returned as ConstantInt’s (or whatever).  I’d name this something like “ConstantArrayBlob”.</div></div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">What's the relationship between ConstantDataArray and ConstantArray?</div></div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Ah, it looks like ConstantDataArray is exactly what I was advocating for.  Does Clang generate it from an array of doubles?  Maybe that is all that is missing.</div><span class=""><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><div class="">densely packed data, instead of as Value*'s." so I assumed that it was a dense representation and it seemed reasonable that an i8 typed one of them would basically operate as a "ConstantArrayBlob". (but I guess if MC still creates one fragment per element that will still be a memory hog regardless of the IR's representation)</div></div></div></div></div></div></blockquote><br class=""></span></div><div class="">Yeah, MC should totally be fixed.  That’s crazy!</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><br class=""></font></span></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></div></body></html>