I’m interested in profile-guided optimizations and was looking at the functionality LLVM provides. I have two questions:
can the current (optimal) edge profiling be used to determine the number of times a function calls another one? I need to know not only how many times a function was called, but also by whom. Or to say in in a different way, can a profile edge be formed from blocks originating from different functions? I need this information so that I cluster the functions based on the call frequency and the relationship between them.
is there a way to force the linker to place the functions in a specific order in the object file? I mean something like associating a number with each function, and the linker placing the functions ordered by these numbers. The assigned number would be the ID of the cluster in which the function is found.
If this is not possible the only idea left would be to place the functions in different sections, but that would interfere with directives written by the user in the source files.
Thanks in advance,
PS: It’s probably clear that I want to implement a function placement optimization like the one described by Pettis & Hansen.