<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 6 May 2014 11:24, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">ping</div></blockquote><div><br></div><div class="gmail_quote">+ If the third field is present, non-null, and points to a global variable</div><div class="gmail_quote">+ or function, the initializer function will only run if the associated</div>

<div class="gmail_quote">+ data from the current module is included in the final linked image.</div><div class="gmail_quote"><br></div><div class="gmail_quote">"included in the final linked image" isn't well-defined at the level of LLVM IR. I think you mean "is not discarded", but I'm not certain.</div>

<div class="gmail_quote"><br></div>-      Assert1(STy && STy->getNumElements() == 2 &&<br>+      Assert1(STy && (STy->getNumElements() == 2 ||<br>+                      STy->getNumElements() == 3) &&</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">So you're going to permit old-style and new-style in the IR. What happens when I link the two? I think you need to autoupgrade to the new 3-argument form.</div>

<div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote">+ namespace {<br></div><div class="gmail_quote"><div class="gmail_quote">+ struct Structor {</div><div class="gmail_quote">+   Structor() : Priority(0), Func(0), ComdatKey(0) {}</div>

<div class="gmail_quote">+   int Priority;</div><div class="gmail_quote">+   llvm::Constant *Func;</div><div class="gmail_quote">+   llvm::GlobalValue *ComdatKey;</div><div class="gmail_quote">+ };</div><div class="gmail_quote">

+ } // end namespace</div><div><br></div></div><div class="gmail_quote">C++11-ification: nullptr instead of 0, in-class initializers instead of a constructor.</div><div class="gmail_quote"><br></div><div class="gmail_quote">

I'd appreciate if someone else reviewed the MC changes.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Overall this looks like a good language extension!</div><div class="gmail_quote"><br></div><div class="gmail_quote">

Nick</div><div class="gmail_quote"><br></div></div><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 28, 2014 at 1:36 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">ping</div><div><div><div class="gmail_extra">

<br><br><div class="gmail_quote">
On Thu, Apr 24, 2014 at 5:53 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi nicholas, nlewycky,<br>
<br>
This allows us to put dynamic initializers for weak data into the same<br>
comdat group as the data being initialized.  This is necessary for MSVC<br>
ABI compatibility.  It should also allow GlobalOpt to fire more often<br>
weak data on other platforms if we can sort out the initialization of<br>
the guard variable.<br>
<br>
<a href="http://reviews.llvm.org/D3499" target="_blank">http://reviews.llvm.org/D3499</a><br>
<br>
Files:<br>
  docs/LangRef.rst<br>
  include/llvm/CodeGen/TargetLoweringObjectFileImpl.h<br>
  include/llvm/Target/TargetLoweringObjectFile.h<br>
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br>
  lib/IR/Verifier.cpp<br>
  lib/Transforms/IPO/GlobalOpt.cpp<br>
  test/MC/COFF/global_ctors_dtors.ll<br>
  test/Transforms/GlobalOpt/ctor-list-opt.ll<br>
  test/Verifier/global-ctors.ll<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>