On Tue, Dec 4, 2012 at 12:47 PM, Steven Bosscher <stevenb....@gmail.com> wrote: > On Tue, Dec 4, 2012 at 9:14 PM, Xinliang David Li wrote: >> I assume the graph dump does not support multiple function dump (I >> noticed that the previous function's dump gets overwritten). This >> reminds me that I need to resurrect my per-function dump support, and >> dump-before/after patches at some point. > > Not sure what you mean with "multiple function dump"...? > > What my dumper does, is dump each function as a subgraph. If you dump > a translation unit with more than one function, all function graphs > will be in the same file. With a good DOT viewer, it's still quite > readable.
Was it a bug then? for this program: typedef unsigned int uint; int foo (uint a, uint b, uint c, uint d, uint e, uint f) { return (a*b + (c << 1) + (d << e) + f + 1); } int foo2 (uint a, uint b, uint c, uint d, uint e, uint f) { return ((f<<e) + (d << 1) + (c*b) + a + 1); } The dot file generated with -fdump-tree-optimized-graph is digraph "" { overlap=false; subgraph "foo2" { color="black"; label="foo2"; fn_1_basic_block_1 [shape=Mdiamond,style=filled,fillcolor=white,label="EXIT"]; fn_1_basic_block_2 [shape=record,style=filled,fillcolor=lightgrey,label="{\<bb\ 2\>:\l\ |e.1_2\ =\ (int)\ e_1(D);\l\ |_4\ =\ f_3(D)\ \<\<\ e.1_2;\l\ |_6\ =\ d_5(D)\ \<\<\ 1;\l\ |_10\ =\ c_8(D)\ *\ b_9(D);\l\ |_7\ =\ a_12(D)\ +\ 1;\l\ |_11\ =\ _7\ +\ _10;\l\ |_13\ =\ _11\ +\ _6;\l\ |_14\ =\ _13\ +\ _4;\l\ |_15\ =\ (int)\ _14;\l\ |return\ _15;\l\ }"]; fn_1_basic_block_0 [shape=Mdiamond,style=filled,fillcolor=white,label="ENTRY"]; fn_1_basic_block_0:s -> fn_1_basic_block_2:n [style="solid,bold",color=blue,weight=100,constraint=true]; fn_1_basic_block_2:s -> fn_1_basic_block_1:n [style="solid,bold",color=black,weight=10,constraint=true]; } } There is no subgraph -- did I miss anything? > > I have a perl scriptlet in the pipe line to split one DOT file into > per-function DOT files, and to merge per-function DOT files from > different passes. It will be nicer to avoid any postprocessing. Once we have the ability to dump one function at a time, the support will be there automatically. > > >> Why can't the dot dumper dump the count/frequency/branch prob >> information? The attached dot file is generated from an assembly file >> dumped with -S -dA option. > > It can, and should. I just didn't get around to that yet. ok. > > I want to add the count//freq/branchprob as edge labels, similar to > your dump. I also want to add it to the basic blocks as well but I'm > not sure how to pretty-print it such that it doesn't clobber the view > of the instructions contained in the basic block. Unfortunately DOT > doesn't support edge classes or layers you can toggle. > > I even had the dumper print the GIMPLE SSA web and DF DU/UD chains, > using ports on the fields in the record nodes that I use for dumping > the instructions. But that really cluttered the graph too much. I'm > still going to add the ports, at least, to use in dumping the > scheduler's dependence graph. DU/UD chains are good source of information -- the problem is it can be too dense. Conceivably, this can be dumped on-demand for selected webs. > > The whole graph dumping infrastructure will get another overhaul for > GCC 4.9 to make it easier to use for non-CFG dumps and to allow passes > to add their own meta-data to the dumps. Do you have a brief design somewhere? thanks, David > > Ciao! > Steven