<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 17, 2011, at 8:21 PM, Owen Anderson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="Apple-interchange-newline">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<span class="Apple-converted-space"> </span><i>need</i> to link/initialize all passes available, so that they can be available from the command line.  These clients<span class="Apple-converted-space"> </span><i>do</i> call initializeScalarOpts(), thus forcing linkage of all the passes as desired.</div></div></blockquote><br></div><div>Ok, how about following the existing pattern of putting this in a header file instead of a .cpp file?  With this header, is "LinkAllPasses" needed?  Can we remove LinkAllPasses and just use "InitializeAllPasses" instead?</div></div></blockquote><br></div><div>We can do that, if you want, but we'll still want to have separate headers for LinkAllPasses() vs. LinkAllCodeGen(), etc., so that opt doesn't have to link in all of CodeGen, and vice-versa for llc. </div></span></blockquote><br></div><div>Sure, I'm just looking to *reduce* the number of places that have to be touched to add a new pass.</div><div><br></div><div>-Chris</div></body></html>