[llvm-dev] Finding callees of a function

Marc via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 15 01:54:24 PST 2020

I searched the doxygen documentation and could not find a solution to my

In a ModulePass running at EP_OptimizerLast, if I have a function F like in:

  bool Foo:runOnModule(Module &M) {
    LLVMContext &C = M.getContext();
    for (auto &F : M) {
      // magic here

if I want to know from which function (callee) each function is called -
how can I do this?
(so that I e.g. have a "Function *callee" result or a list if it is
called from several other functions - or even better, the specific basic
blocks  where the calls are.)

I am aware that this will not work for calls that are made outside of
the analyzed module.



Marc Heuse

PGP: AF3D 1D4C D810 F0BB 977D  3807 C7EE D0A0 6BE9 F573

More information about the llvm-dev mailing list