<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 15, 2011, at 11:11 PM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Oct 7, 2010, at 10:55 AM, Owen Anderson wrote:<br><br><blockquote type="cite">Author: resistor<br></blockquote><blockquote type="cite">Date: Thu Oct  7 12:55:47 2010<br></blockquote><blockquote type="cite">New Revision: 115927<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=115927&view=rev">http://llvm.org/viewvc/llvm-project?rev=115927&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">Next step on the getting-rid-of-static-ctors train: begin adding per-library<br></blockquote><blockquote type="cite">initialization functions that initialize the set of passes implemented in<br></blockquote><blockquote type="cite">that library.  Add C bindings for these functions as well.<br></blockquote><br>Hi Owen,<br><br>This is a really unsatisfactory way to handle this.  Doing this means that Scalar.cpp will depend on *all* of the transformation in the library, so someone linking in scalar.cpp will pull in every single .o file in the archive.  The idea of the previous design was that you'd only link in the passes you actually need.<br></div></blockquote></div><br><div>That is still the case.  There's two kinds of clients that we care about:</div><div><br></div><div>1) clang and similar clients, which know upfront which set of passes they care about.  Their passes are explicitly initialized when they call createFooPass().  Since they never call the global initializeScalarOpts(), they don't link in Scalar.cpp, instead only linking in those passes for which they call createFooPass().</div><div><br></div><div>2) opt and kin, which <i>need</i> to link/initialize all passes available, so that they can be available from the command line.  These clients <i>do</i> call initializeScalarOpts(), thus forcing linkage of all the passes as desired.</div><div><br></div><div>--Owen</div></body></html>