<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 Aug 18, 2014, at 4:25 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com" class="">fpizlo@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Aug 18, 2014, at 3:21 PM, Chris Bieneman <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Aug 18, 2014, at 3:09 PM, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com" class="">rafael.espindola@gmail.com</a>> wrote:<br class=""><br class="">Some passes take options directly in the constructor. For example<br class=""><br class="">Inliner::Inliner(char &ID, int Threshold, bool InsertLifetime)<br class=""><br class="">Maybe we could just say that there are two different types of options.<br class="">The ones we want to expose to users and the ones which we use for<br class="">testing llvm itself. The options we want to expose should be just<br class="">constructor arguments. With that distinction we should be able to just<br class="">not use the options added by cl::OptionRegistry::CreateOption unless<br class="">cl::ParseCommandLineOptions is called. WebKit like clients would just<br class="">not call cl::ParseCommandLineOptions. Would that work?<br class=""><br class=""><br class="">This is actually how some of our internal clients are already working. There<br class="">are a few caveats with this approach:<br class=""><br class="">(1) You can’t allow the pass manager to allocate your passes for you,<br class="">because those passes only read from cl::opts<br class=""></blockquote><br class="">You mean PassManagerBuilder, right?<br class=""></blockquote><br class="">Yes.<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">(2) Not all of our passes have constructors for overriding their cl::opts<br class="">(the legacy Scalarizer is one)<br class=""><br class="">I think it would in general be cleaner to provide a way for library clients<br class="">to use cl::opts without being forced to parse a command line.<br class=""></blockquote><br class="">I guess it really depends on how many options there are that we want<br class="">to expose via an API. I have the impression that there are few, which<br class="">would make changing the constructors and PassManagerBuilder better.<br class=""><br class="">If there is a large number of options that we want to expose, then I<br class="">can see the value of having a llvm "configuration object" that is<br class="">passed around and is queried by the passes. If we do go down this<br class="">road, we should change passes like the inliner to use the<br class="">configuration object instead of constructor options. We should also<br class="">drop the "cl" from the names if it is not going to be handling command<br class="">lines :-)<br class=""></blockquote><br class="">I’m curious if Tom Stellard or Filip Pizlo have any input on this as they are more directly involved on the client side.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The fewer options we fiddle with, the better for WebKit. Hence we would be fine with a solution that exposes relatively few options.<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The main option that we use now - turning on stack map liveness calculation - is something that feels like it shouldn't be an "option" at all but maybe an attribute instead.<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div>How do you construct you PassManager?</div><div><br class=""></div><div>-Chris</div><div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="">I do agree that we should ultimately drop the cl namespace if we’re going in this direction.<br class=""><br class="">-Chris<br class=""><br class=""><blockquote type="cite" class=""><br class="">Cheers,<br class="">Rafael<br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span> <a href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></blockquote></div></blockquote></div><br class=""></body></html>