> Of course, the compiler can't dump the callgraph of the whole program. > But it could dump the list of functions called by every function of a > translation unit. With annotations which of the calls are inlined. Which > could then be processed by a script to get the whole callgraph.
We have had something along these lines in our compiler at AdaCore for a few years; it's called -fcallgraph-info, it generates a very low-level callgraph in VCG format for each compilation unit, and the nodes can be decorated with information (typically stack usage indeed). Then you run a script to "link" all the VCG files for a program and you can (try and) compute the worst case stack usage for example. This works reasonably well for embedded stuff. I'll try and submit something before stage 1 ends if people are interested. -- Eric Botcazou