Nagaraju Mekala via llvm-dev
2021-Apr-27 11:25 UTC
[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
Sjoerd Meijer via llvm-dev
2021-Apr-27 15:30 UTC
[llvm-dev] Add callee list in the llvm IR
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(); } } ________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210427/434996ad/attachment.html>