[llvm-dev] How to get analysis in a class which is not a LLVM pass?
Quentin Colombet via llvm-dev
llvm-dev at lists.llvm.org
Wed Jul 13 13:06:03 PDT 2016
Hi,
> On Jul 13, 2016, at 1:03 AM, vivek pandya via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hello,
>
> I want to use ProfileSummaryInfo in a class which is not a LLVM pass like TargetFrameLowering class (lib/CodeGen/TargetFrameLoweringImpl.cpp)
>
> one way I know to get ProfileSummaryInfo is
> getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(M);
> but I can't use this.
>
> Is this really possible?
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.
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.
Cheers,
Q.
>
> Sincerely,
> Vivek
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list