[llvm-dev] Add callee list in the llvm IR

Nagaraju Mekala via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 28 07:03:07 PDT 2021


Hi Sjoerd,
Thanks for the reply.
On Tue, Apr 27, 2021 at 9:00 PM Sjoerd Meijer <Sjoerd.Meijer at arm.com> wrote:
>
> Just sketching and I haven't tried any of this, but if understand things correctly, then something along the lines of this would be the idea?
>
>   for (Function &F : Module) {
>     if (!F.isDeclaration())
>       continue;
>     for (auto *U : F.users()) {
>       if (!isa<CallInst>(U)
>         continue;
>       U->dump();
>     }
>   }
I have added the suggested code in VisitCallExpr function of
SemaDecl.cpp/SemaDeclCXX.cpp/Parser.cpp files but it didn't work.
Can you please let me know which file would be the best to add this code.

Thanks,
Nagaraju
> ________________________________
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Nagaraju Mekala via llvm-dev <llvm-dev at lists.llvm.org>
> Sent: 27 April 2021 12:25
> To: LLVM Developers Mailing List <llvm-dev at lists.llvm.org>
> Subject: [llvm-dev] Add callee list in the llvm IR
>
> Hello All,
>
> I have a requirement to list all the function callee's as an entry in
> the llvm IR, so that one of the llvm pass can use them and do certain
> optimizations.
>
> ex:
> abc()
> {
>    ...
>    a();
>    b();
> }
>
> IR:
> define void @_Z23_abc() #0 !dbg !5503 !Callee_list !5504 {
>  ...
> !5504 = !{!"a,b"}
>
> I tried looking into SemaDeclCXX.cpp but all I was getting in the
> definition data.
> Can someone point out how we can do this?
>
> Thanks in advance
> Nagaraju
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list