<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 7, 2010, at 10:02 AM, Aaron Gray wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On 7 May 2010 17:53, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div class="im"><br><div><div>On May 7, 2010, at 9:51 AM, Nathan Jeffords wrote:</div><br><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div>This seems counter intuitive to me, I can understand that C assigned that behavior somewhat arbitrarily to uninitialized global variables, but in LLVM there is explicitly a common linkage attribute to get that behavior. Nothing in the llvm language reference indicates the behavior of a global with the 'internal' linkage attribute should change based of the values used to initialize it.</div>
</blockquote></div><br></div></div><div>I don't follow. The object file format provides a means for efficiently zero filling a local symbol. The compiler is just using it. What is the problem you're trying to solve here? Since it is not exported out of the .o file (it is local) there whether it is "common" or not is undetectable, we just get a storage optimization.</div>
<div><br></div></div></blockquote><div><br></div><div>I don't know, I see common and it makes me think that things are getting merged together, but as you say it is local so the fact that its also common becomes irrelevant. In MachO do you just put these into the .bss section?</div>
</span><br></blockquote></div><br></div><div>Macho has a special zerofill directive (targeted at the BSS section) for this. You can see this by running your example like this:</div><div><br></div><div><div>$ llc t.ll -o - -mtriple=i386-apple-darwin10</div>
<div><span style="white-space:pre"> </span>.section<span style="white-space:pre"> </span>__TEXT,__text,regular,pure_instructions</div><div>.zerofill __DATA,__bss,_tst1,4,0 ## @tst1</div><div><span style="white-space:pre"> </span>.section<span style="white-space:pre"> </span>__DATA,__data</div>
<div>_tst2: ## @tst2</div><div><span style="white-space:pre"> </span>.ascii<span style="white-space:pre"> </span> "\000\001\002\003"</div></div></div></blockquote><div><br></div>
<div>I think we should have an 'EmitZeroFill()' and 'EmitASCII()' OutStream methods, the latter to deal with dllexports in '<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">lib/Target/X86/AsmPrinter/AsmPrinter.cpp:569'.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">We also need to sort out COFF TLOF, and get rid of the directive stuff.</span></div>
</div></blockquote></div><br><div>It looks to me that you should have an Emit method for the .scl, .def, .type, .endef directives. One callback each.</div><div><br></div><div>-Chris</div></body></html>