<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 14, 2016 at 2:27 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.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"><span class=""><br>
> On Jul 13, 2016, at 1:06 PM, Quentin Colombet via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
>> On Jul 13, 2016, at 1:03 AM, vivek pandya via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I want to use ProfileSummaryInfo in a class which is not a LLVM pass like TargetFrameLowering class (lib/CodeGen/TargetFrameLoweringImpl.cpp)<br>
>><br>
>> one way I know to get ProfileSummaryInfo is<br>
>> getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(M);<br>
>> but I can't use this.<br>
>><br>
>> Is this really possible?<br>
><br>
> Not really. That would mean that anything that uses the method that access that information would need to depend on ProfileSummaryInfoWrapperPass, which is pretty bad from the software engineering standpoint.<br>
><br>
> Something possible is to use getAnalysisIfAvailable (or something like that, I haven’t checked the actual name), but that means you need to be able to work correctly if the pass is not available.<br>
<br>
</span>It is more complex than that: if the class where you need it is not a Pass itself (as Vivek mentions above), you can’t call getAnalysisIfAvailable either.<br>
<br>
I believe the right way to do it is to extend the API to take an optional (or mandatory depending on what is done) extra object. Here it could be ProfileSummaryInfo for instance, but maybe something more targeted like a bool if all what’s needed is to answer “Am I processing a hot or cold function?”.<br></blockquote><div>I do not understand this clearly. Do you here mean to extern MF API or determineCalleeSaves() in TargetFrameLowering. I wanted to do all processing inside TargetFrameLoweringImpl so that optimization will be target independent. Other wise if we plan to pass ProfileSummaryInfo from X86TargetFrameLowering (which it self is not pass) or some pass which is using it than it would become target dependent.</div><div><br></div><div>-Vivek</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">
<br>
—<br>
<span class=""><font color="#888888">Mehdi<br>
</font></span><div class=""><div class="h5"><br>
<br>
<br>
<br>
><br>
> Cheers,<br>
> Q.<br>
><br>
>><br>
>> Sincerely,<br>
>> Vivek<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
</div></div></blockquote></div><br></div></div>