<div dir="ltr">Yes, I believe float ABI will be discussed later. I'm choosing a few options at a time from the list (see the file attached to PR21471) and trying to understand what changes are necessary to pass down the options to the backend for LTO and also enable compiling function with different options.<div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 12:11 AM, Alex Rosenberg <span dir="ltr"><<a href="mailto:alexr@leftfield.org" target="_blank">alexr@leftfield.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>The chosen float ABI is also critical to pass down.</div><div><br>Alex</div><div><div class="h5"><div><br></div><div>On Jan 27, 2015, at 12:28 AM, Akira Hatanaka <<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>I've been investigating what is needed to ensure command line options are passed to the backend codegen passes during LTO and enable compiling different functions in a module with different command line options (see the links below for previous discussions).<br></div><div><br></div><div><a href="http://thread.gmane.org/gmane.comp.compilers.llvm.devel/78855" target="_blank">http://thread.gmane.org/gmane.comp.compilers.llvm.devel/78855</a><br></div><div><a href="http://thread.gmane.org/gmane.comp.compilers.llvm.devel/80456" target="_blank">http://thread.gmane.org/gmane.comp.compilers.llvm.devel/80456</a><br></div><div><br></div><div>The command line options I'm currently looking into are "-target-cpu" and "-target-feature" and I would like to get feedback about the approach I've taken (patches attached).</div><div><br></div><div>The attached patches make the following changes:</div><div><br></div><div>- In TargetMachine::getSubtarget(const Function*) and MachineFunction's constructor, use per-function subtarget object instead of TargetMachine's (module-level) subtarget object. This allows passes like selection dag to switch the target on a per-function basis.<br></div><div><br></div><div>- Define class TargetOptions::Option, which records whether an option has appeared on the command line along with the option's value. Long term, this might not be the best solution and I expect it will be modified or replaced when the new command line infrastructure becomes available.</div><div><br></div><div>- Fix X86's subtarget lookup to override the function attributes if the corresponding options were specified on the command line.</div><div><br></div><div>- FIx clang to embed "-target-cpu" and "-target-feature" attributes in the IR.</div><div><br></div><div>I've tested the changes I made and confirmed that target options such as "-mavx2" don't get dropped during LTO and are honored by backend codegen passes.</div><div><br></div><div>This is my plan for the remaining tasks:</div><div><br></div><div>1. FIx other in-tree targets and other code-gen passes that are still using TargetMachine's subtarget where the per-function subtarget should be used.</div><div><br></div><div>2. Fix TargetTransformInfo to compute the various code-gen costs accurately when subtarget is switched on a per-function basis. One way to do this is to make the pointer or reference to the Function object available to the various subclasses of TargetTransformInfo by defining the necessary functions in FunctionTargetTransformInfo (similar to the changes made in r218004). However, passes like Inliner that are not function passes cannot access FunctionTargetTransformInfo, so it has to be done in a different way.</div><div><br></div><div>3. Forbid inlining functions that have incompatible cpu and feature attributes. It seems the simplest approach is to allow inlining only if the cpu and feature attributes match exactly, but it's also possible to relax this restriction.</div></div>
</div></blockquote></div></div><blockquote type="cite"><div><cpufs_llvm1.patch></div></blockquote><blockquote type="cite"><div><cpufs_clang1.patch></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><br></div></blockquote></div></blockquote></div><br></div></div></div>