Hi, Richi, On Oct 26, 2019, Richard Biener <rguent...@suse.de> wrote:
> How does it relate to the LTO-dump utility we have now which can in > theory provide a more complete view? Erhm... Not at all, AFAICT. The only vague resemblance I see is in the presence of the word "callgraph" in the description of what both can do, but even that's not quite the same callgraph, besides the different format. E.g., the reason we gather expanded calls rather than just use cgraph_edges is that the latter would dump several "calls" that are builtins expanded internally by the compiler, and would NOT dump other ops that are expanded as (lib)calls. In order to get an accurate assessment of stack size requirements, the presence of the builtins could be confusing but not so much trouble, but the absence of libcalls would underestimate the potential max total stack use by a symbol. > Maybe some infrastructure can be > shared here (the actual dumping of the cgraph?) You mean the one-liner loop in cgraph_node::dump_graphviz, called by lto-dump to dump the cgraph? That doesn't really seem worth sharing; more so considering we dump edges in a quite different format, and not just the edges. In this different format expected by gnatstack, we also dump the nodes, and include information in the labels of the nodes, such as their original spelling and location, as well as stack use: node: { title: "_ada_p" label: "P\np.adb:1:1\n48 bytes (static)" } and dynamic stack allocations (alloca and vlas): node: { title: "p.adb:p__u" label: "u\np.adb:21:3\n2 dynamic objects\n rt p.adb:23:5\n ri p.adb:24:5" } and though edges to libcalls may carry just as little info as a graphviz "from" -> "to" edge: edge: { sourcename: "add" targetname: "__addvsi3" } those between user symbols carry location info as well: edge: { sourcename: "p__s" targetname: "p.adb:p__v" label: "p.adb:46:5" } So I'm afraid I don't see anything that could be usefully factored out. Do you? Thanks, -- Alexandre Oliva, freedom fighter he/him https://FSFLA.org/blogs/lxo Be the change, be Free! FSF VP & FSF Latin America board member GNU Toolchain Engineer Free Software Evangelist Hay que enGNUrecerse, pero sin perder la terGNUra jamás - Che GNUevara